XWorkstation.st
author Stefan Vogel <sv@exept.de>
Sat, 15 Mar 2008 18:17:21 +0100
changeset 4928 4e457b74f5d2
parent 4845 962f39074c53
child 5033 27bc058343f0
permissions -rw-r--r--
Fix raw keysym translation. This makes Ctrl-CursorUp and Ctrl-CursorDown work in expecco tree.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     1
"
6
7ee0cfde237d *** empty log message ***
claus
parents: 5
diff changeset
     2
COPYRIGHT (c) 1989 by Claus Gittinger
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
     3
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     4
48194c26a46c Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
"
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
    12
"{ Package: 'stx:libview' }"
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
    13
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    14
DeviceWorkstation subclass:#XWorkstation
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
    15
	instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    16
		hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    17
		hasImageExtension hasInputExtension ignoreBackingStore blackpixel
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
    18
		whitepixel atoms protocolsAtom deleteWindowAtom saveYourselfAtom
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
    19
		quitAppAtom primaryAtom clipboardAtom stringAtom wmStateAtom
4106
13345050fcc4 fourByteString font queries
Claus Gittinger <cg@exept.de>
parents: 4090
diff changeset
    20
		motifWMHintsAtom listOfXFonts buttonsPressed eventRootX
13345050fcc4 fourByteString font queries
Claus Gittinger <cg@exept.de>
parents: 4090
diff changeset
    21
		eventRootY displayName eventTrace dispatchingExpose rgbVisual
13345050fcc4 fourByteString font queries
Claus Gittinger <cg@exept.de>
parents: 4090
diff changeset
    22
		virtualRootId rootId altModifierMask metaModifierMask
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    23
		lastEventTime lastButtonPressTime deviceIOTimeoutErrorSignal
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    24
		activateOnClick rawKeySymTranslation selectionOwner selectionTime
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
    25
		selectionFetchers selectionHandlers preWaitAction xlibTimeout
4411
5e5d008efba2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
    26
		xlibTimeoutForWindowCreation hasConnectionBroken uniqueDeviceID
5e5d008efba2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
    27
		stxDeviceAtom uuidAtom'
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
    28
	classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    29
		DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation'
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    30
	poolDictionaries:''
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    31
	category:'Interface-Graphics'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
    32
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    33
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    34
Object subclass:#SelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
    35
	instanceVariableNames:'sema message display drawableID selectionID propertyID targetID
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
    36
		buffer done incremental'
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    37
	classVariableNames:''
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    38
	poolDictionaries:''
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    39
	privateIn:XWorkstation
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    40
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    41
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
    42
!XWorkstation primitiveDefinitions!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    43
%{
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    44
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
    45
#define SUPPORT_MOTIF_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
    46
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    47
#ifdef LINUX
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    48
# define SHM
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    49
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    50
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    51
#define COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    52
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    53
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    54
static int __cnt_color = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    55
static int __cnt_bitmap = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    56
static int __cnt_view = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    57
static int __cnt_gc = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    58
static int __cnt_cursor = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    59
static int __cnt_font = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    60
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    61
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    62
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    63
/*
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    64
 * x does a typedef Time - I need Object Time ...
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    65
 */
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    66
#undef Time
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    67
#define Time XTime
48194c26a46c Initial revision
claus
parents:
diff changeset
    68
391
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    69
/*
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    70
 * x does a #define True / False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    71
 * 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
    72
 */
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    73
#undef True
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    74
#undef False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    75
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    76
#ifdef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    77
# undef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    78
#endif
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    79
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
    80
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    81
#include <stdio.h>
4401
Claus Gittinger <cg@exept.de>
parents: 4400
diff changeset
    82
#include <malloc.h>
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    83
#include <X11/Xlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    84
#include <X11/Xutil.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    85
#include <X11/Xatom.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    86
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    87
#define XK_MISCELLANY
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    88
#include <X11/keysymdef.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    89
277
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    90
#include <X11/cursorfont.h>
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    91
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    92
#ifdef LINUX
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    93
# include <sys/socket.h>
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    94
#endif
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    95
2422
6bffcb4c8360 changes for egcs (__new in stdio)
Claus Gittinger <cg@exept.de>
parents: 2386
diff changeset
    96
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
    97
/*
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    98
 * this define suppresses XAllocColor/XFreeColor on
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    99
 * 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
   100
 * 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
   101
 */
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   102
#define QUICK_TRUE_COLORS
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   103
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   104
/*
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   105
 * shape support works; enabled by -DSHAPE in makefile
48194c26a46c Initial revision
claus
parents:
diff changeset
   106
 * see RoundClock and RoundGlobe examples
48194c26a46c Initial revision
claus
parents:
diff changeset
   107
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   108
#ifdef SHAPE
48194c26a46c Initial revision
claus
parents:
diff changeset
   109
# include <X11/extensions/shape.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   110
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   111
48194c26a46c Initial revision
claus
parents:
diff changeset
   112
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   113
 * shared memory extension access is currently not supported
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   114
 * (only query is implemented)
48194c26a46c Initial revision
claus
parents:
diff changeset
   115
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   116
#ifdef SHM
48194c26a46c Initial revision
claus
parents:
diff changeset
   117
# include <X11/extensions/XShm.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   118
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   119
48194c26a46c Initial revision
claus
parents:
diff changeset
   120
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   121
 * multiBuffer extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   122
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   123
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   124
#ifdef MBUF
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   125
# include <X11/extensions/multibuf.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   126
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   127
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   128
/*
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   129
 * XVideo extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   130
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   131
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   132
#ifdef XVIDEO
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   133
# include <X11/extensions/Xv.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   134
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   135
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   136
/*
186
claus
parents: 180
diff changeset
   137
 * PEX extension - if available
claus
parents: 180
diff changeset
   138
 */
claus
parents: 180
diff changeset
   139
#ifdef PEX5
claus
parents: 180
diff changeset
   140
# include <PEX5/PEX.h>
claus
parents: 180
diff changeset
   141
#endif
claus
parents: 180
diff changeset
   142
claus
parents: 180
diff changeset
   143
/*
claus
parents: 180
diff changeset
   144
 * XImage extension - if available
claus
parents: 180
diff changeset
   145
 */
claus
parents: 180
diff changeset
   146
#ifdef XIE
claus
parents: 180
diff changeset
   147
# include <X11/extensions/XIE.h>
claus
parents: 180
diff changeset
   148
#endif
claus
parents: 180
diff changeset
   149
claus
parents: 180
diff changeset
   150
/*
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   151
 * when I have more time to check it out, I will support display-PS
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   152
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   153
#ifdef DPS
48194c26a46c Initial revision
claus
parents:
diff changeset
   154
# ifdef sgi
48194c26a46c Initial revision
claus
parents:
diff changeset
   155
#  include <X11/extensions/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   156
#  include <X11/extensions/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   157
#  include <X11/extensions/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   158
# else
48194c26a46c Initial revision
claus
parents:
diff changeset
   159
#  include <DPS/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   160
#  include <DPS/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   161
#  include <DPS/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   162
# endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   163
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   164
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   165
#if defined(someMachine)
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   166
/*
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   167
 * if nformats cannot be found in the Display structure ...
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   168
 */
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   169
# define NO_PRIVATE_DISPLAY_ACCESS
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   170
#endif
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   171
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   172
#if defined(IRIX5) || defined(__VMS) || (XlibSpecificationRelease == 6)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   173
  /*
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   174
   * accessing private data in Display ... sorry
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   175
   */
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   176
# define DISPLAYACCESS(d) ((_XPrivDisplay)d)
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   177
#else
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   178
# define DISPLAYACCESS(d) d
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   179
#endif
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   180
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   181
/*
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   182
 * some defines - tired of typing ...
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   183
 */
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   184
#define __DisplayVal(o)      (Display *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   185
#define __DrawableVal(o)     (Drawable)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   186
#define __WindowVal(o)       (Window)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   187
#define __PixmapVal(o)       (Pixmap)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   188
#define __GCVal(o)           (GC)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   189
#define __CursorVal(o)       (Cursor)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   190
#define __FontVal(o)         (XFontStruct *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   191
#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
   192
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   193
#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
   194
#define __AtomVal(o)         __intVal(o)
211
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   195
#define __isAtomID(o)        __isSmallInteger(o)
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   196
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   197
#define myDpy                __DisplayVal(__INST(displayId))
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
   198
#define ISCONNECTED          ((__INST(displayId) != nil) && (__INST(hasConnectionBroken) != nil))
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   199
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   200
#ifdef __VMS__
1899
de1eb2a3318e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1898
diff changeset
   201
# include "vms_Xnames.h"
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   202
#endif
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   203
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   204
void __XTimeoutErrorHandler();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   205
int __XErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   206
int __XIOErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   207
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   208
/*
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   209
 * these two macros should be placed around X-lib calls,
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   210
 * which may block due to a broken connection.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   211
 * They setup/remove a VM-timeout which raises an exception
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   212
 * after xlibTimeout seconds.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   213
 * This exception will shutDown the connection.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   214
 * Q: is this a good idea for the local display ?
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   215
 */
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   216
#define __ENTER_XLIB(whichTimeout)   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   217
    { \
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
   218
	__blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
   219
	__blockingPrimitiveTimeoutArg__ = self; \
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
   220
	__blockingPrimitiveTimeout__ = __intVal(__INST(whichTimeout)) * 1000; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   221
    } {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   222
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   223
#define LEAVE_XLIB()   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   224
    { \
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
   225
	__blockingPrimitiveTimoutHandler__ = (VOIDFUNC)0; \
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
   226
	__blockingPrimitiveTimeoutArg__ = nil; \
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
   227
	__blockingPrimitiveTimeout__ = 0; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   228
    } }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   229
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   230
#define ENTER_XLIB()   __ENTER_XLIB(xlibTimeout)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   231
#define ENTER_XLIB2()  __ENTER_XLIB(xlibTimeoutForWindowCreation)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   232
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   233
#ifdef SUPPORT_MOTIF_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   234
# ifdef SOME_MACHINE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   235
#  include <anIncludeFileWhichDefinesTheStuffBelow>
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   236
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   237
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   238
# ifndef MWM_HINTS_FUNCTIONS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   239
#  define MWM_HINTS_FUNCTIONS       (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   240
#  define MWM_HINTS_DECORATIONS     (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   241
#  define MWM_HINTS_INPUT_MODE      (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   242
#  define MWM_HINTS_STATUS          (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   243
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   244
#  define MWM_FUNC_ALL              (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   245
#  define MWM_FUNC_RESIZE           (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   246
#  define MWM_FUNC_MOVE             (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   247
#  define MWM_FUNC_MINIMIZE         (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   248
#  define MWM_FUNC_MAXIMIZE         (1L << 4)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   249
#  define MWM_FUNC_CLOSE            (1L << 5)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   250
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   251
#  define MWM_INPUT_MODELESS                      0
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   252
#  define MWM_INPUT_PRIMARY_APPLICATION_MODAL     1
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   253
#  define MWM_INPUT_SYSTEM_MODAL                  2
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   254
#  define MWM_INPUT_FULL_APPLICATION_MODAL        3
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   255
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   256
#  define MWM_DECOR_NONE            0
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   257
#  define MWM_DECOR_ALL             (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   258
#  define MWM_DECOR_BORDER          (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   259
#  define MWM_DECOR_RESIZEH         (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   260
#  define MWM_DECOR_TITLE           (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   261
#  define MWM_DECOR_MENU            (1L << 4)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   262
#  define MWM_DECOR_MINIMIZE        (1L << 5)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   263
#  define MWM_DECOR_MAXIMIZE        (1L << 6)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   264
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   265
#endif /* SUPPORT_MOTIF_WM_HINTS */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   266
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   267
/*
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   268
 * openlook hints are not supported yet
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   269
 * - noone needs them anymore ;-(
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   270
 */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   271
#ifdef SUPPORT_OPENLOOCK_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   272
# ifdef SOME_MACHINE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   273
#  include <anIncludeFileWhichDefinesTheStuffBelow>
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   274
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   275
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   276
# ifndef OL_DECOR_CLOSE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   277
#  define OL_DECOR_CLOSE            (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   278
#  define OL_DECOR_RESIZEH          (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   279
#  define OL_DECOR_HEADER           (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   280
#  define OL_DECOR_ICON_NAME        (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   281
#  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
   282
#  define OL_ANY_HINTS              (1L << 7)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   283
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   284
#endif /* SUPPORT_OPENLOOCK_WM_HINTS */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   285
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
   286
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   287
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   288
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   289
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   290
!XWorkstation primitiveVariables!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   291
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   292
/*
146
claus
parents: 145
diff changeset
   293
 * remembered info from private error handler
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   294
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   295
static char lastErrorMsg[128] = "";
1888
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   296
static unsigned INT lastRequestCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   297
static unsigned INT lastMinorCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   298
static unsigned INT lastResource = 0;
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   299
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   300
static int __debug__ = 0;
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   301
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   302
#define DPRINTF(x)      if (__debug__) { console_printf x; }
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   303
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   304
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   305
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   306
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   307
!XWorkstation primitiveFunctions!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   308
%{
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   309
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   310
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   311
 * 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
   312
 * to include that stuff. Should be #ifdef'd ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   313
 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   314
#ifndef ELF
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   315
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   316
# ifdef __GNUC__
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   317
VOLATILE
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   318
# endif
1081
f7d19178fb2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   319
static
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   320
dummyToForceLoading() {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   321
	XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   322
	XCloseDisplay(0);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   323
	XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   324
	XSetWindowColormap(0, 0, 0);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   325
	XQueryColors(0,0,0,0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   326
# ifdef SHM
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   327
	XShmAttach(0, 0);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   328
	XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   329
	XShmDetach(0, 0);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   330
	XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   331
	shmctl(0,0,0);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   332
	fgetc(0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   333
# endif
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   334
}
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   335
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   336
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   337
#undef __myInstPtr
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   338
#define __myInstPtr(obj) ((struct __XWorkstation_struct *)(obj))
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   339
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   340
/*
144
claus
parents: 143
diff changeset
   341
 * catch X-errors and forward as errorInterrupt:#DisplayError,
claus
parents: 143
diff changeset
   342
 * (which itself invokes my handler and optionally raises an exceptionSignal)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   343
 * the implementation below is somewhat wrong: it will
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   344
 * report all errors for Display, even though there could be
162
claus
parents: 160
diff changeset
   345
 * more than one display connection. (being fixed, new errorInterrupt mechanism
claus
parents: 160
diff changeset
   346
 * allows passing an additional argument, which is the displayID ...)
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   347
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   348
int
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
   349
__XErrorHandler__(dpy, event)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   350
    Display *dpy;
48194c26a46c Initial revision
claus
parents:
diff changeset
   351
    XErrorEvent *event;
48194c26a46c Initial revision
claus
parents:
diff changeset
   352
{
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   353
    XGetErrorText(dpy, event->error_code, lastErrorMsg, 127);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   354
    lastErrorMsg[127] = '\0';
1060
bc581886fe8f dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents: 1056
diff changeset
   355
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   356
    if (lastErrorMsg[0] == '\0') {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   357
	sprintf(lastErrorMsg, "code: %d", event->error_code);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   358
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   359
    lastRequestCode = event->request_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   360
    lastMinorCode = event->minor_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   361
    lastResource = event->resourceid;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   362
    if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   363
	/*
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   364
	 * this is a BadWindow error for X_DestroyWindow.
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   365
	 * ignore it here, since it results from the GC freeing windows
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   366
	 * in non bottom-up window order.
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   367
	 */
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   368
	return 0;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   369
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   370
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   371
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   372
	console_fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%x\n",
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   373
			event->request_code, event->request_code,
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   374
			event->minor_code, event->minor_code, event->resourceid);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   375
	console_fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n",
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   376
			event->error_code, lastErrorMsg);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   377
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   378
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   379
    __errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   380
    return 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
   381
}
48194c26a46c Initial revision
claus
parents:
diff changeset
   382
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   383
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   384
 * much like the above, but for IO Errors;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   385
 * forwarded as errorInterrupt:#DisplayIOError,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   386
 * In single display apps, handling those here does not
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   387
 * really make sense (except, for a controlled cleanup).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   388
 * However, in multiDisplay apps, a single broken
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   389
 * connection should not affect the other users.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   390
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   391
int
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   392
__XIOErrorHandler__(dpy)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   393
    Display *dpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   394
{
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   395
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   396
	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
   397
    }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   398
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError),
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   399
						  __MKEXTERNALADDRESS(dpy));
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   400
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   401
#if 0
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   402
    /*
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   403
     * don't do this.
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   404
     * 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
   405
     */
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   406
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   407
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   408
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   409
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   410
     */
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   411
    __internalError("unhandled display I/O error");
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   412
    __terminateProcess(0);      /* soft terminate */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   413
    __terminateProcess(1);      /* hard terminate */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   414
    /* never reached */
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   415
#endif
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   416
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   417
    return 0;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   418
}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   419
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   420
/*
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   421
 * timeout error in case of Xlib request timeout.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   422
 * forwarded as errorInterrupt:#DisplayIOTimeoutError,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   423
 * This is generated synthetically by the VM if the
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   424
 * timeoutHandler has been set.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   425
 */
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   426
void
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   427
__XTimeoutErrorHandler(displayDeviceInst)
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   428
    OBJ displayDeviceInst;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   429
{
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   430
    if ((displayDeviceInst == @global(MainDisplay))
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   431
	|| (displayDeviceInst == @global(DeviceWorkstation:DefaultScreen))) {
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   432
	console_fprintf(stderr, "XWorkstation [error]: keep display connection for master display after X11 timeout (no shutdown)\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   433
	return;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   434
    }
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   435
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   436
	console_fprintf(stderr, "XWorkstation [error]: X11 request timeout dpy=%x\n", displayDeviceInst);
4636
6c715971d212 Fix display timeout error handling
Stefan Vogel <sv@exept.de>
parents: 4635
diff changeset
   437
    }
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
   438
    __OINST(displayDeviceInst, hasConnectionBroken) = true;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   439
4635
ad449b8058fe Fix for __XTimeoutErrorHandler__: __PROTECT__(displayDeviceInst)
Stefan Vogel <sv@exept.de>
parents: 4631
diff changeset
   440
    __PROTECT__(displayDeviceInst);
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   441
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst);
4635
ad449b8058fe Fix for __XTimeoutErrorHandler__: __PROTECT__(displayDeviceInst)
Stefan Vogel <sv@exept.de>
parents: 4631
diff changeset
   442
    __UNPROTECT__(displayDeviceInst);
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   443
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   444
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   445
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   446
     */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
diff changeset
   447
    if (__OINST(displayDeviceInst, displayId) != nil) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   448
	__internalError("unhandled X11 display timeout error");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   449
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   450
	/*
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   451
	 * the current process failed to do an X11 request.
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   452
	 * Terminate it!
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   453
	 */
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   454
	__terminateProcess(0);      /* soft terminate */
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   455
	__terminateProcess(1);      /* hard terminate */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
diff changeset
   456
    }
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   457
}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   458
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   459
#ifdef VIRTUAL_ROOT
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   460
/*
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   461
 * added since RootWindow-macro is not sufficient
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   462
 * when virtual root-windows are involved (i.e. tvtwm)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   463
 */
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   464
static Window
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   465
getRootWindow(dpy, screen)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   466
    Display *dpy;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   467
{
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   468
    Window root;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   469
    Atom vRootAtom = None;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   470
    int i;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   471
    Window rootReturn, parentReturn;
1050
b2c03e24d56c another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents: 1049
diff changeset
   472
    Window* children = (Window *)0;
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   473
    unsigned int numChildren;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   474
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   475
    root = RootWindow(dpy, screen);
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   476
    /*
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   477
     * on IRIS, this creates a badwindow error - why ?
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   478
     * children contains a funny window (000034)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   479
     */
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   480
# if !defined(IRIS) || defined(IRIX5)
1887
98bb2fb45fda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1883
diff changeset
   481
    if (root) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   482
	vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   483
	if (vRootAtom != None) {
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   484
	    if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) {
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   485
		for (i=0; i < numChildren; i++) {
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   486
		    Atom actual_type;
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   487
		    int actual_format;
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   488
		    unsigned long nitems, bytesafter;
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   489
		    Window* newRoot = (Window*) 0;
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   490
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   491
		    if (children[i]) {
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   492
			if (XGetWindowProperty(dpy, children[i], vRootAtom,
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   493
					       0L, 1L, False, XA_WINDOW,
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   494
					       &actual_type, &actual_format, &nitems, &bytesafter,
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   495
					       (unsigned char**) &newRoot) == Success && newRoot) {
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   496
			    root = *newRoot;
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   497
			    XFree(newRoot); /* XXX */
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   498
			    break;
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   499
			}
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   500
		    }
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   501
		}
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   502
	    }
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   503
	    if (children) XFree( children );
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   504
	}
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   505
    }
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   506
# endif
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   507
    return root;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   508
}
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   509
#endif
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   510
%}
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   511
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   512
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   513
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   514
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   515
copyright
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   516
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   517
COPYRIGHT (c) 1989 by Claus Gittinger
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   518
	      All Rights Reserved
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   519
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   520
 This software is furnished under a license and may be used
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   521
 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
   522
 inclusion of the above copyright notice.   This software may not
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   523
 be provided or otherwise made available to, or used by, any
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   524
 other person.  No title to or ownership of the software is
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   525
 hereby transferred.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   526
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   527
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   528
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   529
documentation
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   530
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   531
    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
   532
    from DeviceWorkstation.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   533
    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
   534
    in theory (and in our practice), you can create Views on many displays
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   535
    simultanously. However, the default setup is for one display only.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   536
    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
   537
    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
   538
    different protocol (ApplicationModel openOnDevice:) or by temporarily answering
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   539
    the other device to the currentScreen query.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   540
    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
   541
    query is answered by the launcher when opening its applications.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   542
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   543
    Timeouts:
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   544
	sometimes, X-connections are lost and, as the Xlib is blocking and synchronous by
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   545
	default, this would lead to a locked ST/X system.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   546
	Therefore, this class defines a timeOut, whenever doing an Xlib call.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   547
	The default for this timeout is 30seconds.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   548
	This may be a problem with windowmanagers which show a rubber-band rectangle
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   549
	when creating windows.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   550
	If the user does not specify the rectangle within 30 seconds, the device assumes
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   551
	a timeout and closes the connection.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   552
	As a (kludgy) workaround, a second timeout value is used for window-creation.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   553
	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
   554
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   555
    See more documentation in my superclass, DeviceWorkstation.
613
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   556
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   557
    [author:]
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   558
	Claus Gittinger
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   559
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   560
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   561
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   562
!XWorkstation class methodsFor:'initialization'!
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   563
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   564
initialize
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   565
    ConservativeSync := OperatingSystem platformName == #win32.
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   566
3267
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   567
    "/ some XServers crash, when given too long strings in XDrawString/XDrawInageString.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   568
    "/ the following is an adjustable soft-limit.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   569
    MaxStringLength := 4096.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   570
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   571
    "/ 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
   572
    DefaultXLibTimeout := 30.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   573
    DefaultXLibTimeoutForWindowCreation := 5*60.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   574
3321
3d0e6754dcd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   575
    RawKeySymTranslation isNil ifTrue:[
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   576
        "/ the following table maps X-keyevents to ST/X
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   577
        "/ device independend events.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   578
        "/ It is NOT meant as a keyboardMap replacement.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   579
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   580
        RawKeySymTranslation := Dictionary new:6.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   581
        RawKeySymTranslation
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   582
            at:#'Delete_line' put:#DeleteLine;
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   583
            at:#'Delete_word' put:#DeleteWord;
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   584
            at:#Down put:#CursorDown;
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   585
            at:#Up put:#CursorUp;
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   586
            at:#Left put:#CursorLeft;
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
   587
            at:#Right put:#CursorRight.
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   588
    ]
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   589
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   590
    "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
   591
! !
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   592
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   593
!XWorkstation class methodsFor:'error handling'!
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   594
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   595
debug:aBoolean
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   596
%{  /* NOCONTEXT */
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   597
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   598
    __debug__ = (aBoolean == true) ? 1 : 0;
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   599
%}
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   600
!
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   601
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   602
debugResources
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   603
%{
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   604
#ifdef COUNT_RESOURCES
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   605
    console_fprintf(stderr, "colors:%d bitmaps:%d views:%d gc:%d cursors:%d fonts:%d\n",
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   606
	    __cnt_color, __cnt_bitmap,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   607
	    __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
   608
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   609
%}
1404
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   610
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   611
    "
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   612
     XWorkstation debugResources
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   613
    "
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   614
!
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   615
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   616
errorStringOfLastError
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   617
%{
1065
fdc5b9059d82 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1062
diff changeset
   618
    RETURN ( __MKSTRING(lastErrorMsg) );
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   619
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   620
!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   621
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   622
getConnectionTimeOut
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   623
    "returns the default connectionTimeOut (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   624
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   625
    ^ DefaultXLibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   626
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   627
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   628
getConnectionTimeOutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   629
    "returns the default connectionTimeOut (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   630
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   631
    ^ DefaultXLibTimeoutForWindowCreation
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   632
!
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   633
135
claus
parents: 133
diff changeset
   634
lastErrorString
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   635
    "return the last X-error string -
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   636
     when buffering is on, this may be
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   637
     an error for a long-ago operation"
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   638
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   639
    |string s match line|
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   640
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   641
    string := self errorStringOfLastError.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   642
    "
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   643
     X specific: search the requestCode in '/usr/lib/X11/XErrorDB',
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   644
     and append the name of the corresponding X-request
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   645
    "
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   646
    match := 'XRequest.' , self requestCodeOfLastError printString.
3814
0d856538e64f Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 3806
diff changeset
   647
    s := '/usr/lib/X11/XErrorDB' asFilename readStreamOrNil.
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   648
    s notNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
   649
	line := s peekForLineStartingWith:match.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
   650
	s close.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   651
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   652
    line isNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
   653
	string := string, ' in ', match
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   654
    ] ifFalse:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
   655
	string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1)
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   656
    ].
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   657
    ^ string
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   658
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   659
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   660
minorCodeOfLastError
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   661
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   662
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   663
    RETURN ( __MKSMALLINT(lastMinorCode) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   664
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   665
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   666
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   667
requestCodeOfLastError
152
claus
parents: 150
diff changeset
   668
%{  /* NOCONTEXT */
claus
parents: 150
diff changeset
   669
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   670
    RETURN ( __MKSMALLINT(lastRequestCode) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   671
%}
135
claus
parents: 133
diff changeset
   672
!
claus
parents: 133
diff changeset
   673
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   674
resourceIdOfLastError
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   675
%{  /* NOCONTEXT */
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   676
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   677
      if (lastResource != 0) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
   678
	 RETURN ( __MKEXTERNALADDRESS(lastResource) );
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   679
      }
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   680
%}.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   681
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   682
     ^ nil
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   683
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   684
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   685
     "
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
   686
	 Screen resourceIdOfLastError
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   687
     "
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   688
!
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   689
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   690
setConnectionTimeOut:seconds
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   691
    "set the default connection timeout (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   692
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   693
    DefaultXLibTimeout := seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   694
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   695
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   696
setConnectionTimeOutForWindowCreation:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   697
    "set the default connection timeout (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   698
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   699
    DefaultXLibTimeoutForWindowCreation := seconds
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   700
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   701
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   702
!XWorkstation class methodsFor:'queries'!
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   703
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   704
platformName
133
claus
parents: 132
diff changeset
   705
    "ST-80 compatibility.
2777
60ba83db1fab comment
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   706
     Return a string describing the display systems platform.
60ba83db1fab comment
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   707
     WinWorkstation always returns 'X11'."
133
claus
parents: 132
diff changeset
   708
715
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   709
    ^ 'X11'  "I don't know what ST-80 returns for X ..."
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   710
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   711
    "Modified: 26.5.1996 / 15:32:46 / cg"
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   712
! !
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   713
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   714
!XWorkstation methodsFor:'Signal constants'!
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   715
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   716
deviceIOTimeoutErrorSignal
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   717
    "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
   718
     IO error (i.e. broken connection) occurs."
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   719
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   720
    ^ deviceIOTimeoutErrorSignal
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   721
! !
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   722
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   723
!XWorkstation methodsFor:'accessing & queries'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   724
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   725
activateOnClick:aBoolean
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   726
    "set/clear the activateOnClick behavior.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   727
     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
   728
     the (top) window.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   729
     Windows users typically enable this;
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   730
     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
   731
     it disabled.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   732
     Returns the previous setting."
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   733
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   734
    |prev|
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   735
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   736
    prev := activateOnClick ? false.
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   737
    aBoolean notNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   738
	activateOnClick := aBoolean.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   739
    ].
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   740
    ^ prev
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   741
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   742
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   743
     Display class activateOnClick:true
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   744
     Display class activateOnClick:false
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   745
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   746
!
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   747
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   748
anyButtonMotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   749
    "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
   750
     This is the devices mask."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   751
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   752
%{  /* NOCONTEXT */
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   753
    RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask));
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   754
%}.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   755
    ^ nil
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   756
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   757
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   758
blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   759
    "return the colornumber of black"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   760
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   761
    ^ blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   762
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   763
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   764
button1MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   765
    "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
   766
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   767
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   768
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   769
    RETURN (__MKSMALLINT(Button1MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   770
%}
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   771
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   772
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   773
     Display button1MotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   774
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   775
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   776
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   777
button2MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   778
    "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
   779
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   780
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   781
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   782
    RETURN (__MKSMALLINT(Button2MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   783
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   784
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   785
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   786
button3MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   787
    "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
   788
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   789
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   790
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   791
    RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   792
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   793
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   794
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   795
buttonMotionMask:aButton
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   796
    "return the state-mask for button1 in motion events state-field.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   797
     This is the devices mask."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   798
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   799
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   800
    if (aButton == __MKSMALLINT(1)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   801
	RETURN (__MKSMALLINT(Button1MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   802
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   803
    if (aButton == __MKSMALLINT(2)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   804
	RETURN (__MKSMALLINT(Button2MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   805
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   806
    if (aButton == __MKSMALLINT(3)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   807
	RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   808
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   809
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   810
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   811
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   812
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   813
controlMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   814
    "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
   815
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   816
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   817
    ^ self ctrlModifierMask
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   818
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   819
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   820
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   821
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   822
displayFileDescriptor
48194c26a46c Initial revision
claus
parents:
diff changeset
   823
    "return the displays fileNumber - for select"
48194c26a46c Initial revision
claus
parents:
diff changeset
   824
48194c26a46c Initial revision
claus
parents:
diff changeset
   825
%{  /* NOCONTEXT */
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   826
#ifndef WIN32
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   827
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   828
	RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) );
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   829
    }
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   830
#endif
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   831
    RETURN (nil);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   832
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
   833
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   834
133
claus
parents: 132
diff changeset
   835
displayName
claus
parents: 132
diff changeset
   836
    "return the X-connections display name.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   837
     This is (currently) nil for the default display,
133
claus
parents: 132
diff changeset
   838
     something like foo:0 for any other remote display.
claus
parents: 132
diff changeset
   839
     Future versions may return non-nil strings for the default display as well."
claus
parents: 132
diff changeset
   840
claus
parents: 132
diff changeset
   841
    ^ displayName
claus
parents: 132
diff changeset
   842
!
claus
parents: 132
diff changeset
   843
4153
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
   844
displayName: something
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
   845
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
   846
    displayName := something
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
   847
!
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
   848
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   849
protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   850
    "return the X-servers protocol version - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   851
     any interest"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   852
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   853
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   854
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   855
	RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   856
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   857
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   858
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   859
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   860
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   861
     Display protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   862
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   863
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   864
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   865
serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   866
    "return the X-server vendor string - this should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   867
     any interest, but can be for special cases
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   868
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   869
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   870
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   871
	RETURN ( __MKSTRING(XServerVendor(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   872
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   873
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   874
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   875
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   876
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   877
     Display serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   878
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   879
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   880
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   881
shiftMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   882
    "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
   883
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   884
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   885
    ^ self shiftModifierMask
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   886
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   887
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   888
translatePoint:aPoint from:windowId1 to:windowId2
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   889
    "given a point in window1, return the coordinate in window2.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   890
     This expects a device coordinate (relative to the first views origin)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   891
     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
   892
     - use to xlate points from a window to rootwindow"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   893
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   894
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   895
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   896
    |x1 y1 x2 y2|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   897
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   898
    x1 := x2 := aPoint x truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   899
    y1 := y2 := aPoint y truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   900
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   901
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   902
    Window w1, w2, child_ret;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   903
    int screen = __intVal(__INST(screen));
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   904
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   905
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   906
     && __isExternalAddress(windowId1)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   907
     && __isExternalAddress(windowId2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   908
     && __bothSmallInteger(x1, y1)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   909
	Display *dpy = myDpy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   910
	Window rootWin;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   911
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   912
	w1 = __WindowVal(windowId1);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   913
	w2 = __WindowVal(windowId2);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   914
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   915
#ifdef VIRTUAL_ROOT
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   916
	rootWin = RootWindow(dpy, screen);
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   917
	if (w1 == rootWin) {
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   918
	    ENTER_XLIB();
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   919
	    w1 = getRootWindow(dpy, screen);
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   920
	    LEAVE_XLIB();
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   921
	}
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   922
	if (w2 == rootWin) {
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   923
	    ENTER_XLIB();
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   924
	    w2 = getRootWindow(dpy, screen);
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   925
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   926
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   927
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   928
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   929
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   930
	XTranslateCoordinates(dpy, w1, w2,
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   931
			      __intVal(x1), __intVal(y1),
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   932
			      &xpos, &ypos, &child_ret);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   933
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   934
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   935
	x2 = __MKSMALLINT(xpos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   936
	y2 = __MKSMALLINT(ypos);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   937
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   938
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   939
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   940
    ^ (x2 @ y2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   941
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   942
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   943
vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   944
    "return the X-servers vendor release - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   945
     any interest, but can be for special cases.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   946
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   947
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   948
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   949
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   950
	RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   951
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   952
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   953
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   954
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   955
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   956
     Display vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   957
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   958
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   959
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   960
viewIdFromPoint:aPoint in:windowId
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   961
    "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
   962
     hit by this coordinate. Return nil if no view was hit.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   963
     The returned id may be the id of a non ST view.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   964
     - 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
   965
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   966
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   967
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   968
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   969
    int screen = __intVal(__INST(screen));
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   970
    OBJ xp, yp;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   971
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   972
    Window child_ret;
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   973
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   974
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   975
     && __isExternalAddress(windowId)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   976
     && __isPoint(aPoint)) {
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   977
	Display *dpy = myDpy;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   978
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   979
	xp = _point_X(aPoint);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   980
	yp = _point_Y(aPoint);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   981
	if (__bothSmallInteger(xp, yp)) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   982
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   983
	    ENTER_XLIB();
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   984
	    XTranslateCoordinates(dpy,
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   985
				  RootWindow(dpy, screen),
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   986
				  __WindowVal(windowId),
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   987
				  __intVal(xp), __intVal(yp),
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   988
				  &xpos, &ypos, &child_ret);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   989
	    LEAVE_XLIB();
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   990
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   991
	    if (child_ret) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   992
		RETURN ( __MKEXTERNALADDRESS(child_ret) );
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   993
	    }
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   994
	    RETURN ( nil );
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   995
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   996
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   997
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   998
    windowId notNil ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   999
	aPoint isPoint ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  1000
	    ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  1001
	]
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1002
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1003
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1004
    ^ nil
3412
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1005
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1006
    "
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1007
      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
  1008
    "
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1009
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1010
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1011
virtualExtent
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1012
    "return the virtual extent of the display (in pixels).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1013
     On most systems, this is the same as the physical width;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1014
     except, if a window manager with a virtual desktop like olvwm
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1015
     (simulating a bigger screen) is running."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1016
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1017
%{
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1018
    if (ISCONNECTED
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1019
     && (__INST(rootId) != __INST(virtualRootId))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1020
     && __isExternalAddress(__INST(virtualRootId))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1021
	Window vRootWin;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1022
	Window root;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1023
	int x, y;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1024
	unsigned int width, height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1025
	unsigned int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1026
	int ret;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1027
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1028
	vRootWin = __WindowVal(__INST(virtualRootId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1029
	ENTER_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1030
	ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1031
					  &dummy, &dummy);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1032
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1033
	if (ret) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1034
	    RETURN ( __MKPOINT_INT(width, height) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1035
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1036
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1037
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1038
    ^ width @ height
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1039
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1040
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1041
whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1042
    "return the colornumber of white"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1043
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1044
    ^ whitepixel
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1045
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1046
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1047
xlibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1048
    ^ xlibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1049
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1050
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1051
xlibTimeout:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1052
    xlibTimeout := seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1053
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1054
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1055
xlibTimeoutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1056
    ^ xlibTimeoutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1057
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1058
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1059
xlibTimeoutForWindowCreation:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1060
    xlibTimeoutForWindowCreation := seconds
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1061
! !
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1062
3263
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 3250
diff changeset
  1063
!XWorkstation methodsFor:'accessing-display capabilities'!
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1064
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1065
hasDPS
186
claus
parents: 180
diff changeset
  1066
    "return true, if this workstation supports display postscript.
claus
parents: 180
diff changeset
  1067
     Both the server must support it, and the feature must have been
claus
parents: 180
diff changeset
  1068
     enabled in the smalltalk system, for true to be returned."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1069
48194c26a46c Initial revision
claus
parents:
diff changeset
  1070
    ^ hasDPSExtension
186
claus
parents: 180
diff changeset
  1071
claus
parents: 180
diff changeset
  1072
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1073
     Display hasDPS
186
claus
parents: 180
diff changeset
  1074
    "
claus
parents: 180
diff changeset
  1075
!
claus
parents: 180
diff changeset
  1076
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1077
hasExtension:extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1078
    "query for an X extension. The argument, extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1079
     should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc).
186
claus
parents: 180
diff changeset
  1080
     Return true, if that extension is available in the server.
claus
parents: 180
diff changeset
  1081
     (which does not imply, that there is support in smalltalk for it."
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1082
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1083
    <context: #return>
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1084
%{
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1085
    int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1086
    OBJ rslt = false;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1087
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1088
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1089
     && __isNonNilObject(extensionString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1090
     && (__qIsString(extensionString) || __qIsSymbol(extensionString))) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1091
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1092
	if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1093
	    rslt = true;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1094
	}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1095
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1096
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1097
    RETURN (rslt);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1098
%}
186
claus
parents: 180
diff changeset
  1099
claus
parents: 180
diff changeset
  1100
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1101
     Display hasExtension:'XVideo'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1102
     Display hasExtension:'Input'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1103
     Display hasExtension:'GLX'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1104
     Display hasExtension:'X3D-PEX'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1105
     Display hasExtension:'XInputExtension'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1106
     Display hasExtension:'SHAPE'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1107
     Display hasExtension:'MIT-SHM'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1108
     Display hasExtension:'SGIFullScreenStereo'
186
claus
parents: 180
diff changeset
  1109
    "
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1110
!
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1111
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1112
hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1113
    "return true, if this workstation supports the X image extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1114
     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
  1115
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1116
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1117
    ^ hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1118
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1119
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1120
     Display hasImageExtension
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1121
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1122
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1123
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1124
hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1125
    "return true, if this workstation supports the X input extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1126
     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
  1127
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1128
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1129
    ^ hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1130
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1131
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1132
     Display hasInputExtension
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1133
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1134
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1135
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1136
hasMultibuffer
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1137
    "return true, if this workstation supports the multibuffer extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1138
     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
  1139
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1140
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1141
    ^ hasMbufExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1142
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1143
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1144
     Display hasMultibuffer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1145
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1146
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1147
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1148
hasPEX
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1149
    "return true, if this workstation supports PEX 3D graphics.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1150
     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
  1151
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1152
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1153
    ^ hasPEXExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1154
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1155
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1156
     Display hasPEX
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1157
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1158
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1159
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1160
hasShm
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1161
    "return true, if this workstation supports the shared pixmap extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1162
     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
  1163
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1164
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1165
    ^ hasShmExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1166
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1167
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1168
     Display hasShm
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1169
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1170
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1171
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1172
hasXVideo
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1173
    "return true, if this workstation supports the XVideo extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1174
     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
  1175
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1176
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1177
    ^ hasXVideoExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1178
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1179
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1180
     Display hasXVideo
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1181
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1182
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1183
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1184
iconSizes
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1185
    "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
  1186
     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
  1187
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1188
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1189
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1190
    |xIconSizes count ret|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1191
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1192
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1193
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1194
    XIconSize *sizeList;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1195
    int cnt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1196
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1197
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1198
	Display *dpy = myDpy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1199
	int status;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1200
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1201
	ENTER_XLIB();
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  1202
	status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1203
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1204
	if (status > 0) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1205
	   xIconSizes = __MKEXTERNALBYTES(sizeList);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1206
	   count = __MKSMALLINT(cnt);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1207
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1208
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1209
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1210
    xIconSizes isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1211
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1212
    ret := OrderedCollection new:count.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1213
    1 to:count do:[ :i |
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1214
	|minWidth minHeight maxWidth maxHeight widthStep heightStep d|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1215
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1216
%{
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1217
	XIconSize *slp;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1218
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1219
	slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1];
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1220
	minWidth = __MKSMALLINT(slp->min_width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1221
	minHeight = __MKSMALLINT(slp->min_height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1222
	maxWidth = __MKSMALLINT(slp->max_width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1223
	maxHeight = __MKSMALLINT(slp->max_height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1224
	widthStep = __MKSMALLINT(slp->width_inc);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1225
	heightStep = __MKSMALLINT(slp->height_inc);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1226
%}.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1227
	d := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1228
	d at:#minWidth put:minWidth.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1229
	d at:#maxWidth put:maxWidth.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1230
	d at:#widthStep put:widthStep.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1231
	d at:#minHeight put:minHeight.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1232
	d at:#maxHeight put:maxHeight.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1233
	d at:#heightStep put:heightStep.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1234
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1235
	ret add:d
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1236
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1237
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1238
    xIconSizes free.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1239
    ^ ret
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1240
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1241
    "
819
88aaa6ff1ca3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 818
diff changeset
  1242
     Display iconSizes
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1243
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1244
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1245
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1246
ignoreBackingStore:aBoolean
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1247
    "if the argument is true, the views backingStore setting will be ignored, and
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1248
     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
  1249
     very slow or is broken (can be put into display-rc-file)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1250
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1251
    ignoreBackingStore := aBoolean
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1252
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1253
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1254
preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1255
    "return the displays preferred size for icons.
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1256
     Redefined to return a special value on SGI servers."
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1257
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1258
    self serverVendor = 'Silicon Graphics' ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1259
	^ 86@68
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1260
    ].
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1261
    ^ super preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1262
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1263
    "Created: 10.6.1996 / 21:06:48 / cg"
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1264
!
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1265
1025
40dde7d8f538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  1266
scrollsAsynchronous
1008
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1267
    "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
  1268
     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
  1269
     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
  1270
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1271
    ^ true
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1272
!
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1273
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1274
supportedImageFormats
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1275
    "return an array with supported image formats;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1276
     each array entry is an attribute dictionary, consisting of
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1277
     depth, bitsPerPixel and padding values."
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1278
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1279
    |nFormats "{ Class: SmallInteger }"
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1280
     formatArray|
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1281
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1282
    Display *dpy;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1283
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1284
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1285
	RETURN (nil);
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1286
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1287
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1288
    dpy = myDpy;
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1289
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1290
    nFormats = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1291
#else
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1292
    nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1293
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1294
%}.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1295
    formatArray := Array new:nFormats.
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1296
    1 to:nFormats do:[:index |
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1297
	|info bitsPerPixelInfo depthInfo paddingInfo i|
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1298
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1299
	i := index.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1300
%{
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1301
	ScreenFormat *format;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1302
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1303
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1304
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1305
	depthInfo = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1306
	bitsPerPixelInfo = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1307
	paddingInfo = __MKSMALLINT(8);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1308
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1309
	format = DISPLAYACCESS(dpy)->pixmap_format;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1310
	format += (__intVal(i)-1);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1311
	bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1312
	depthInfo = __MKSMALLINT(format->depth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1313
	paddingInfo = __MKSMALLINT(format->scanline_pad);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1314
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1315
%}.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1316
	info := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1317
	info at:#depth put:depthInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1318
	info at:#bitsPerPixel put:bitsPerPixelInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1319
	info at:#padding put:paddingInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1320
	formatArray at:index put:info.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1321
    ].
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1322
    ^ formatArray
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1323
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1324
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1325
     Display supportedImageFormats
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1326
    "
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1327
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1328
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1329
supportsAnyViewBackgroundPixmaps
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1330
    "return true, if the device allows pixmaps as
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1331
     viewBackground."
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1332
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1333
    ^ true
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1334
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1335
    "Created: / 4.5.1999 / 18:41:07 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1336
!
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1337
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1338
supportsArbitraryShapedViews
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1339
    "return true, if this workstation supports arbitrary shaped windows.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1340
     Both the server must support it (the shape-extension),
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1341
     and the feature must have been enabled in the smalltalk system,
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1342
     for true to be returned."
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1343
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1344
    ^ hasShapeExtension
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1345
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1346
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1347
     Display supportsArbitraryShapedViews
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1348
    "
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1349
!
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1350
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1351
supportsIconViews
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1352
    "return true, if this device supports views as icons.
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1353
     Only Xservers (currently) support this."
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1354
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1355
    ^ true
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1356
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1357
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1358
     Display supportsIconViews
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1359
    "
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1360
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1361
    "Modified: 10.6.1996 / 20:11:48 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1362
    "Created: 10.6.1996 / 21:08:18 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1363
!
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1364
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1365
supportsMaskedDrawingWith:aForm
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1366
    "return true, if the device allows the given form pixmap
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1367
     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
  1368
     True returned here - X has no trouble with any mask."
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1369
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1370
    ^ true
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1371
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1372
    "Created: / 4.5.1999 / 12:16:43 / cg"
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1373
!
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1374
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1375
supportsViewBackgroundPixmap:aForm
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1376
    "return true, if the device allows the given pixmap as
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1377
     viewBackground.
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1378
     True returned here - X support any size."
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1379
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1380
    ^ true
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1381
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1382
    "Created: / 4.5.1999 / 18:40:42 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1383
    "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
  1384
!
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1385
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1386
supportsViewGravity
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1387
    "return true, if this device supports gravity attributes.
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
  1388
     We do not depend on it being implemented, but some resizing operations
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1389
     are faster, it is is."
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1390
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1391
    ^ true
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1392
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1393
48194c26a46c Initial revision
claus
parents:
diff changeset
  1394
!XWorkstation methodsFor:'bitmap/window creation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1395
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1396
createBitmapFromArray:anArray width:w height:h
2896
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1397
    "create a monochrome, depth1 bitmap from a given (byte-)array.
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1398
     The rows are aligned to a multiple of 8"
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1399
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1400
    |bitmapId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1401
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1402
    bitmapId := self primCreateBitmapFromArray:anArray width:w height:h.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1403
    bitmapId isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1404
	self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1405
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1406
    ^ bitmapId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1407
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1408
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1409
createBitmapFromFile:aString for:aForm
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1410
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1411
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1412
    |id w h|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1413
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1414
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1415
    int screen = __intVal(__INST(screen));
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1416
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1417
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1418
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1419
     && (__qIsString(aString) || __qIsSymbol(aString))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1420
	Display *dpy = myDpy;
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1421
	char *filename;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1422
	int status;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1423
	Pixmap newBitmap;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1424
	unsigned b_width, b_height;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1425
	int b_x_hot, b_y_hot;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1426
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1427
	filename = (char *) __stringVal(aString);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1428
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1429
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1430
	ENTER_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1431
	status = XReadBitmapFile(dpy, RootWindow(dpy, screen),
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1432
				 filename, &b_width, &b_height, &newBitmap,
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1433
				 &b_x_hot, &b_y_hot);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1434
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1435
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1436
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1437
	if ((status == BitmapSuccess)  && newBitmap) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1438
#ifdef COUNT_RESOURCES
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1439
	    __cnt_bitmap++;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1440
#endif
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1441
	    w = __MKSMALLINT(b_width);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1442
	    h = __MKSMALLINT(b_height);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1443
	    id = __MKEXTERNALADDRESS(newBitmap);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1444
	}
295
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
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1447
    id notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1448
	aForm setWidth:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1449
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1450
    ^ id
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
createBitmapWidth:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1454
    "allocate a bitmap on the Xserver, the contents is undefined
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1455
     (i.e. random). Return a bitmap id or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1456
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1457
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1458
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1459
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1460
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1461
    Pixmap newBitmap;
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
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1464
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1465
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1466
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1467
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1468
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1469
				       __intVal(w), __intVal(h), 1);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1470
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1471
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1472
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1473
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1474
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1475
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1476
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1477
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1478
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1479
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1480
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1481
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1482
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1483
createPixmapWidth:w height:h depth:d
48194c26a46c Initial revision
claus
parents:
diff changeset
  1484
    "allocate a pixmap on the Xserver, the contents is undefined
48194c26a46c Initial revision
claus
parents:
diff changeset
  1485
     (i.e. random). Return a bitmap id or nil"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1486
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1487
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1488
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1489
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1490
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1491
    Pixmap newBitmap;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1492
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1493
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1494
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1495
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1496
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1497
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1498
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1499
				       __intVal(w), __intVal(h), __intVal(d));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1500
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1501
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1502
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1503
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1504
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1505
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1506
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1507
    }
1424
29fb970f157f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
  1508
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1509
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1510
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1511
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1512
1468
9832c4017a70 added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1513
createWindowFor:aView type:typeSymbol
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1514
		 origin:origin
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1515
		 extent:extent
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1516
		 minExtent:minExt
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1517
		 maxExtent:maxExt
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1518
		 borderWidth:bWidth
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1519
		 subViewOf:wsuperView
1695
46d9101e4bee replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
  1520
		 style:wStyle
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1521
		 inputOnly:winputOnly
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1522
		 label:wlabel
1960
aa9ef6e21f15 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1916
diff changeset
  1523
		 owner:wowner
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1524
		 icon:wicon iconMask:wiconMask
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1525
		 iconView:wiconView
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1526
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1527
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1528
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1529
    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight
1960
aa9ef6e21f15 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1916
diff changeset
  1530
     bColorId wsuperViewId wiconId wiconMaskId windowId
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1531
     weventMask wiconViewId bitGravity viewGravity vBgColor
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1532
     vBgForm deepForm preferredVisual preferredDepth|
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1533
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1534
    displayId isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1535
	self primitiveFailedOrClosedConnection.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1536
	^ nil
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1537
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1538
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1539
    origin notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1540
	xpos := origin x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1541
	ypos := origin y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1542
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1543
	xpos := ypos := 0.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1544
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1545
    extent notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1546
	wwidth := extent x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1547
	wheight := extent y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1548
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1549
	wwidth := wheight := 100.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1550
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1551
    minExt notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1552
	minWidth := minExt x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1553
	minHeight := minExt y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1554
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1555
    maxExt notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1556
	maxWidth := maxExt x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1557
	maxHeight := maxExt y
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1558
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1559
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1560
    wsuperView notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1561
	wsuperViewId := wsuperView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1562
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1563
48194c26a46c Initial revision
claus
parents:
diff changeset
  1564
    wicon notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1565
	wiconId := wicon id.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1566
	wiconMask notNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1567
	    wiconMaskId := wiconMask id
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1568
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1569
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1570
    wiconView notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1571
	wiconViewId := wiconView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1572
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1573
    weventMask := aView eventMask.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1574
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1575
    preferredVisual := aView preferredVisual.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1576
    preferredDepth := aView preferredDepth.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1577
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1578
%{  /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1579
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1580
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1581
    Visual visual;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1582
    XGCValues xgcv;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1583
    XSetWindowAttributes xswa;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1584
    XSizeHints sizehints;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1585
    XWMHints wmhints;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1586
    int bw, bd, bg;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1587
    Window newWindow, parentWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1588
    char *windowName;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1589
    XFontStruct *f;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1590
    Pixmap backPixmap = (Pixmap)0,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1591
	   iconBitmap = (Pixmap)0,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1592
	   iconMask = (Pixmap)0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1593
    int flags = 0, depth, ioClass;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1594
    Window iconWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1595
    Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom;
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1596
    Atom WmQuitAppAtom, MotifWMHintsAtom;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1597
    Atom STXDeviceAtom, UUIDAtom;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1598
    Atom atoms[3];
48194c26a46c Initial revision
claus
parents:
diff changeset
  1599
    int atomCount = 0, isTopWindow = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1600
48194c26a46c Initial revision
claus
parents:
diff changeset
  1601
    sizehints.flags = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1602
    sizehints.width = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1603
    sizehints.height = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1604
    sizehints.x = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1605
    sizehints.y = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1606
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1607
    if (__bothSmallInteger(wwidth, wheight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1608
	sizehints.flags |= PSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1609
	sizehints.width = __intVal(wwidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1610
	sizehints.height = __intVal(wheight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1611
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1612
    if (__bothSmallInteger(xpos, ypos)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1613
	sizehints.flags |= PPosition;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1614
	sizehints.x = __intVal(xpos);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1615
	sizehints.y = __intVal(ypos);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1616
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1617
    if (__bothSmallInteger(minWidth, minHeight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1618
	sizehints.flags |= PMinSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1619
	sizehints.min_width = __intVal(minWidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1620
	sizehints.min_height = __intVal(minHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1621
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1622
    if (__bothSmallInteger(maxWidth, maxHeight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1623
	sizehints.flags |= PMaxSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1624
	sizehints.max_width = __intVal(maxWidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1625
	sizehints.max_height = __intVal(maxHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1626
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1627
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
  1628
    bg = WhitePixel(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1629
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1630
    if (__isSmallInteger(bWidth)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1631
	bw = __intVal(bWidth);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1632
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1633
	bw = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1634
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1635
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  1636
    bd = BlackPixel(dpy, screen);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1637
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1638
    if (__isExternalAddress(wsuperViewId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1639
	parentWindow = __WindowVal(wsuperViewId);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1640
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1641
	parentWindow = RootWindow(dpy, screen);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1642
	isTopWindow = 1;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1643
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1644
1695
46d9101e4bee replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
  1645
    if (wStyle == @symbol(popUp))
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1646
	xswa.override_redirect = 1;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1647
    else
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1648
	xswa.override_redirect = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1649
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1650
    if (winputOnly == true)
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1651
	ioClass = InputOnly;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1652
    else
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1653
	ioClass = InputOutput;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1654
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1655
    if (__isSmallInteger(weventMask)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1656
	xswa.event_mask = __intVal(weventMask);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1657
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1658
	xswa.event_mask = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1659
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1660
48194c26a46c Initial revision
claus
parents:
diff changeset
  1661
    if (ioClass == InputOnly) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1662
	bw = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1663
	depth = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1664
	flags |= CWEventMask;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1665
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1666
	depth = DefaultDepth(dpy,screen);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1667
	flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1668
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1669
	if (backPixmap != (Pixmap)0) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1670
	    xswa.background_pixmap = backPixmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1671
	    flags |= CWBackPixmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1672
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1673
	    xswa.background_pixel = bg;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1674
	    flags |= CWBackPixel;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1675
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1676
	xswa.border_pixel = bd;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1677
    }
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1678
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1679
    visual.visualid = CopyFromParent;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1680
    if (__isSmallInteger(preferredDepth)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1681
	depth = __intVal(preferredDepth);
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1682
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1683
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1684
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1685
    if (preferredVisual != nil) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1686
	XVisualInfo vi;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1687
	int cls;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1688
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1689
	if (preferredVisual == @symbol(StaticGray))
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1690
	    cls = StaticGray;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1691
	else if (preferredVisual == @symbol(GrayScale))
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1692
	    cls = GrayScale;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1693
	else if (preferredVisual == @symbol(StaticColor))
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1694
	    cls = StaticColor;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1695
	else if (preferredVisual == @symbol(PseudoColor))
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1696
	    cls = PseudoColor;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1697
	else if (preferredVisual == @symbol(TrueColor))
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1698
	    cls = TrueColor;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1699
	else if (preferredVisual == @symbol(DirectColor))
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1700
	    cls = DirectColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1701
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1702
	    cls = PseudoColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1703
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1704
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1705
	if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1706
	    visual.visualid = vi.visualid;
163
claus
parents: 162
diff changeset
  1707
/*
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  1708
	    console_fprintf(stderr, "visualId=%x\n", vi.visualid);
163
claus
parents: 162
diff changeset
  1709
*/
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1710
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1711
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1712
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1713
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1714
    ENTER_XLIB2();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1715
    newWindow = XCreateWindow(dpy, parentWindow,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1716
			   sizehints.x, sizehints.y,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1717
			   sizehints.width, sizehints.height,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1718
			   bw, depth, ioClass, &visual,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1719
			   flags, &xswa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1720
    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1721
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1722
48194c26a46c Initial revision
claus
parents:
diff changeset
  1723
    if (! newWindow) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1724
	RETURN ( nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1725
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1726
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1727
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1728
    __cnt_view++;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1729
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1730
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1731
    /*
48194c26a46c Initial revision
claus
parents:
diff changeset
  1732
     * define its icon and name
48194c26a46c Initial revision
claus
parents:
diff changeset
  1733
     * (only makes sense for topWindows)
48194c26a46c Initial revision
claus
parents:
diff changeset
  1734
     */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1735
    if (isTopWindow) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1736
	if (__isExternalAddress(wiconId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1737
	    iconBitmap = __PixmapVal(wiconId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1738
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1739
	    iconBitmap = (Pixmap)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1740
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1741
	if (__isExternalAddress(wiconMaskId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1742
	    iconMask = __PixmapVal(wiconMaskId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1743
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1744
	    iconMask = (Pixmap)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1745
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1746
	if (__isExternalAddress(wiconViewId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1747
	    iconWindow = __WindowVal(wiconViewId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1748
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1749
	    iconWindow = (Window)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1750
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1751
	if (__isString(wlabel) || __isSymbol(wlabel))
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1752
	    windowName = (char *) __stringVal(wlabel);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1753
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1754
	    windowName = "";
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1755
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1756
	if (iconBitmap || windowName) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1757
	    ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1758
	    XSetStandardProperties(dpy, newWindow,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1759
					windowName, windowName,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1760
					iconBitmap,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1761
					0, 0, &sizehints);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1762
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1763
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1764
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1765
	wmhints.flags = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1766
	if (iconBitmap) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1767
	    wmhints.flags |= IconPixmapHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1768
	    wmhints.icon_pixmap = iconBitmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1769
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1770
	if (iconMask) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1771
	    wmhints.flags |= IconMaskHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1772
	    wmhints.icon_mask = iconMask;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1773
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1774
	if (iconWindow) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1775
	    wmhints.flags |= IconWindowHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1776
	    wmhints.icon_window = iconWindow;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1777
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1778
/*
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1779
	wmhints.flags |= InputHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1780
	wmhints.input = True;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1781
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1782
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1783
	XSetWMHints(dpy, newWindow, &wmhints);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1784
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1785
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1786
	/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1787
	 * get atoms first (if not already known)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1788
	 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1789
	if (__INST(protocolsAtom) == nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1790
	    ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1791
	    WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1792
	    __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1793
#ifdef USE_SAVEYOURSELF_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1794
	    WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1795
	    __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1796
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1797
#ifdef USE_QUIT_APP_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1798
	    WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1799
	    __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1800
#endif
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1801
	    WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1802
	    __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1803
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1804
	    UUIDAtom = XInternAtom(dpy, "UUID", False);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1805
	    __INST(uuidAtom) = __MKATOMOBJ(UUIDAtom);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1806
	    STXDeviceAtom = XInternAtom(dpy, "STX_DEVICE_ID", False);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1807
	    __INST(stxDeviceAtom) = __MKATOMOBJ(STXDeviceAtom);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1808
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1809
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1810
	} else {
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1811
#ifdef USE_QUIT_APP_ATOM
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1812
	    WmQuitAppAtom = __AtomVal(__INST(quitAppAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1813
#else
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1814
	    WmQuitAppAtom = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1815
#endif
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1816
	    WmProtocolsAtom = __AtomVal(__INST(protocolsAtom));
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1817
	    WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1818
#ifdef USE_SAVEYOURSELF_ATOM
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1819
	    WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1820
#else
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1821
	    WmSaveYourselfAtom = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1822
#endif
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1823
	    UUIDAtom = __AtomVal(__INST(uuidAtom));;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1824
	    STXDeviceAtom = __AtomVal(__INST(stxDeviceAtom));;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1825
	}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1826
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1827
	/*
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1828
	 * tell window manager to not kill us but send an event instead
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1829
	 */
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1830
	atoms[0] = WmDeleteWindowAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1831
#ifdef USE_SAVEYOURSELF_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1832
	atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1833
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1834
#ifdef USE_QUIT_APP_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1835
	atoms[atomCount] = WmQuitAppAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1836
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1837
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1838
	XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1839
			32, PropModeReplace, (unsigned char *)atoms, atomCount);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1840
	LEAVE_XLIB();
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1841
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1842
	/*
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1843
	 * an optional unique id (to mark stx-windows)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1844
	 */
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1845
	if (__isBytes(__INST(uniqueDeviceID))) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1846
	    int numUUIDBytes = __byteArraySize(__INST(uniqueDeviceID));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1847
	    unsigned char uuidBytes[32];
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1848
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1849
	    if (numUUIDBytes <= sizeof(uuidBytes)) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1850
		Atom uuidAtom;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1851
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1852
		bcopy(__byteArrayVal(__INST(uniqueDeviceID)), uuidBytes, numUUIDBytes);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1853
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1854
		ENTER_XLIB();
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1855
		XChangeProperty (dpy, newWindow, STXDeviceAtom, UUIDAtom, 8, PropModeReplace,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1856
				 uuidBytes, numUUIDBytes );
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1857
		LEAVE_XLIB();
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1858
	    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1859
	}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1860
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1861
	/*
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1862
	 * less decoration
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1863
	 */
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1864
	if ((wStyle == @symbol(undecorated))
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1865
	 || (wStyle == @symbol(dialog2))
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1866
	 || (wStyle == @symbol(notitle))
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1867
	) {
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1868
#ifdef SUPPORT_MOTIF_WM_HINTS
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1869
	    if (__INST(motifWMHintsAtom) == nil) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1870
		ENTER_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1871
		MotifWMHintsAtom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1872
		__INST(motifWMHintsAtom) = __MKATOMOBJ(MotifWMHintsAtom);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1873
		LEAVE_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1874
	    } else {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1875
		MotifWMHintsAtom = __AtomVal(__INST(motifWMHintsAtom));
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1876
	    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1877
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1878
	    {
4086
49b6b4f7d055 *** empty log message ***
ca
parents: 4082
diff changeset
  1879
		struct hints {
49b6b4f7d055 *** empty log message ***
ca
parents: 4082
diff changeset
  1880
		    unsigned long flags;
49b6b4f7d055 *** empty log message ***
ca
parents: 4082
diff changeset
  1881
		    unsigned long functions;
49b6b4f7d055 *** empty log message ***
ca
parents: 4082
diff changeset
  1882
		    unsigned long decorations;
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1883
		    long input_mode;
4086
49b6b4f7d055 *** empty log message ***
ca
parents: 4082
diff changeset
  1884
		    unsigned long status;
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1885
		} mvm_hints;
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1886
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1887
		if (wStyle == @symbol(undecorated)) {
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1888
		    mvm_hints.decorations = MWM_DECOR_NONE;
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1889
		}
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1890
		if (wStyle == @symbol(dialog2)) {
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1891
		    mvm_hints.decorations = MWM_DECOR_BORDER
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1892
					    | MWM_DECOR_RESIZEH
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1893
					    | MWM_DECOR_TITLE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1894
					    /* | MWM_DECOR_MENU */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1895
					    /* | MWM_DECOR_MINIMIZE */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1896
					    /* | MWM_DECOR_MAXIMIZE */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1897
					    ;
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1898
		}
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1899
		if (wStyle == @symbol(notitle)) {
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1900
		    mvm_hints.decorations = MWM_DECOR_BORDER
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1901
					    /* | MWM_DECOR_RESIZEH  */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1902
					    /* | MWM_DECOR_TITLE    */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1903
					    /* | MWM_DECOR_MENU     */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1904
					    /* | MWM_DECOR_MINIMIZE */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1905
					    /* | MWM_DECOR_MAXIMIZE */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1906
					    ;
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1907
		}
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1908
		mvm_hints.flags =  MWM_HINTS_DECORATIONS;
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1909
		ENTER_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1910
		XChangeProperty (dpy, newWindow, MotifWMHintsAtom,
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1911
				     MotifWMHintsAtom, 32, PropModeReplace,
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1912
				     (unsigned char*)&mvm_hints, 5 );
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1913
		LEAVE_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1914
	    }
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1915
#endif /* SUPPORT_MOTIF_WM_HINTS */
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1916
	}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1917
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1918
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1919
    windowId = __MKEXTERNALADDRESS(newWindow);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1920
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1921
    self addKnownView:aView withId:windowId.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1922
    ^ windowId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1923
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1924
48194c26a46c Initial revision
claus
parents:
diff changeset
  1925
destroyGC:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1926
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1927
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1928
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  1929
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  1930
     * 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
  1931
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1932
    if (! ISCONNECTED) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1933
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1934
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1935
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1936
    if (__isExternalAddress(aGCId)) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1937
	GC gc = __GCVal(aGCId);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1938
4478
fb57ec7d7cc4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4469
diff changeset
  1939
	if (gc == NULL) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  1940
	    console_fprintf(stderr, "XWorkstation [warning]: trying to destroy GC twice\n");
4478
fb57ec7d7cc4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4469
diff changeset
  1941
	    RETURN( self );
fb57ec7d7cc4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4469
diff changeset
  1942
	}
fb57ec7d7cc4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4469
diff changeset
  1943
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1944
	if (gc) {
4478
fb57ec7d7cc4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4469
diff changeset
  1945
	    __ExternalAddressInstPtr(aGCId)->e_address = NULL;
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1946
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1947
	    ENTER_XLIB();
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1948
	    XFreeGC(myDpy, gc);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1949
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1950
#ifdef COUNT_RESOURCES
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1951
	    __cnt_gc--;
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1952
#endif
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1953
	}
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1954
	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
  1955
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  1956
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  1957
    self primitiveFailed
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1958
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1959
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1960
destroyPixmap:aDrawableId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1961
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1962
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1963
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  1964
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  1965
     * 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
  1966
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1967
    if (! ISCONNECTED) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1968
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1969
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1970
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1971
    if (__isExternalAddress(aDrawableId)) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1972
	Pixmap pix = __PixmapVal(aDrawableId);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1973
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1974
	if (pix) {
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1975
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1976
	    ENTER_XLIB();
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1977
	    XFreePixmap(myDpy, pix);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1978
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1979
#ifdef COUNT_RESOURCES
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1980
	    __cnt_bitmap--;
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1981
#endif
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1982
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1983
	}
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  1984
	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
  1985
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  1986
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  1987
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1988
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1989
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1990
destroyView:aView withId:aWindowId
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1991
    self primDestroyView:aView withId:aWindowId.
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1992
    self removeKnownView:aView withId:aWindowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1993
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1994
48194c26a46c Initial revision
claus
parents:
diff changeset
  1995
dpsContextFor:aDrawableId and:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1996
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  1997
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  1998
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1999
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2000
#ifdef XXDPS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2001
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2002
    DPSContext dps;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2003
    int height;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2004
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2005
    if (__isExternalAddress(aDrawableId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2006
     && __isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2007
     && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2008
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  2009
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  2010
	dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId),
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  2011
				       __GCVal(aGCId),
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  2012
				       0, height, 0, colormap, NULL, 0,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  2013
				       XDPSDefaultTextBackstop,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  2014
				       XDPSDefaultErrorProc,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  2015
				       NULL);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  2016
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  2017
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  2018
	RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2019
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2020
#endif
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2021
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2022
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2023
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2024
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2025
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2026
gcFor:aDrawableId
132
claus
parents: 129
diff changeset
  2027
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2028
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2029
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2030
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2031
    GC gc;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2032
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2033
    if (__isExternalAddress(aDrawableId) && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2034
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2035
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2036
	gc = XCreateGC(myDpy, __DrawableVal(aDrawableId), 0L, (XGCValues *)0);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2037
	LEAVE_XLIB();
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2038
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2039
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2040
	if (gc)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2041
	    __cnt_gc++;
1089
dd14759d8370 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2042
#endif
dd14759d8370 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2043
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2044
	RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil );
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2045
    }
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2046
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2047
    self primitiveFailedOrClosedConnection.
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2048
    ^ nil
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2049
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2050
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2051
gcForBitmap:aDrawableId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2052
    "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
  2053
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2054
    ^ self gcFor:aDrawableId
295
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
primCreateBitmapFromArray:anArray width:w height:h
154
claus
parents: 153
diff changeset
  2058
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2059
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2060
154
claus
parents: 153
diff changeset
  2061
%{  /* UNLIMITEDSTACK */
claus
parents: 153
diff changeset
  2062
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2063
    Display *dpy;
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
    unsigned int b_width, b_height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2067
    REGISTER unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2068
    REGISTER unsigned char *pBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2069
    unsigned char *b_bits, *allocatedBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2070
    int index, row;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2071
    REGISTER int col;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2072
    unsigned bits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2073
    static char reverseBitTable[256];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2074
    static firstCall = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2075
    int nBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2076
    unsigned char fastBits[10000];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2077
    OBJ num, *op;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2078
    int bytesPerRow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2079
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2080
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2081
	RETURN (nil);
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2082
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2083
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2084
    dpy = myDpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2085
    if (firstCall) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2086
	for (index=0; index < 256; index++) {
4469
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2087
	    int t = 0;
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2088
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2089
	    if (index & 128) t |=   1;
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2090
	    if (index &  64) t |=   2;
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2091
	    if (index &  32) t |=   4;
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2092
	    if (index &  16) t |=   8;
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2093
	    if (index &   8) t |=  16;
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2094
	    if (index &   4) t |=  32;
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2095
	    if (index &   2) t |=  64;
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2096
	    if (index &   1) t |= 128;
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2097
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  2098
	    reverseBitTable[index] = t;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2099
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2100
	firstCall = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2101
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2102
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2103
    if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2104
	newBitmap = (Pixmap)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2105
	b_width = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2106
	b_height = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2107
	bytesPerRow = (b_width + 7) / 8;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2108
	nBytes = b_height * bytesPerRow;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2109
	if (nBytes < sizeof(fastBits)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2110
	    cp = b_bits = fastBits;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2111
	    allocatedBits = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2112
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2113
	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2114
	    if (! cp) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2115
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2116
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2117
	if (__qClass(anArray) == @global(Array)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2118
	    index = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2119
	    op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2120
	    for (row = b_height; row; row--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2121
		for (col = bytesPerRow; col; col--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2122
		    num = *op++;
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2123
		    if (__isSmallInteger(num)) {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2124
			bits = __intVal(num);
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2125
		    } else {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2126
			bits = __longIntVal(num);
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2127
			if (bits == 0) {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2128
			    goto fail;
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2129
			}
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2130
		    }
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2131
		    *cp++ = reverseBitTable[bits & 0xFF];
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2132
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2133
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2134
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2135
	    if (__qClass(anArray) == @global(ByteArray)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2136
		pBits = __ByteArrayInstPtr(anArray)->ba_element;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2137
		for (col = b_height*bytesPerRow; col; col--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2138
		    *cp++ = reverseBitTable[*pBits++];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2139
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2140
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2141
		goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2142
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2143
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2144
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2145
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2146
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2147
	newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2148
					       (char *)b_bits,
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2149
					       b_width, b_height);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2150
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2151
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2152
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2153
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2154
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2155
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2156
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2157
fail: ;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2158
	if (allocatedBits)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2159
	    free(allocatedBits);
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2160
	RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2161
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2162
%}.
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2163
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2164
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2165
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2166
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
  2167
    "for rel5 only"
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2168
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2169
    ^ self primitiveFailedOrClosedConnection
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2170
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2171
!
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2172
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2173
primDestroyView:aView withId:aWindowId
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2174
    <context: #return>
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2175
%{
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2176
    if (! ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2177
	RETURN ( self );
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2178
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2179
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2180
    if (__isExternalAddress(aWindowId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2181
	Window win = __WindowVal(aWindowId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2182
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2183
	if (win) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2184
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2185
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2186
	    XDestroyWindow(myDpy, win);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2187
	    LEAVE_XLIB();
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2188
#ifdef COUNT_RESOURCES
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2189
	    __cnt_view--;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2190
#endif
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2191
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2192
	}
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2193
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2194
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2195
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2196
48194c26a46c Initial revision
claus
parents:
diff changeset
  2197
!XWorkstation methodsFor:'color stuff'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2198
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2199
colorCell
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2200
    "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
  2201
     This method will return nil for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2202
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2203
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2204
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2205
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2206
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2207
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2208
    unsigned long dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2209
    Status ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2210
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2211
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2212
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2213
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2214
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2215
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2216
	ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2217
				   &dummy, 0, &color.pixel, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2218
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2219
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2220
	if (ok) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2221
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2222
	    __cnt_color++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2223
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2224
	    RETURN ( __MKSMALLINT(color.pixel) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2225
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2226
    }
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2227
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2228
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2229
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2230
48194c26a46c Initial revision
claus
parents:
diff changeset
  2231
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
  2232
    "allocate a color with color name - return the color index (i.e. colorID).
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2233
     Dont use this method, colornames are mostly X specific"
48194c26a46c Initial revision
claus
parents:
diff changeset
  2234
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2235
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2236
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2237
48194c26a46c Initial revision
claus
parents:
diff changeset
  2238
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2239
    XColor scolor, ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2240
    int screen = __intVal(__INST(screen));
850
Claus Gittinger <cg@exept.de>
parents: 847
diff changeset
  2241
    int id;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2242
    Status ok;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2243
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2244
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2245
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2246
     && (__qIsString(aString) || __qIsSymbol(aString))) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2247
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2248
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2249
	colorname = (char *) __stringVal(aString);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2250
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2251
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2252
	ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2253
	ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2254
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2255
	if (ok) {
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  2256
#ifdef QUICK_TRUE_COLORS
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2257
	    if (__INST(visualType) == @symbol(TrueColor)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2258
		id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2259
		id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2260
		id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2261
		RETURN ( __MKSMALLINT(id) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2262
	    }
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2263
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2264
	    ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2265
	    ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2266
	    LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2267
	}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2268
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2269
	if (! ok) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2270
	    RETURN ( nil );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2271
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2272
#ifdef COUNT_RESOURCES
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2273
	__cnt_color++;
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2274
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2275
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2276
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2277
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2278
    ^ 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
  2279
!
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2280
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2281
colorScaledRed:r scaledGreen:g scaledBlue:b
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2282
    "allocate a color with rgb values (0..16rFFFF) - return the color index (i.e. colorID)"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2283
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2284
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2285
%{
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2286
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2287
    XColor ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2288
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2289
    Status ok;
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2290
    int id;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2291
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2292
    if (__bothSmallInteger(r, g)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2293
     && __isSmallInteger(b)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2294
     && ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2295
	ecolor.red = __intVal(r);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2296
	ecolor.green= __intVal(g);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2297
	ecolor.blue = __intVal(b);
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2298
#ifdef QUICK_TRUE_COLORS
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2299
	if (__INST(visualType) == @symbol(TrueColor)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2300
	    id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2301
	    id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2302
	    id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2303
	    RETURN ( __MKSMALLINT(id) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2304
	}
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2305
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2306
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2307
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2308
	ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2309
	ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2310
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2311
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2312
	if (! ok) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2313
	    RETURN ( nil );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2314
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2315
#ifdef COUNT_RESOURCES
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2316
	__cnt_color++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2317
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2318
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2319
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2320
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2321
    ^ super colorScaledRed:r scaledGreen:g scaledBlue:b
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2322
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2323
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2324
deviceColorValueToPercent:aDeviceValue
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2325
    "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
  2326
     x-component value (0..100)"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2327
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2328
    ^ (100.0 * aDeviceValue / 16rFFFF)
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2329
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2330
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2331
     Display deviceColorValueToPercent:0
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2332
     Display deviceColorValueToPercent:16r8000
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2333
     Display deviceColorValueToPercent:16rFFFF
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2334
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2335
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2336
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2337
freeColor:colorIndex
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2338
    "free a display color when its no longer needed"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2339
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2340
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2341
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2342
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2343
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2344
    unsigned long color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2345
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2346
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2347
#ifdef QUICK_TRUE_COLORS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2348
    if (__INST(visualType) == @symbol(TrueColor)) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2349
	/* no need to do anything on TrueColor displays ... */
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2350
	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
  2351
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2352
#endif
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2353
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2354
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2355
     * 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
  2356
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2357
    if (! ISCONNECTED) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2358
	RETURN (self);
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2359
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2360
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2361
    if (__isSmallInteger(colorIndex)) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2362
	dpy = myDpy;
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2363
	color = (long) __intVal(colorIndex);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2364
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2365
	ENTER_XLIB();
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2366
	XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2367
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2368
#ifdef COUNT_RESOURCES
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2369
	__cnt_color--;
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2370
#endif
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2371
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2372
	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
  2373
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2374
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2375
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2376
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2377
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2378
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
  2379
    "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
  2380
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2381
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2382
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2383
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2384
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2385
    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
  2386
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2387
    int bits, scale, shift;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2388
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2389
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2390
     && __isSmallInteger(index)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2391
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2392
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2393
	color.pixel = __intVal(index);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2394
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2395
	ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2396
	XQueryColor(dpy, DefaultColormap(dpy, screen), &color);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2397
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2398
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2399
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2400
	/*
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2401
	 * have to compensate for an error in X ?, which does not scale
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2402
	 * colors correctly if lesser than 16bits are valid in a color,
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2403
	 * (for example, color white on a 4bitsPerRGB server will Return
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2404
	 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2405
	 */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2406
	bits = __intVal(__INST(bitsPerRGB));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2407
	scale = (1<<bits) - 1;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2408
	shift = 16 - bits;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2409
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2410
	sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2411
	sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2412
	sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2413
	RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2414
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2415
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2416
    ^ super getScaledRGBFrom:index
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2417
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2418
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2419
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
  2420
    "get rgb components (0..16rFFFF) of color named colorName,
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2421
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2422
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2423
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2424
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2425
    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
  2426
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2427
    double floor();
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2428
    int bits, scale, shift;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2429
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2430
    if (ISCONNECTED
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2431
     && __isNonNilObject(colorName)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2432
     && (__qIsString(colorName) || __qIsSymbol(colorName))) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2433
	Display *dpy = myDpy;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2434
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2435
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2436
	if (XParseColor(dpy, DefaultColormap(dpy, screen),
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2437
			     (char *) __stringVal(colorName), &color)) {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2438
	    /*
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2439
	     * have to compensate for an error in X ?, which does not scale
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2440
	     * colors correctly if lesser than 16bits are valid in a color,
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2441
	     * (for example, color white on a 4bitsPerRGB server will Return
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2442
	     * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2443
	     */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2444
	    bits = __intVal(__INST(bitsPerRGB));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2445
	    scale = (1<<bits) - 1;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2446
	    shift = 16 - bits;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2447
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2448
	    sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2449
	    sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2450
	    sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2451
	    RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2452
	}
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2453
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2454
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2455
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2456
    ^ super getScaledRGBFromName:colorName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2457
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2458
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2459
listOfAvailableColors
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2460
    "return a list of all available colornames.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2461
     This should not be used, since colornames are very
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2462
     display-specific (here X-specific)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2463
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2464
    |aStream list line index colorName|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2465
3814
0d856538e64f Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 3806
diff changeset
  2466
    aStream := '/usr/lib/X11/rgb.txt' asFilename readStreamOrNil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2467
    aStream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2468
    list := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2469
    [aStream atEnd] whileFalse:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2470
	line := aStream nextLine.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2471
	line notNil ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2472
	    "skip the r/g/b numbers"
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2473
	    index := 1.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2474
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2475
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2476
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2477
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2478
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2479
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2480
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2481
	    colorName := line copyFrom:index.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2482
	    ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2483
		list add:colorName
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2484
	    ]
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2485
	]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2486
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2487
    aStream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2488
    ^ list sort
1047
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2489
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2490
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2491
     Screen current listOfAvailableColors
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2492
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2493
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2494
    "Modified: 11.9.1996 / 15:26:28 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2495
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2496
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2497
percentToDeviceColorValue:aPercentage
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2498
    "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
  2499
     x-component value (0..65k) as an integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2500
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2501
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2502
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2503
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2504
    if (__isSmallInteger(aPercentage)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2505
	RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2506
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2507
    if (__isFloat(aPercentage)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2508
	RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2509
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2510
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2511
    ^ (16rFFFF * aPercentage / 100) rounded
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2512
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2513
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2514
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
  2515
    "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
  2516
     This method is a noop for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2517
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2518
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2519
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2520
48194c26a46c Initial revision
claus
parents:
diff changeset
  2521
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2522
    XColor color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2523
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2524
    int r, g, b;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2525
    int ok = 1;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2526
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2527
    if (__isSmallInteger(sred))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2528
	r = __intVal(sred);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2529
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2530
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2531
    if (__isSmallInteger(sgreen))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2532
	g = __intVal(sgreen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2533
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2534
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2535
    if (__isSmallInteger(sblue))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2536
	b = __intVal(sblue);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2537
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2538
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2539
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2540
     && __isSmallInteger(index) && ok) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2541
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2542
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2543
	color.pixel = __intVal(index);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2544
	color.red = r;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2545
	color.green = g;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2546
	color.blue = b;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2547
	color.flags = DoRed | DoGreen | DoBlue;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2548
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2549
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2550
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2551
	XStoreColor(dpy, DefaultColormap(dpy, screen), &color);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2552
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2553
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2554
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2555
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2556
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2557
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2558
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2559
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2560
!XWorkstation methodsFor:'cursor stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2561
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2562
builtInCursorShapes
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2563
    "return a collection of standard cursor names.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2564
     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
  2565
     user cursors.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2566
     (actually, there are more than those below ...)"
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2567
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2568
    "/ 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
  2569
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2570
    ^ #(
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2571
	#upLeftArrow            "/ XC_top_left_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2572
	#upRightHand            "/ XC_hand1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2573
	#upDownArrow            "/ XC_sb_v_double_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2574
	#leftRightArrow         "/ XC_sb_h_double_arrow
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2575
	#upLimitArrow           "/ XC_top_side
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2576
	#downLimitArrow         "/ XC_bottom_side
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2577
	#leftLimitArrow         "/ XC_left_side
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2578
	#rightLimitArrow        "/ XC_right_side
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2579
	#text                   "/ XC_xterm
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2580
	#upRightArrow           "/ XC_draft_large
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2581
	#leftHand               "/ XC_hand2
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2582
	#questionMark           "/ XC_question_arrow
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2583
	#cross                  "/ XC_X_cursor
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2584
	#wait                   "/ XC_watch
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2585
	#crossHair              "/ XC_tcross
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2586
	#origin                 "/ XC_ul_angle
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2587
	#topLeft                "/ XC_ul_angle
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2588
	#corner                 "/ XC_lr_angle
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2589
	#bottomRight            "/ XC_lr_angle
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2590
	#topRight               "/ XC_ur_angle
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2591
	#bottomLeft             "/ XC_ll_angle
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2592
	#square                 "/ XC_dotbox
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2593
	#fourWay                "/ XC_fleur
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2594
	#crossCursor            "/ XC_X_cursor
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2595
      )
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2596
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2597
    "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
  2598
    "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
  2599
!
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2600
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2601
colorCursor:aCursorId foreground:fgColor background:bgColor
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2602
    "change a cursors colors"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2603
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2604
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2605
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2606
    |fgR fgG fgB bgR bgG bgB|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2607
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2608
    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
  2609
    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
  2610
    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
  2611
    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
  2612
    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
  2613
    bgB := bgColor scaledBlue.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2614
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2615
    XColor fgcolor, bgcolor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2616
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2617
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2618
     && __isExternalAddress(aCursorId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2619
     && __bothSmallInteger(fgG, fgB)
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2620
     && __bothSmallInteger(bgR, bgG)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2621
     && __bothSmallInteger(bgB, fgR)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2622
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2623
	fgcolor.red = __intVal(fgR);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2624
	fgcolor.green= __intVal(fgG);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2625
	fgcolor.blue = __intVal(fgB);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2626
	bgcolor.red = __intVal(bgR);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2627
	bgcolor.green= __intVal(bgG);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2628
	bgcolor.blue = __intVal(bgB);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2629
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2630
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2631
	XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2632
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2633
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2634
	RETURN ( self );
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2635
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2636
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2637
    self primitiveFailedOrClosedConnection
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2638
!
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2639
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2640
createCursorShape:aShape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2641
    "create a cursor given a shape-symbol. This only works
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2642
     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
  2643
     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
  2644
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2645
    |shapeNumber|
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2646
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2647
    shapeNumber := self shapeNumberFromSymbol:aShape.
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2648
    shapeNumber isNil ifTrue:[^ nil].
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2649
    ^ self primCreateCursorShapeNumber:shapeNumber
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2650
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2651
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2652
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
  2653
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2654
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2655
    ^ self
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2656
	primCreateCursorSourceFormId:sourceForm id
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2657
	maskFormId:maskForm id
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2658
	hotX:hx hotY:hy
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2659
	width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2660
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2661
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2662
destroyCursor:aCursorId
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2663
    "release a cursor - frees any device resources"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2664
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2665
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2666
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2667
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2668
     * 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
  2669
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2670
    if (! ISCONNECTED) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2671
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2672
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2673
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2674
    if (__isExternalAddress(aCursorId)) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2675
	Cursor curs = __CursorVal(aCursorId);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2676
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2677
	if (curs) {
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2678
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2679
	    ENTER_XLIB();
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2680
	    XFreeCursor(myDpy, curs);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2681
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2682
#ifdef COUNT_RESOURCES
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2683
	    __cnt_cursor--;
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2684
#endif
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2685
	}
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  2686
	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
  2687
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2688
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2689
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2690
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2691
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2692
needDeviceFormsForCursor
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2693
    ^ true
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2694
!
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2695
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2696
primCreateCursorShapeNumber:aShapeNumber
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2697
    "create a cursor given a shape-number."
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2698
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2699
    <context: #return>
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2700
%{
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2701
    Cursor newCursor;
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2702
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2703
    if (ISCONNECTED
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2704
     && __isSmallInteger(aShapeNumber)) {
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2705
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2706
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2707
	newCursor = XCreateFontCursor(myDpy, __intVal(aShapeNumber));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2708
	LEAVE_XLIB();
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2709
#ifdef COUNT_RESOURCES
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2710
	if (newCursor)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2711
	    __cnt_cursor++;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2712
#endif
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2713
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2714
	if (newCursor != (Cursor)0) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2715
	    RETURN (__MKEXTERNALADDRESS(newCursor));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2716
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2717
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2718
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2719
    self primitiveFailedOrClosedConnection.
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2720
    ^ nil
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2721
!
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2722
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2723
primCreateCursorSourceFormId:sourceId maskFormId:maskId hotX:hx hotY:hy width:w height:h
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2724
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2725
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2726
    <context: #return>
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2727
%{
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2728
    Cursor newCursor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2729
    XColor fgColor, bgColor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2730
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2731
    if (ISCONNECTED
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2732
     && __isExternalAddress(sourceId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2733
     && __isExternalAddress(maskId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2734
     && __bothSmallInteger(hx, hy)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2735
	fgColor.red = 0;        /* fg is black */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2736
	fgColor.green = 0;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2737
	fgColor.blue = 0;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2738
	bgColor.red = 0xFFFF;   /* bg is white */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2739
	bgColor.green = 0xFFFF;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2740
	bgColor.blue = 0xFFFF;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2741
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2742
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2743
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2744
	newCursor = XCreatePixmapCursor(myDpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2745
				__PixmapVal(sourceId),
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2746
				__PixmapVal(maskId),
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2747
				&fgColor, &bgColor, __intVal(hx), __intVal(hy));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2748
	LEAVE_XLIB();
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2749
#ifdef COUNT_RESOURCES
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2750
	if (newCursor)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2751
	    __cnt_cursor++;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2752
#endif
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2753
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2754
	if (newCursor != (Cursor)0) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2755
	    RETURN (__MKEXTERNALADDRESS(newCursor));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2756
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2757
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2758
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2759
    self primitiveFailedOrClosedConnection.
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2760
    ^ nil
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2761
!
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2762
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2763
shapeNumberFromSymbol:shape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2764
    "given a shape-symbol, return the corresponding cursor-number,
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2765
     or nil if no such standard cursor exists."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2766
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2767
    "/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
  2768
    "/ 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
  2769
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2770
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2771
    (shape == #upLeftArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow)    %} "132" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2772
    (shape == #upRightHand)     ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1)             %} "58" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2773
    (shape == #upDownArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2774
    (shape == #leftRightArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2775
    (shape == #upLimitArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side)          %} "138" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2776
    (shape == #downLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side)       %} "16" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2777
    (shape == #leftLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side)         %} "70" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2778
    (shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side)        %} "96" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2779
    (shape == #text)            ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm)             %} "152" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2780
    (shape == #upRightArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large)       %} "44" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2781
    (shape == #leftHand)        ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2)             %} "60" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2782
    (shape == #questionMark)    ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow)    %} "92" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2783
    (shape == #cross)           ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2784
    (shape == #wait)            ifTrue:[ ^ %{ __MKSMALLINT(XC_watch)             %} "150" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2785
    (shape == #crossHair)       ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross)            %} "130" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2786
    ((shape == #origin)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2787
    or:[shape == #topLeft])     ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle)          %} "144" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2788
    ((shape == #corner)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2789
    or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle)          %} "78" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2790
    (shape == #topRight)        ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle)          %} "148" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2791
    (shape == #bottomLeft)      ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle)          %} "76" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2792
    (shape == #square)          ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox)            %} "40" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2793
    (shape == #fourWay)         ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur)             %} "52" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2794
    (shape == #crossCursor)     ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2795
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2796
"/    ('XWorkstation [info]: invalid cursorShape:' , shape printString) infoPrintNL.
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2797
    ^  nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2798
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2799
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2800
!XWorkstation methodsFor:'drag & drop'!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2801
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2802
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2803
    "drop something in some alien view, using the DND protocol.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2804
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2805
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2806
    |msgType dropColl dropCollSize anyFile anyDir anyText anyOther
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2807
     dropType dropTypeCode strings sz idx val|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2808
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2809
    (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2810
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2811
	"/ DND can drop files, file, dir, links, dirLink and text
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2812
	"/ check for this.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2813
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2814
	dropObjects isCollection ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2815
	    dropColl := Array with:dropObjects
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2816
	] ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2817
	    dropColl := dropObjects
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2818
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2819
	anyFile := anyDir := anyText := anyOther := false.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2820
	dropColl do:[:aDropObject |
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2821
	    aDropObject isFileObject ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2822
		aDropObject theObject isDirectory ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2823
		    anyDir := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2824
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2825
		    anyFile := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2826
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2827
	    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2828
		aDropObject isTextObject ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2829
		    anyText := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2830
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2831
		    anyOther := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2832
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2833
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2834
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2835
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2836
	anyOther ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2837
	    "/ DND does not support this ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2838
	    'XWorkstation [info]: DND can only drop files or text' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2839
	    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2840
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2841
	anyText ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2842
	    (anyFile or:[anyDir]) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2843
		"/ DND does not support mixed types
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2844
		'XWorkstation [info]: DND cannot drop both files and text' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2845
		^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2846
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2847
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2848
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2849
	dropCollSize := dropColl size.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2850
	anyFile ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2851
	    dropType := #DndFiles.
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2852
	    dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2853
		dropType := #DndFile
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2854
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2855
	] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2856
	    anyDir ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2857
		dropType := #DndFiles.
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2858
		dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2859
		    dropType := #DndDir
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2860
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2861
	    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2862
		anyText ifTrue:[
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2863
		    dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2864
			dropType := #DndText
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2865
		    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2866
			"/ can only drop a single text object
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2867
			'XWorkstation [info]: DND can only drop a single text' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2868
			^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2869
		    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2870
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2871
		    "/ mhmh ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2872
		    'XWorkstation [info]: DND cannot drop this' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2873
		    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2874
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2875
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2876
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2877
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2878
	dropTypeCode := self dndDropTypes indexOf:dropType.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2879
	dropTypeCode == 0 ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2880
	    'XWorkstation [info]: DND cannot drop this' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2881
	    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2882
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2883
	dropTypeCode := dropTypeCode - 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2884
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2885
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2886
	"/ place the selection inTo the DndSelection property
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2887
	"/ of the rootView ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2888
	"/ ... need a single string, with 0-terminated parts.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2889
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2890
	strings := OrderedCollection new.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2891
	sz := 0.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2892
	dropColl do:[:anObject |
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2893
	    |s o|
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2894
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2895
	    o := anObject theObject.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2896
	    anObject isFileObject ifTrue:[
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2897
		o := o pathName
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2898
	    ].
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2899
	    s := o asString.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2900
	    strings add:s.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2901
	    sz := sz + (s size) + 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2902
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2903
	val := String new:sz.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2904
	idx := 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2905
	strings do:[:aString |
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2906
	    |sz|
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2907
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2908
	    sz := aString size.
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2909
	    val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1.
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2910
	    idx := idx + sz.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2911
	    val at:idx put:(Character value:0).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2912
	    idx := idx + 1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2913
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2914
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2915
	self
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2916
	    setProperty:(self atomIDOf:#DndSelection)
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2917
	    type:(self atomIDOf:#STRING)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2918
	    value:val
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2919
	    for:rootId.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2920
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2921
	^ self
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2922
	    sendClientEvent:msgType
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2923
	    format:32
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2924
	    to:destinationId
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2925
	    data1:dropTypeCode
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2926
	    data2:0
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2927
	    data3:destinationId
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2928
	    data4:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2929
	    data5:nil.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2930
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2931
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2932
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2933
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2934
    "Created: 6.4.1997 / 13:39:37 / cg"
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  2935
    "Modified: 6.4.1997 / 14:30:43 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2936
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2937
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2938
dndDropTypes
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2939
    "return the dropTypes as supported by DND"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2940
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2941
    ^ #(
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2942
	    DndUnknown      "/ 0
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2943
	    DndRawData      "/ 1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2944
	    DndFile         "/ 2
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2945
	    DndFiles        "/ 3
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2946
	    DndText         "/ 4
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2947
	    DndDir          "/ 5
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2948
	    DndLink         "/ 6
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2949
	    DndExe          "/ 7
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2950
       )
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2951
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2952
    "Created: 6.4.1997 / 12:57:56 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2953
    "Modified: 6.4.1997 / 13:38:52 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2954
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2955
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  2956
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2957
    "drop something in some alien view.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2958
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2959
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2960
    "/
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2961
    "/ see, if the display supports the DND protocol ...
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2962
    "/
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2963
    (self atomIDOf:#DndProtocol) notNil ifTrue:[
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2964
	^ self
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2965
	    dndDrop:aCollectionOfDropObjects
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2966
	    inWindowID:destinationId
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2967
	    position:destinationPoint
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2968
	    rootPosition:rootPoint
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2969
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2970
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2971
    "/ add more drag&drop protocols here.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2972
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2973
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2974
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  2975
    "Modified: 11.4.1997 / 12:44:50 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2976
! !
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2977
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2978
!XWorkstation methodsFor:'drawing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2979
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  2980
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
  2981
    "do a bit-blt; copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2982
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2983
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2984
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2985
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2986
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2987
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2988
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2989
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2990
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2991
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2992
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2993
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2994
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2995
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2996
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2997
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2998
     && __bothSmallInteger(dstX, dstY)) {
1848
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2999
	int _sX, _sY, _w, _h, _dX, _dY;
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3000
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3001
	_sX = __intVal(srcX);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3002
	_sY = __intVal(srcY);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3003
	_w = __intVal(w);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3004
	_h = __intVal(h);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3005
	_dX = __intVal(dstX);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3006
	_dY = __intVal(dstY);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3007
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3008
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3009
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3010
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3011
	ENTER_XLIB();
1848
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3012
	XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3013
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3014
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3015
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3016
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3017
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3018
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3019
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3020
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3021
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3022
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3023
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
  3024
    "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
  3025
     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
  3026
     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
  3027
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3028
     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
  3029
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3030
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3031
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3032
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3033
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3034
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3035
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3036
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3037
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3038
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3039
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3040
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3041
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3042
     && __bothSmallInteger(dstX, dstY)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3043
	Display *dpy = myDpy;
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3044
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3045
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3046
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3047
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3048
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3049
	XSetGraphicsExposures(dpy, gc, 0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3050
	XCopyArea(dpy, source, dest, gc,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3051
				__intVal(srcX), __intVal(srcY),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3052
				__intVal(w), __intVal(h),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3053
				__intVal(dstX), __intVal(dstY));
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3054
	XSetGraphicsExposures(dpy, gc, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3055
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3056
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3057
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3058
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3059
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3060
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3061
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3062
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3063
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3064
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3065
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
  3066
    "do a bit-blt, but only copy the low-bit plane;
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3067
     copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3068
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3069
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3070
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3071
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3072
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3073
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3074
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3075
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3076
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3077
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3078
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3079
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3080
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3081
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3082
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3083
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3084
     && __bothSmallInteger(dstX, dstY)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3085
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3086
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3087
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3088
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3089
	XCopyPlane(myDpy, source, dest, gc,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3090
				 __intVal(srcX), __intVal(srcY),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3091
				 __intVal(w), __intVal(h),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3092
				 __intVal(dstX), __intVal(dstY), 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3093
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3094
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3095
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3096
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3097
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3098
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3099
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3100
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3101
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3102
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3103
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
  3104
    "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
  3105
     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
  3106
     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
  3107
     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
  3108
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3109
     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
  3110
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3111
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3112
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3113
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3114
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3115
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3116
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3117
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3118
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3119
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3120
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3121
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3122
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3123
     && __bothSmallInteger(dstX, dstY)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3124
	Display *dpy = myDpy;
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3125
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3126
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3127
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3128
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3129
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3130
	XSetGraphicsExposures(dpy, gc, 0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3131
	XCopyPlane(dpy, source, dest, gc,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3132
				 __intVal(srcX), __intVal(srcY),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3133
				 __intVal(w), __intVal(h),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3134
				 __intVal(dstX), __intVal(dstY), 1);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3135
	XSetGraphicsExposures(dpy, gc, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3136
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3137
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3138
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3139
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3140
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3141
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3142
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3143
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3144
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3145
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  3146
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
  3147
    "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
  3148
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3149
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3150
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3151
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3152
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3153
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3154
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3155
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3156
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3157
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3158
    if (__isSmallInteger(startAngle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3159
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3160
    else if (__isFloat(startAngle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3161
	f = __floatVal(startAngle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3162
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3163
    } else if (__isShortFloat(startAngle)) {
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3164
	f = __shortFloatVal(startAngle);
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3165
	angle1 = f * 64;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3166
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3167
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3168
    if (__isSmallInteger(angle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3169
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3170
    else if (__isFloat(angle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3171
	f = __floatVal(angle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3172
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3173
    } else if (__isShortFloat(angle)) {
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3174
	f = __shortFloatVal(angle);
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3175
	angle2 = f * 64;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3176
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3177
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3178
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3179
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3180
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3181
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3182
     && __bothSmallInteger(width, height)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3183
	win = __WindowVal(aDrawableId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3184
	gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3185
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3186
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3187
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3188
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3189
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3190
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3191
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3192
	    XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3193
				   w, h, angle1, angle2);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3194
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3195
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3196
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3197
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3198
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3199
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3200
    "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
  3201
     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
  3202
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3203
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3204
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3205
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3206
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
  3207
    "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
  3208
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3209
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3210
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3211
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3212
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3213
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3214
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3215
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3216
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3217
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3218
     && __bothSmallInteger(x0, y0)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3219
     && __bothSmallInteger(x1, y1)) {
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3220
	Display *dpy = myDpy;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3221
	int ix0, iy0, ix1, iy1;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3222
	gc = __GCVal(aGCId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3223
	win = __WindowVal(aDrawableId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3224
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3225
	ix0 = __intVal(x0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3226
	iy0 = __intVal(y0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3227
	ix1 = __intVal(x1);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3228
	iy1 = __intVal(y1);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3229
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3230
	/* attention: coordinates in X are shorts and wrap; clamp here. */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3231
	if (ix0 > 0x7FFF) ix0 = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3232
	else if (ix0 < -0x8000) ix0 = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3233
	if (iy0 > 0x7FFF) iy0 = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3234
	else if (iy0 < -0x8000) iy0 = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3235
	if (ix1 > 0x7FFF) ix1 = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3236
	else if (ix1 < -0x8000) ix1 = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3237
	if (iy1 > 0x7FFF) iy1 = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3238
	else if (iy1 < -0x8000) iy1 = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3239
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3240
	ENTER_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3241
	if ((ix0 == ix1) && (iy0 == iy1)) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3242
	    /* little bit shorter X-lib message (better with slow connections...) */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3243
	    XDrawPoint(dpy, win, gc, ix0, iy0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3244
	} else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3245
	    XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3246
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3247
	LEAVE_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3248
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3249
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3250
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3251
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3252
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3253
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3254
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3255
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
  3256
    "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
  3257
     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
  3258
    "
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3259
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3260
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3261
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3262
    |noY|
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3263
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3264
    (noY := yValues size) < 2 ifTrue:[
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3265
	^ self
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3266
    ].
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3267
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3268
%{
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3269
    OBJ      yA, t;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3270
    int      i, num;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3271
    float    y, x, sY, tY, step;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3272
    GC       gc;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3273
    XPoint * points;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3274
    XPoint   qPoints[200];
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3275
    int      mustFree = 0;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3276
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3277
    Window win;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3278
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3279
    if (ISCONNECTED
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3280
     && __isExternalAddress(aGCId)
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3281
     && __isExternalAddress(aDrawableId) ) {
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3282
	gc = __GCVal(aGCId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3283
	win = __WindowVal(aDrawableId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3284
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3285
	if( __isSmallInteger(scaleY) )
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3286
	    sY = (float) __intVal( scaleY );
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3287
	else if (__isFloat(scaleY))
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3288
	    sY = __floatVal( scaleY );
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3289
	else if (__isShortFloat(scaleY))
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3290
	    sY = __shortFloatVal( scaleY );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3291
	else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3292
	    t = __SSEND0(scaleY, @symbol(asFloat), 0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3293
	    if (! __isFloat(t)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3294
	    sY = __floatVal( t );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3295
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3296
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3297
	if( __isSmallInteger(transY) )
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3298
	    tY = (float) __intVal( transY );
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3299
	else if (__isFloat(transY))
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3300
	    tY = __floatVal( transY );
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3301
	else if (__isShortFloat(transY))
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3302
	    tY = __shortFloatVal( transY );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3303
	else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3304
	    t = __SSEND0(transY, @symbol(asFloat), 0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3305
	    if (! __isFloat(t)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3306
	    tY = __floatVal( t );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3307
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3308
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3309
	if( __isSmallInteger(startX) )
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3310
	    x = (float) __intVal( startX );
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3311
	else if (__isFloat(startX))
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3312
	    x = __floatVal( startX );
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3313
	else if (__isShortFloat(startX))
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3314
	    x = __shortFloatVal( startX );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3315
	else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3316
	    t = __SSEND0(startX, @symbol(asFloat), 0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3317
	    if (! __isFloat(t)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3318
	    x = __floatVal( t );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3319
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3320
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3321
	if( __isSmallInteger(stepX) )
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3322
	    step = (float) __intVal( stepX );
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3323
	else if (__isFloat(stepX))
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3324
	    step = __floatVal( stepX );
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3325
	else if (__isShortFloat(stepX))
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3326
	    step = __shortFloatVal( stepX );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3327
	else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3328
	    t = __SSEND0(stepX, @symbol(asFloat), 0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3329
	    if (! __isFloat(t)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3330
	    step = __floatVal( t );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3331
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3332
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3333
	num = __intVal( noY );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3334
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3335
	if( num > 200 ) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3336
	    if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3337
		goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3338
	    mustFree = 1;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3339
	} else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3340
	    points = qPoints;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3341
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3342
	for( i = 0; i < num; ++i ) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3343
	    int px, py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3344
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3345
	    yA  = __AT_(yValues, __MKSMALLINT(i+1) );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3346
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3347
	    if( __isFloat(yA) )
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3348
		y = __floatVal( yA );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3349
	    else if( __isSmallInteger(yA) )
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3350
		y = (float) __intVal( yA );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3351
	    else if( __isShortFloat( yA) )
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3352
		y = __shortFloatVal( yA );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3353
	    else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3354
		t = __SSEND0(yA, @symbol(asFloat), 0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3355
		if (! __isFloat(t)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3356
		y = __floatVal( t );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3357
	    }
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3358
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3359
	    px = (int) (x + 0.5);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3360
	    py = (int) ((y * sY) + tY + 0.5);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3361
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3362
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3363
	    if (px > 0x7FFF) px = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3364
	    else if (px < -0x8000) px = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3365
	    if (py > 0x7FFF) py = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3366
	    else if (py < -0x8000) py = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3367
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3368
	    points[i].x = px;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3369
	    points[i].y = py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3370
	    x = x + step;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3371
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3372
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3373
	ENTER_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3374
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3375
	LEAVE_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3376
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3377
	if( mustFree ) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3378
	    free( points );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3379
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3380
	RETURN ( self );
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3381
    }
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3382
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3383
fail:
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3384
    if( mustFree )
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3385
	free( points );
3229
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3386
%}.
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3387
    ^ 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
  3388
2146
1c13fdc62a9f displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  3389
    "Modified: / 13.6.1998 / 13:51:39 / cg"
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3390
!
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3391
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3392
displayPointX:x y:y in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3393
    "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
  3394
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3395
    <context: #return>
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3396
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3397
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3398
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3399
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3400
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3401
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3402
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3403
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3404
     && __bothSmallInteger(x, y)) {
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3405
	int px, py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3406
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3407
	gc = __GCVal(aGCId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3408
	win = __WindowVal(aDrawableId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3409
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3410
	px = __intVal(x);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3411
	py = __intVal(y);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3412
	if (px > 0x7FFF) px = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3413
	else if (px < -0x8000) px = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3414
	if (py > 0x7FFF) py = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3415
	else if (py < -0x8000) py = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3416
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3417
	ENTER_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3418
	XDrawPoint(myDpy, win, gc, px, py);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3419
	LEAVE_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3420
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3421
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3422
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3423
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3424
    "badGC, badDrawable or x/y not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3425
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3426
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3427
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3428
displayPolygon:aPolygon in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3429
    "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
  3430
     define the polygon.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3431
     If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3432
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3433
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3434
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3435
    |numberOfPoints newPoints|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3436
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3437
    numberOfPoints := aPolygon size.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3438
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3439
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3440
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3441
    OBJ point, x, y;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3442
    int i, num;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3443
    XPoint *points;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3444
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3445
    int mustFree = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3446
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3447
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3448
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3449
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3450
     && __isSmallInteger(numberOfPoints)) {
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3451
	gc = __GCVal(aGCId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3452
	win = __WindowVal(aDrawableId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3453
	num = __intVal(numberOfPoints);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3454
	/*
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3455
	 * avoid a (slow) malloc, if the number of points is small
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3456
	 */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3457
	if (num > 100) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3458
	    points = (XPoint *)malloc(sizeof(XPoint) * num);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3459
	    if (! points) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3460
	    mustFree = 1;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3461
	} else
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3462
	    points = qPoints;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3463
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3464
	for (i=0; i<num; i++) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3465
	    int px, py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3466
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3467
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3468
	    if (! __isPoint(point)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3469
	    x = _point_X(point);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3470
	    y = _point_Y(point);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3471
	    if (! __bothSmallInteger(x, y))
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3472
		goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3473
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3474
	    px = __intVal(x);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3475
	    py = __intVal(y);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3476
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3477
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3478
	    if (px > 0x7FFF) px = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3479
	    else if (px < -0x8000) px = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3480
	    if (py > 0x7FFF) py = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3481
	    else if (py < -0x8000) py = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3482
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3483
	    points[i].x = px;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3484
	    points[i].y = py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3485
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3486
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3487
	ENTER_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3488
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3489
	LEAVE_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3490
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3491
	if (mustFree)
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3492
	    free(points);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3493
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3494
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3495
fail: ;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3496
    if (mustFree)
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3497
	free(points);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3498
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3499
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3500
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3501
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3502
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3503
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
  3504
    "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
  3505
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3506
    <context: #return>
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3507
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3508
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3509
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3510
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3511
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3512
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3513
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3514
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3515
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3516
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3517
     && __bothSmallInteger(width, height)) {
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3518
	int px, py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3519
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3520
	gc = __GCVal(aGCId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3521
	win = __WindowVal(aDrawableId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3522
	w = __intVal(width);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3523
	h = __intVal(height);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3524
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3525
	/*
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3526
	 * need this check here: some servers simply dump core with bad args
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3527
	 */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3528
	if ((w >= 0) && (h >= 0)) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3529
	    px = __intVal(x);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3530
	    py = __intVal(y);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3531
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3532
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3533
	    if (px > 0x7FFF) px = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3534
	    else if (px < -0x8000) px = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3535
	    if (py > 0x7FFF) py = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3536
	    else if (py < -0x8000) py = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3537
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3538
	    ENTER_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3539
	    XDrawRectangle(myDpy, win, gc, px, py, w, h);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3540
	    LEAVE_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3541
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3542
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3543
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3544
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3545
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3546
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3547
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3548
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3549
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
  3550
    "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
  3551
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3552
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3553
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3554
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3555
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3556
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3557
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3558
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3559
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3560
    OBJ cls;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3561
    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
  3562
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3563
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3564
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3565
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3566
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3567
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3568
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3569
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3570
     && __bothSmallInteger(index1, index2)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3571
     && __bothSmallInteger(x, y)) {
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3572
	int lMax = __intVal(@global(MaxStringLength));
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3573
	Display *dpy = myDpy;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3574
	gc = __GCVal(aGCId);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3575
	win = __WindowVal(aDrawableId);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3576
	cls = __qClass(aString);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3577
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3578
	i1 = __intVal(index1) - 1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3579
	if (i1 >= 0) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3580
	    i2 = __intVal(index2) - 1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3581
	    if (i2 < i1) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3582
		RETURN (self);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3583
	    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3584
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3585
	    cp = (char *) __stringVal(aString);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3586
	    l = i2 - i1 + 1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3587
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3588
	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3589
		n = __stringSize(aString);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3590
		if (i2 < n) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3591
		    cp += i1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3592
		    if (l > lMax) l = lMax;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3593
		    ENTER_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3594
		    if (opaque == true)
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3595
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3596
		    else
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3597
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3598
		    LEAVE_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3599
		    RETURN ( self );
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3600
		}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3601
	    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3602
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3603
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3604
	    cp += nInstBytes;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3605
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3606
	    if (__isBytes(aString)) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3607
		n = __byteArraySize(aString) - nInstBytes - 1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3608
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3609
		if (i2 < n) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3610
		    cp += i1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3611
		    if (l > lMax) l = lMax;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3612
		    ENTER_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3613
		    if (opaque == true)
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3614
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3615
		    else
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3616
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3617
		    LEAVE_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3618
		    RETURN ( self );
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3619
		}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3620
	    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3621
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3622
	    /* TWOBYTESTRINGS */
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3623
	    if (__isWords(aString)) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3624
		n = (__byteArraySize(aString) - nInstBytes) / 2;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3625
		if (i2 < n) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3626
		    union {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3627
			char b[2];
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3628
			unsigned short s;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3629
		    } u;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3630
		    int i;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3631
		    XChar2b *cp2 = (XChar2b *)0;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3632
		    int mustFree = 0;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3633
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3634
		    cp += (i1 * 2);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3635
		    if (l > lMax) l = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3636
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3637
#if defined(MSBFIRST) || defined(__MSBFIRST)
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3638
		    /*
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3639
		     * chars already in correct order
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3640
		     */
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3641
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3642
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3643
		    /*
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3644
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3645
		     * X expects them MSB first
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3646
		     * convert as required
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3647
		     */
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3648
		    u.s = 0x1234;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3649
		    if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3650
# endif
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3651
		    {
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3652
			if (l <= NLOCALBUFFER) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3653
			    cp2 = xlatebuffer;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3654
			} else {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3655
			    cp2 = (XChar2b *)(malloc(l * 2));
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3656
			    mustFree = 1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3657
			}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3658
			for (i=0; i<l; i++) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3659
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3660
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3661
			}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3662
			cp = (char *) cp2;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3663
		    }
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3664
#endif
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3665
		    ENTER_XLIB();
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3666
		    if (opaque == true)
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3667
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3668
		    else
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3669
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3670
		    LEAVE_XLIB();
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3671
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3672
		    if (mustFree) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3673
			free(cp2);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3674
		    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3675
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3676
		    RETURN ( self );
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3677
		}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3678
	    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3679
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3680
	    /* FOURBYTESTRINGS */
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3681
	    if (__isLongs(aString)) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3682
		n = (__byteArraySize(aString) - nInstBytes) / 4;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3683
		if (i2 < n) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3684
		    union {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3685
			char b[2];
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3686
			unsigned short s;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3687
		    } u;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3688
		    int i;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3689
		    XChar2b *cp2 = (XChar2b *)0;
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3690
		    int32 *ip;
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3691
		    int mustFree = 0;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3692
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3693
		    cp += (i1 * 4);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3694
		    if (l > lMax) l = lMax;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3695
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3696
		    /*
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3697
		     * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3698
		     */
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3699
		    if (l <= NLOCALBUFFER) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3700
			cp2 = xlatebuffer;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3701
		    } else {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3702
			cp2 = (XChar2b *)(malloc(l * 2));
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3703
			mustFree = 1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3704
		    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3705
		    for (i=0; i<l; i++) {
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3706
			int32 codePoint = ((int32 *)cp)[i];
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3707
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3708
			if (codePoint > 0xFFFF) {
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3709
			    codePoint = 0xFFFF;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3710
			}
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3711
			cp2[i].byte1 = (codePoint >> 8) & 0xFF;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3712
			cp2[i].byte2 = codePoint & 0xFF;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3713
		    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3714
		    cp = (char *) cp2;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3715
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3716
		    ENTER_XLIB();
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3717
		    if (opaque == true)
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3718
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3719
		    else
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3720
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3721
		    LEAVE_XLIB();
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3722
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3723
		    if (mustFree) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3724
			free(cp2);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3725
		    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3726
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3727
		    RETURN ( self );
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3728
		}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3729
	    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3730
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3731
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3732
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3733
%}.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3734
    (aString isString and:[aString bitsPerCharacter > 16]) ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3735
	self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter)
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3736
	     from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3737
	^ self.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3738
    ].
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3739
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3740
    "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
  3741
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3742
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3743
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3744
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
  3745
    "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
  3746
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3747
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3748
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3749
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3750
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3751
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3752
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3753
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3754
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3755
    int n;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3756
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3757
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3758
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3759
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3760
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3761
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3762
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3763
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3764
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3765
     && __bothSmallInteger(x, y)) {
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3766
	int lMax = __intVal(@global(MaxStringLength));
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3767
	Display *dpy = myDpy;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3768
	gc = __GCVal(aGCId);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3769
	win = __WindowVal(aDrawableId);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3770
	cls = __qClass(aString);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3771
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3772
	cp = (char *) __stringVal(aString);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3773
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3774
	if ((cls == @global(String)) || (cls == @global(Symbol))) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3775
	    n = __stringSize(aString);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3776
	    if (n > lMax) n = lMax;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3777
	    ENTER_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3778
	    if (opaque == true)
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3779
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3780
	    else
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3781
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3782
	    LEAVE_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3783
	    RETURN ( self );
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3784
	}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3785
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3786
	nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3787
	cp += nInstBytes;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3788
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3789
	if (__isBytes(aString)) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3790
	    n = __byteArraySize(aString) - nInstBytes - 1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3791
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3792
	    if (n > lMax) n = lMax;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3793
	    ENTER_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3794
	    if (opaque == true)
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3795
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3796
	    else
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3797
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3798
	    LEAVE_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3799
	    RETURN ( self );
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3800
	}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3801
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3802
	/* TWOBYTESTRINGS */
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3803
	if (__isWords(aString)) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3804
	    union {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3805
		char b[2];
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3806
		unsigned short s;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3807
	    } u;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3808
	    int i;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3809
	    XChar2b *cp2;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3810
	    int mustFree = 0;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3811
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3812
	    n = (__byteArraySize(aString) - nInstBytes) / 2;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3813
	    if (n > lMax) n = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3814
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3815
#if defined(MSBFIRST) || defined(__MSBFIRST)
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3816
	    /*
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3817
	     * chars already in correct order
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3818
	     */
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3819
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3820
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3821
	    /*
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3822
	     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3823
	     * X expects them MSB first
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3824
	     * convert as required
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3825
	     */
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3826
	    u.s = 0x1234;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3827
	    if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3828
# endif
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3829
	    {
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3830
		if (n <= NLOCALBUFFER) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3831
		    cp2 = xlatebuffer;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3832
		} else {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3833
		    cp2 = (XChar2b *)(malloc(n * 2));
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3834
		    mustFree = 1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3835
		}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3836
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3837
		for (i=0; i<n; i++) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3838
		    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3839
		    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3840
		}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3841
		cp = (char *) cp2;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3842
	    }
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3843
#endif
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3844
	    ENTER_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3845
	    if (opaque == true)
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3846
		XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3847
	    else
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3848
		XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3849
	    LEAVE_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3850
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3851
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3852
	    if (mustFree) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3853
		free(cp2);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3854
	    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3855
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3856
	    RETURN ( self );
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  3857
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3858
    }
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3859
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3860
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3861
    ^ 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
  3862
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3863
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3864
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3865
	width:imageWidth height:imageHeight
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3866
	x:srcx y:srcy
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3867
	into:aDrawableId
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3868
	x:dstx y:dsty
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3869
	width:w height:h
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3870
	with:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3871
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3872
    "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
  3873
     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
  3874
     Individual source pixels have bitsPerPixel bits, allowing to draw
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3875
     depth and pixel-units to be different.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3876
     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
  3877
     depth - otherwise, primitive failure will be signalled.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3878
     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
  3879
     colors are allocated - otherwise the colors may be wrong."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3880
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3881
    |fmt padding bits wantedPadding|
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3882
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3883
    padding := givenPadding.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3884
    bits := givenBits.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3885
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3886
    "/ 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
  3887
    "/ 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
  3888
    "/ 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
  3889
    "/ care for that.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3890
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3891
    ((imageDepth == 4) and:[depth == 4]) ifTrue:[
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3892
	fmt := self supportedImageFormatForDepth:4.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3893
	fmt isNil ifTrue:[
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3894
	    self primitiveFailed. "/ cannot represent this image
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3895
	    ^ nil
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3896
	].
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3897
	wantedPadding := fmt at:#padding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3898
	wantedPadding > givenPadding ifTrue:[
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3899
	    bits := self
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3900
			    repadBits:givenBits
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3901
			    width:imageWidth
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3902
			    height:imageHeight
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3903
			    depth:imageDepth
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3904
			    from:givenPadding
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3905
			    to:wantedPadding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3906
	    padding := wantedPadding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3907
	]
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3908
    ].
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3909
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3910
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3911
     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
  3912
     an unlimited stack, and thus cannot send primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3913
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3914
    (self
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3915
	primDrawBits:bits
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3916
	bitsPerPixel:bitsPerPixel
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3917
	depth:imageDepth
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3918
	msb:true
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3919
	padding:padding
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3920
	width:imageWidth height:imageHeight
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3921
	x:srcx y:srcy
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3922
	into:aDrawableId
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3923
	x:dstx y:dsty
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3924
	width:w height:h
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3925
	with:aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3926
    ifFalse:[
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3927
	"
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3928
	 also happens, if a segmentation violation occurs in the
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3929
	 XPutImage ...
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3930
	"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3931
	self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3932
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3933
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3934
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  3935
fillArcX:x y:y width:width height:height from:startAngle angle:angle
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3936
	       in:aDrawableId with:aGCId
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3937
    "fill an arc. If any coordinate is not integer, an error is triggered.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3938
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3939
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3940
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3941
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3942
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3943
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3944
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3945
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3946
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3947
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3948
    if (__isSmallInteger(startAngle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3949
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3950
    else if (__isFloat(startAngle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3951
	f = __floatVal(startAngle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3952
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3953
    } else if (__isShortFloat(startAngle)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3954
	f = __shortFloatVal(startAngle);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3955
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3956
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3957
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3958
    if (__isSmallInteger(angle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3959
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3960
    else if (__isFloat(angle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3961
	f = __floatVal(angle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3962
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3963
    } else if (__isShortFloat(angle)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3964
	f = __shortFloatVal(angle);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3965
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3966
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3967
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3968
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3969
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3970
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3971
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3972
     && __bothSmallInteger(width, height)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3973
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3974
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3975
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3976
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3977
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3978
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3979
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3980
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3981
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3982
	    XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3983
				   w, h, angle1, angle2);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3984
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3985
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3986
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3987
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3988
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3989
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3990
    "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
  3991
     or non float angle(s)"
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3992
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3993
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3994
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3995
48194c26a46c Initial revision
claus
parents:
diff changeset
  3996
fillPolygon:aPolygon in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3997
    "fill a polygon given by its points.
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3998
     If any coordinate is not integer, an error is triggered."
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3999
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4000
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4001
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4002
    |numberOfPoints|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4003
48194c26a46c Initial revision
claus
parents:
diff changeset
  4004
    numberOfPoints := aPolygon size.
48194c26a46c Initial revision
claus
parents:
diff changeset
  4005
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4006
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4007
    Window win;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4008
    OBJ point, x, y;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4009
    int i, num;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4010
    XPoint *points;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4011
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4012
    int mustFree = 0;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4013
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4014
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4015
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4016
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4017
     && __isSmallInteger(numberOfPoints)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4018
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4019
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4020
	num = __intVal(numberOfPoints);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4021
	if (num < 3) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4022
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4023
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4024
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4025
	 * avoid (slow) malloc, if not many points
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4026
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4027
	if (num > 100) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4028
	    points = (XPoint *) malloc(sizeof(XPoint) * num);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4029
	    if (! points) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4030
	    mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4031
	} else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4032
	    points = qPoints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4033
	for (i=0; i<num; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4034
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4035
	    if (! __isPoint(point)) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4036
	    x = _point_X(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4037
	    y = _point_Y(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4038
	    if (! __bothSmallInteger(x, y))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4039
		goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4040
	    points[i].x = __intVal(x);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4041
	    points[i].y = __intVal(y);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4042
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  4043
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4044
	XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  4045
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4046
	if (mustFree)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4047
	    free(points);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4048
	RETURN ( self );
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4049
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4050
fail: ;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4051
	if (mustFree)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4052
	    free(points);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4053
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4054
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4055
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4056
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4057
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4058
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4059
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
  4060
    "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
  4061
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4062
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4063
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4064
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4065
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4066
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4067
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4068
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4069
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4070
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4071
     && __bothSmallInteger(width, height)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4072
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4073
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4074
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4075
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4076
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4077
	if ((w >= 0) && (h >= 0)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  4078
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4079
	    XFillRectangle(myDpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4080
			   __DrawableVal(aDrawableId), __GCVal(aGCId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4081
			   __intVal(x), __intVal(y), w, h);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  4082
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4083
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4084
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4085
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4086
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4087
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4088
    self primitiveFailedOrClosedConnection
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4089
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4090
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4091
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb masks:maskArray padding:bitPadding
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4092
			     extent:imageExtent sourceOrigin:srcOrg
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4093
			       into:aDrawableId
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4094
		  destinationOrigin:dstOrg extent:dstExtent
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4095
			       with:aGCId
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4096
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4097
    <context: #return>
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4098
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4099
    |imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h|
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4100
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4101
    imageWidth := imageExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4102
    imageHeight := imageExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4103
    rm := maskArray at:1.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4104
    gm := maskArray at:2.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4105
    bm := maskArray at:3.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4106
    srcx := srcOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4107
    srcy := srcOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4108
    dstx := dstOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4109
    dsty := dstOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4110
    w := dstExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4111
    h := dstExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4112
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4113
    "since XPutImage may allocate huge amount of stack space
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4114
     (some implementations use alloca), this must run with unlimited stack."
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4115
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4116
%{  /* UNLIMITEDSTACK */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4117
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4118
    /*
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4119
     * need unlimited stack, since some Xlibs do a huge alloca in
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4120
     * XPutImage
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4121
     */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4122
    GC gc;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4123
    Window win;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4124
    XImage image;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4125
    int imgWdth;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4126
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4127
    if (ISCONNECTED
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4128
     && __isExternalAddress(aGCId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4129
     && __isExternalAddress(aDrawableId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4130
     && __bothSmallInteger(srcx, srcy)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4131
     && __bothSmallInteger(dstx, dsty)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4132
     && __bothSmallInteger(w, h)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4133
     && __bothSmallInteger(imageWidth, imageHeight)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4134
     && __bothSmallInteger(imageDepth, bitsPerPixel)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4135
     && __isSmallInteger(bitPadding)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4136
     && __bothSmallInteger(rm, gm)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4137
     && __isSmallInteger(bm)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4138
     && __isByteArray(imageBits)) {
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4139
	Display *dpy = myDpy;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4140
	int pad = __intVal(bitPadding);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4141
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4142
	gc = __GCVal(aGCId);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4143
	win = __WindowVal(aDrawableId);
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4144
	if (! gc || !win)
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4145
	    goto fail;
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4146
#ifdef ARGDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4147
	console_printf("args ok\n");
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4148
#endif
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4149
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4150
	image.width = imgWdth = __intVal(imageWidth);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4151
	image.height = __intVal(imageHeight);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4152
	image.xoffset = 0;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4153
	image.format = ZPixmap;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4154
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4155
	image.bitmap_unit = 8;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4156
	image.bitmap_bit_order = MSBFirst;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4157
	image.bitmap_pad = pad;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4158
	image.depth = __intVal(imageDepth);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4159
	image.bits_per_pixel = __intVal(bitsPerPixel);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4160
	image.red_mask = __intVal(rm);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4161
	image.green_mask = __intVal(gm);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4162
	image.blue_mask = __intVal(bm);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4163
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4164
	image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4165
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4166
	switch (image.bits_per_pixel) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4167
	    case 1:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4168
	    case 2:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4169
	    case 4:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4170
	    case 8:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4171
	    case 16:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4172
	    case 24:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4173
	    case 32:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4174
		break;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4175
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4176
	    default:
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4177
#ifdef ARGDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4178
		console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4179
#endif
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4180
		goto fail;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4181
	}
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4182
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4183
	/* ENTER_XLIB(); */
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4184
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4185
					__intVal(dstx), __intVal(dsty),
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4186
					__intVal(w), __intVal(h));
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4187
	/* LEAVE_XLIB(); */
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4188
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4189
	RETURN ( true );
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4190
    }
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4191
#ifdef ARGDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4192
    if (!! __isExternalAddress(aGCId)) console_printf("GC\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4193
    if (!! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4194
    if (!! __isSmallInteger(srcx)) console_printf("srcx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4195
    if (!! __isSmallInteger(srcy)) console_printf("srcy\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4196
    if (!! __isSmallInteger(dstx)) console_printf("dstx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4197
    if (!! __isSmallInteger(dsty)) console_printf("dsty\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4198
    if (!! __isSmallInteger(w)) console_printf("w\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4199
    if (!! __isSmallInteger(h)) console_printf("h\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4200
    if (!! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4201
    if (!! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4202
    if (!! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4203
    if (!! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4204
    if (!! __isByteArray(imageBits)) console_printf("imageBits\n");
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4205
#endif
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4206
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4207
fail: ;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4208
%}
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4209
.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4210
    ^ false
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4211
!
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4212
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4213
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4214
			      width:imageWidth height:imageHeight
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4215
				  x:srcx y:srcy
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4216
			       into:aDrawableId
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4217
				  x:dstx y:dsty
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4218
			      width:w height:h
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4219
			       with:aGCId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4220
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4221
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4222
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4223
    "since XPutImage may allocate huge amount of stack space
132
claus
parents: 129
diff changeset
  4224
     (some implementations use alloca), this must run with unlimited stack."
claus
parents: 129
diff changeset
  4225
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4226
%{  /* UNLIMITEDSTACK */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4227
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4228
    /*
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4229
     * need unlimited stack, since some Xlibs do a huge alloca in
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4230
     * XPutImage
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4231
     */
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4232
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4233
    Window win;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4234
    XImage image;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4235
    int imgWdth;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4236
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4237
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4238
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4239
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4240
     && __bothSmallInteger(srcx, srcy)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4241
     && __bothSmallInteger(dstx, dsty)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4242
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4243
     && __bothSmallInteger(imageWidth, imageHeight)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4244
     && __bothSmallInteger(imageDepth, bitsPerPixel)
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  4245
     && __isSmallInteger(bitPadding)
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4246
     && __isByteArray(imageBits)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4247
	Display *dpy = myDpy;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4248
	int pad = __intVal(bitPadding);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4249
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4250
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4251
	win = __WindowVal(aDrawableId);
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4252
	if (! gc || !win)
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4253
	    goto fail;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4254
#ifdef ARGDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4255
	console_printf("args ok\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4256
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4257
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4258
	image.width = imgWdth = __intVal(imageWidth);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4259
	image.height = __intVal(imageHeight);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4260
	image.xoffset = 0;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4261
	image.format = ZPixmap;
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4262
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4263
	image.bitmap_unit = 8;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4264
	image.bitmap_bit_order = MSBFirst;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4265
	image.bitmap_pad = pad;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4266
	image.depth = __intVal(imageDepth);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4267
	image.bits_per_pixel = __intVal(bitsPerPixel);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4268
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4269
	/*
2021
67626c0fb1eb fixed image padding bug
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  4270
	image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8;
67626c0fb1eb fixed image padding bug
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  4271
	*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4272
	image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4273
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4274
	switch (image.bits_per_pixel) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4275
	    case 1:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4276
	    case 2:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4277
	    case 4:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4278
	    case 8:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4279
	    case 16:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4280
	    case 24:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4281
	    case 32:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4282
		break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4283
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4284
	    default:
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4285
#ifdef ARGDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4286
		console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4287
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4288
		goto fail;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4289
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4290
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4291
	image.red_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4292
	image.green_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4293
	image.blue_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4294
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4295
	/* ENTER_XLIB(); */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4296
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4297
					__intVal(dstx), __intVal(dsty),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4298
					__intVal(w), __intVal(h));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4299
	/* LEAVE_XLIB(); */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4300
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4301
	RETURN ( true );
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4302
    }
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4303
#ifdef ARGDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4304
    if (!! __isExternalAddress(aGCId)) console_printf("GC\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4305
    if (!! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4306
    if (!! __isSmallInteger(srcx)) console_printf("srcx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4307
    if (!! __isSmallInteger(srcy)) console_printf("srcy\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4308
    if (!! __isSmallInteger(dstx)) console_printf("dstx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4309
    if (!! __isSmallInteger(dsty)) console_printf("dsty\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4310
    if (!! __isSmallInteger(w)) console_printf("w\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4311
    if (!! __isSmallInteger(h)) console_printf("h\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4312
    if (!! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4313
    if (!! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4314
    if (!! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4315
    if (!! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4316
    if (!! __isByteArray(imageBits)) console_printf("imageBits\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4317
#endif
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4318
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4319
fail: ;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4320
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  4321
.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4322
    ^ false
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4323
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  4324
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4325
!XWorkstation methodsFor:'event forwarding'!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4326
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4327
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
  4328
    "forward a buttonMotion event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4329
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4330
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4331
    self buttonMotion:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4332
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4333
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4334
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
  4335
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4336
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4337
    |logicalButton|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4338
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4339
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4340
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4341
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4342
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4343
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4344
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4345
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4346
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4347
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4348
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4349
    logicalButton := buttonTranslation at:button ifAbsent:button.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  4350
3332
a9ada7dccdd6 Comment
Stefan Vogel <sv@exept.de>
parents: 3330
diff changeset
  4351
    "/ special for mouse-wheel implementation
3312
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  4352
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4353
      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
  4354
      ^ self.
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4355
    ].
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4356
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4357
    logicalButton isInteger ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4358
	buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4359
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4360
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4361
    (multiClickTimeDelta notNil and:[lastButtonPressTime notNil]) ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4362
	time < (lastButtonPressTime + multiClickTimeDelta) ifTrue:[
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4363
	    lastButtonPressTime := time.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4364
	    self buttonMultiPress:logicalButton x:x y:y view:view.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4365
	    ^ self.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4366
	].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4367
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4368
    lastButtonPressTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4369
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4370
    view isNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4371
	"/ event arrived, after I destroyed it myself
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4372
	^ self
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4373
    ].
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4374
    logicalButton == 1 ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4375
	activateOnClick == true ifTrue:[
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4376
	    "/ dont raise above an active popup view.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4377
	    (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4378
		view topView raise.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4379
	    ]
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4380
	].
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4381
    ].
3330
85fa3a6ce50d *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3329
diff changeset
  4382
    super buttonPress:logicalButton x:x y:y view:view
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4383
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4384
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4385
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
  4386
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4387
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4388
    |logicalButton|
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4389
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4390
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4391
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4392
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4393
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4394
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4395
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4396
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4397
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4398
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4399
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4400
    logicalButton := buttonTranslation at:button ifAbsent:button.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4401
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4402
    "/ special for HPs mouse-wheel implementation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4403
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4404
      ^ self
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4405
    ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4406
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4407
    logicalButton isInteger ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4408
	buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4409
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4410
    self buttonRelease:logicalButton x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4411
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4412
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4413
clientMessage:targetView type:typeAtom format:format data:data
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4414
    |sensor|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4415
4527
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  4416
    targetView isNil ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4417
	"targetView is gone? Anyway, cannot do anything with this event..."
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4418
	^ self.
4527
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  4419
    ].
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  4420
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4421
    "DND drag&drop protocol"
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4422
    (format == 32 and:[typeAtom == (self atomIDOf:#DndProtocol)]) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4423
	self dndMessage:nil data:data view:targetView.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4424
	^ self.
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4425
    ].
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4426
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4427
    sensor := targetView sensor.
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4428
    "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
  4429
    sensor notNil ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4430
	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
  4431
    ].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4432
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4433
    "Created: 4.4.1997 / 17:49:26 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4434
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4435
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4436
configure:view x:x y:y width:w height:h above:above
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4437
    "forward a size-change event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4438
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  4439
    self configureX:x y:y width:w height:h view:view.
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  4440
    above notNil ifTrue:[
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4441
	|aboveView|
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4442
	aboveView := self viewFromId:above.
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4443
	aboveView notNil ifTrue:[
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4444
	    self coveredBy:aboveView view:view.
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4445
	].
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  4446
     ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4447
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4448
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4449
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
  4450
    "handle a drag&drop protocol message"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4451
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4452
    |sensor property dropType dropValue names i1 i2 propertyType|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4453
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4454
    dropType := data doubleWordAt:1.
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4455
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4456
    "/ see def's in DragAndDropTypes.h
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  4457
    dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4458
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4459
    property := self
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4460
	getProperty:(self atomIDOf:#DndSelection)
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4461
	from:rootId
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4462
	delete:false.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4463
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4464
    propertyType := property key.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4465
    dropValue := property value.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4466
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4467
    "/ preconvert into a collection
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4468
    "/ of fileNames, string or byteArray
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4469
    "/ Notice: we do not yet convert into dropObjects
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4470
    "/ here, to allow arbitrary data to be handled by
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4471
    "/ redefined dropMessage methods in applications.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4472
    "/ Conversion is done for some well known types
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4473
    "/ in the default dropMessage handling of SimpleView.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4474
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4475
    dropType == #DndFiles ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4476
	"/ actually, a list of fileNames
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4477
	propertyType ~~ stringAtom ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4478
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4479
	    ^ self
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4480
	].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4481
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4482
	names := OrderedCollection new.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4483
	i1 := 1.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4484
	[i1 ~~ 0] whileTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4485
	    i2 := dropValue indexOf:(Character value:0) startingAt:i1.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4486
	    i2 ~~ 0 ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4487
		names add:(dropValue copyFrom:i1 to:(i2-1)).
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4488
		i1 := i2 + 1.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4489
	    ] ifFalse:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4490
		i1 := i2
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4491
	    ].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4492
	].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4493
	dropValue := names.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4494
	dropValue := dropValue collect:[:nm | nm asFilename].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4495
	dropType := #files.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4496
    ] ifFalse:[ (dropType == #DndFile) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4497
	propertyType ~~ stringAtom ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4498
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4499
	    ^ self
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4500
	].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4501
	dropValue := dropValue asFilename.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4502
	dropType := #file.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4503
    ] ifFalse:[ (dropType == #DndDir) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4504
	propertyType ~~ stringAtom ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4505
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4506
	    ^ self
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4507
	].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4508
	dropValue := dropValue asFilename.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4509
	dropType := #directory.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4510
    ] ifFalse:[ (dropType == #DndText) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4511
	propertyType ~~ stringAtom ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4512
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4513
	    ^ self
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4514
	].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4515
	dropType := #text.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4516
    ] ifFalse:[ (dropType == #DndExe) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4517
	propertyType ~~ stringAtom ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4518
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4519
	    ^ self
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4520
	].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4521
	dropType := #executable.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4522
    ] ifFalse:[ (dropType == #DndLink) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4523
	propertyType ~~ stringAtom ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4524
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4525
	    ^ self
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4526
	].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4527
	dropType := #link.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4528
    ] ifFalse:[ (dropType == #DndRawData) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4529
	dropType := #rawData.
1552
969fd0309d2a more drop support
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
  4530
    ] ifFalse:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4531
	'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4532
	'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4533
	dropType := #unknown.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4534
    ]]]]]]].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4535
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4536
    sensor := targetView sensor.
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4537
    "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
  4538
    sensor notNil ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
  4539
	sensor dropMessage:dropType data:dropValue view:targetView position:nil handle:nil
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4540
    ].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4541
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4542
    "Created: 4.4.1997 / 17:59:37 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4543
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4544
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4545
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
  4546
    "forward an expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4547
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4548
    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
  4549
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4550
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4551
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4552
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4553
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4554
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4555
focusIn:view mode:mode detail:detail
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4556
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4557
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4558
    self focusInView:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4559
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4560
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4561
focusOut:view mode:mode detail:detail
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4562
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4563
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4564
    self focusOutView:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4565
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4566
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4567
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
  4568
    "forward a graphics-expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4569
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4570
    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
  4571
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4572
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4573
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4574
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4575
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4576
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4577
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
  4578
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4579
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4580
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4581
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4582
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4583
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4584
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4585
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4586
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4587
    key isNil ifTrue:[
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4588
        "/ happens sometimes on some systems
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4589
        "/ (alt-graph on sun has no keysym)
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4590
        ^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4591
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4592
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4593
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4594
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4595
    "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
  4596
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4597
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4598
    self keyPress:commonKey x:x y:y view:view.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4599
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4600
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4601
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
  4602
    "forward a key-release event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4603
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4604
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4605
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4606
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4607
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4608
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4609
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4610
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4611
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4612
    key isNil ifTrue:[
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4613
        "/ happens sometimes on some systems
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4614
        "/ (alt-graph on sun has no keysym)
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4615
        ^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4616
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4617
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4618
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4619
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4620
    "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
  4621
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4622
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4623
    self keyRelease:commonKey x:x y:y view:view.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4624
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4625
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4626
mappingNotify:view request:what event:eB
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4627
    "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4628
     Tell xlib about the fact."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4629
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4630
    (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4631
	self refreshKeyboardMapping:eB.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4632
	"Maybe some of our modifiers have been changed"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4633
	self initializeModifierMappings.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4634
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4635
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4636
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4637
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4638
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
  4639
    "forward a pointer enter event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4640
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4641
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4642
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4643
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4644
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4645
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4646
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4647
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4648
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4649
    self pointerEnter:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4650
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4651
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4652
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
  4653
    "forward a pointer leave event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4654
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4655
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4656
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4657
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4658
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4659
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4660
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4661
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4662
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4663
    self pointerLeave:state view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4664
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4665
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4666
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
  4667
    "sent when an X property changes.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4668
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4669
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4670
    |selectionFetcher|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4671
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4672
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4673
    aView isNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4674
	"event arrived, after aView has been destroyed"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4675
	^ self
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4676
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4677
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4678
"/    '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
  4679
"/    aView propertyChange:atom state:aSymbol.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4680
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  4681
    aSymbol ~~ #newValue ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4682
	"I am not interested in delete notifications"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4683
	^ self.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  4684
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4685
    selectionFetcher := self findSelectionFetcher:aView id.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4686
    selectionFetcher notNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4687
	selectionFetcher message:thisContext message.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4688
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4689
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4690
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4691
selectionClear:aView selection:selectionID time:time
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4692
    "sent when another X-client has created a selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4693
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4694
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4695
    lastEventTime := time.
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4696
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4697
    selectionHandlers notNil ifTrue:[
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4698
	selectionHandlers do:[:eachHandler |
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4699
	    eachHandler selectionClear:selectionID
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4700
	]
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4701
    ].
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4702
!
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4703
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4704
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
  4705
    "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
  4706
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4707
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4708
    |selectionFetcher|
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4709
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4710
"/    Transcript show:'seletionNotify selID:'.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4711
"/    Transcript show:selectionID; show:' ('; show:(self atomName:selectionID); show:') '.
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4712
"/    Transcript show:' targetID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4713
"/    Transcript show:targetID; show:' ('; show:(self atomName:targetID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4714
"/    Transcript show:' propertyID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4715
"/    Transcript show:propertyID; show:' ('; show:(self atomName:propertyID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4716
"/    Transcript showCR:''.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4717
"/    Transcript endEntry.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4718
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4719
    lastEventTime := time.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4720
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4721
    aView isNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4722
	"event arrived, after aView has been destroyed"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4723
	^ self
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4724
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4725
    selectionFetcher := self findSelectionFetcher:aView id.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4726
    selectionFetcher notNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4727
	selectionFetcher message:thisContext message.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4728
    ].
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4729
!
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4730
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4731
selectionRequest:aView requestor:requestorID selection:selectionID target:targetID property:propertyID time:time
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4732
    "sent by some other X-client to ask for the selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4733
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4734
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4735
    |selection property|
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4736
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4737
"/'Selection: ' print. (self atomName:selectionID) print. ' TargetId: ' print. (self atomName:targetID) print.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4738
"/' Property: ' print. (self atomName:propertyID) print. ' Requestor: ' print. requestorID printCR.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4739
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4740
    lastEventTime := time.
4282
b487fe05c51d Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents: 4280
diff changeset
  4741
    selection := self copyBufferAs:targetID.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4742
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4743
"/'Send selection: ' print. selection printCR.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4744
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4745
    property := propertyID.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4746
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4747
    selection isNil ifTrue:[
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4748
	"sending property None tells the client,
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4749
	 that I could not convert"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4750
"/        ('XWorkstation: unsupported selection target ', (self atomName:targetID)) errorPrintCR.
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4751
	property := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4752
    ] ifFalse:[
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4753
	property == 0 ifTrue:[
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4754
	    "Support old (obsolete) clients requesting a None property.
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4755
	     Set the propertyID to the targetID"
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4756
	    property := targetID.
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4757
	].
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4758
	self setProperty:property
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4759
	     type:targetID
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4760
	     value:selection
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4761
	     for:requestorID.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4762
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4763
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  4764
    self sendNotifySelection:selectionID
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4765
	 property:property
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4766
	 target:targetID
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4767
	 time:time
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  4768
	 to:requestorID.
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4769
!
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4770
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4771
visibilityNotify:aView state:how
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4772
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4773
    aView notNil ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4774
	aView visibilityChange:how
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4775
    ]
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4776
! !
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4777
3886
538d4ca3a587 method category rename
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4778
!XWorkstation methodsFor:'event forwarding-ignored events'!
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4779
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4780
circulateNotify:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4781
    "sent, when the stacking order changes.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4782
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4783
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4784
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4785
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4786
circulateRequest:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4787
    "sent, when the stacking order is about to change.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4788
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4789
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4790
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4791
colorMapNotify:aView state:aBoolean
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4792
    "sent, when another colormap is installed.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4793
     This is a very X-specific mechanism."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4794
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4795
    aView isNil ifTrue:[
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4796
	"/ event arrived, after I destroyed it myself
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4797
	^ self
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4798
    ].
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4799
    "/ not yet implemented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4800
    "/ aView colorMapChange
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4801
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4802
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4803
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4804
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
  4805
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4806
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4807
    "/ view configureRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4808
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4809
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4810
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4811
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4812
gravityNotify:aView x:x y:y
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4813
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4814
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4815
    "/ aView gravityNotify
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4816
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4817
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4818
keymapNotify:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4819
    "ignore for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4820
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4821
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4822
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4823
mapRequest:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4824
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4825
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4826
    "/ aView mapRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4827
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4828
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4829
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4830
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4831
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4832
reparentedView:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4833
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4834
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4835
    "/ aView reparented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4836
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4837
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4838
resizeRequest:aView width:width height:height
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4839
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4840
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4841
    "/ aView resizeRequest
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4842
! !
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4843
86
032006651226 *** empty log message ***
claus
parents: 83
diff changeset
  4844
!XWorkstation methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4845
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4846
defaultEventMask
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4847
    "return a mask to enable some events by default."
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4848
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4849
%{  /* NOCONTEXT */
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4850
    RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask |
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4851
			 KeyPressMask | KeyReleaseMask |
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4852
			 PointerMotionMask |
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4853
			 EnterWindowMask | LeaveWindowMask |
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4854
			 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask |
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4855
			 PropertyChangeMask ));
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4856
%}
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4857
!
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4858
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4859
dispatchEvent:evArray
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4860
    |viewId view evType arguments|
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4861
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4862
    viewId := evArray at:1.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4863
    viewId notNil ifTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4864
	viewId = lastId ifTrue:[
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4865
	    view := lastView
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4866
	] ifFalse:[
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4867
	    view := self viewFromId:viewId
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4868
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4869
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4870
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4871
    evType := evArray at:3.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4872
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4873
    (self respondsTo:evType) ifTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4874
	arguments := evArray copyFrom:3 to:(3 + evType numArgs - 1).
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4875
	arguments at:1 put:view.
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4876
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4877
	self perform:evType withArguments:arguments.
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4878
	^ true.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4879
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4880
'********** unhandled event:' errorPrintCR.
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4881
evType errorPrintCR. (evArray at:2) errorPrintCR.
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4882
'********** see dispatchEvent' errorPrintCR.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4883
    ^ false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4884
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4885
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4886
dispatchEventFor:aViewIdOrNil withMask:eventMask
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4887
    "central event handling method:
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4888
     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
  4889
     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
  4890
     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
  4891
     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
  4892
     handled.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4893
     WARNING: this may block to wait for an event - you better check for a
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4894
	      pending event before calling this."
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4895
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4896
    |eventArray|
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4897
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4898
    eventArray := Array new:13.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4899
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4900
    (self getEventFor:aViewIdOrNil withMask:eventMask into:eventArray) ifTrue:[
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4901
	AbortOperationRequest handle:[:ex |
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4902
	    ex return
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4903
	] do:[
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4904
	    self dispatchEvent:eventArray.
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4905
	]
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4906
    ].
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4907
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4908
    "Modified: 19.8.1997 / 17:10:42 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4909
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4910
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4911
dispatchExposeEventFor:aViewIdOrNil
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4912
    "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
  4913
     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
  4914
     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
  4915
     WARNING: this may block to wait for an event - you better check for a
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4916
	      pending event before calling this."
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4917
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4918
    self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4919
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4920
    "Modified: 19.8.1997 / 17:10:26 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4921
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4922
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4923
dispatchLoop
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4924
    preWaitAction := [self flush].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4925
    Processor addPreWaitAction:preWaitAction.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4926
    [
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4927
	super dispatchLoop
3778
77a339649f30 Remove preWaitACtion if dispatchLoop is finished.
Stefan Vogel <sv@exept.de>
parents: 3758
diff changeset
  4928
    ] ensure:[
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4929
	Processor removePreWaitAction:preWaitAction.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4930
	preWaitAction := nil.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4931
    ].
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4932
!
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4933
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4934
dispatchPendingEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4935
    "central event handling method for modal operation.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4936
     (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
  4937
     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
  4938
     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
  4939
     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
  4940
     we only handle exposes until the graphicsExpose arrives.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4941
     Other systems may not need such a kludge"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4942
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4943
    "interested in exposes only ?"
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  4944
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  4945
    |eventArray|
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  4946
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4947
    dispatchingExpose notNil ifTrue:[
4469
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4948
	[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4949
	    self dispatchExposeEventFor:dispatchingExpose
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4950
	].
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4951
	^ self
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4952
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4953
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  4954
    eventArray := Array new:13.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4955
    [self eventPendingWithSync:false] whileTrue:[
4469
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4956
	(self getEventFor:nil withMask:nil into:eventArray) ifTrue:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4957
	    AbortOperationRequest handle:[:ex |
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4958
		ex return
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4959
	    ] do:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4960
		self dispatchEvent:eventArray.
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4961
		"/ multi-screen config: give others a chance
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4962
		"/ (needed because we run at high (non-timesliced) prio)
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4963
		Processor yield.
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4964
	    ]
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  4965
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4966
    ]
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4967
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4968
    "Modified: 19.8.1997 / 17:11:18 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4969
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4970
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4971
disposeEventsWithMask:aMask for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4972
    "dispose (throw away) specific events. If aWindowId is nil,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4973
     events matching the mask are thrown away regardless of which
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4974
     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
  4975
     view are flushed."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4976
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4977
    <context: #return>
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  4978
%{ /* UNLIMITEDSTACK */
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4979
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4980
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4981
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4982
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4983
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4984
     && __isSmallInteger(aMask)) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4985
	Display *dpy = myDpy;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4986
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4987
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4988
	if (__isExternalAddress(aWindowIdOrNil)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4989
	    win = __WindowVal(aWindowIdOrNil);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4990
	    while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4991
	} else {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4992
	    while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4993
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4994
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4995
	RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4996
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4997
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4998
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4999
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5000
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5001
eventMaskFor:anEventSymbol
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5002
    "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
  5003
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5004
%{  /* NOCONTEXT */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5005
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5006
    int m = 0;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5007
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5008
    if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5009
    else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5010
    else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5011
    else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5012
    else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5013
    else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5014
    else if (anEventSymbol == @symbol(expose)) m = ExposureMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5015
    else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5016
    else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5017
    else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5018
    else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5019
    else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5020
    else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5021
    else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5022
    else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5023
    else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5024
    RETURN (__MKSMALLINT(m));
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5025
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5026
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5027
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5028
eventPending
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5029
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5030
     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
  5031
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5032
    "/ ConservativeSync is required for some Xlib implementation,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5033
    "/ 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
  5034
    "/ (especially Win32 & Xlib)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5035
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5036
    ConservativeSync == true ifTrue:[self sync].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5037
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5038
    dispatchingExpose notNil ifTrue:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5039
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5040
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5041
    ^ self eventPendingWithSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5042
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5043
    "Modified: / 28.4.1999 / 11:08:12 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5044
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5045
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5046
eventPending:anEventSymbol for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5047
    "return true, if a specific event is pending"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5048
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5049
    ^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5050
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5051
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5052
eventPending:anEventMask for:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5053
    "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
  5054
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5055
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5056
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5057
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5058
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5059
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5060
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5061
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5062
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5063
    if (ISCONNECTED && __isSmallInteger(anEventMask)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5064
	Display *dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5065
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5066
	ENTER_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5067
	if (doSync == true) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5068
	    XSync(dpy, 0);      /* make certain everything is flushed */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5069
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5070
	if (__isExternalAddress(aWindowIdOrNil)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5071
	    win = __WindowVal(aWindowIdOrNil);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5072
	    thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5073
	} else {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5074
	    thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5075
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5076
	if (thereIsOne) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5077
	    XPutBackEvent(dpy, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5078
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5079
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5080
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5081
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5082
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5083
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5084
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5085
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5086
eventPendingWithSync:doSync
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5087
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5088
     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
  5089
     before checking."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5090
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5091
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5092
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5093
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5094
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5095
    if (ISCONNECTED) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5096
	Display *dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5097
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5098
	if (XEventsQueued(dpy, QueuedAlready)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5099
	    RETURN (true);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5100
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5101
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5102
	ENTER_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5103
	if (doSync == true) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5104
	    XSync(dpy, 0);      /* make certain everything is flushed */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5105
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5106
	if (XPending(dpy)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5107
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5108
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5109
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5110
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5111
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5112
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5113
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5114
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5115
eventQueued
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5116
    "return true, if any event is queued"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5117
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5118
    dispatchingExpose notNil ifTrue:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5119
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5120
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5121
    ^ self eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5122
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5123
    "Created: 12.12.1995 / 21:43:00 / stefan"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5124
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5125
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5126
eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5127
    "return true, if any event is queued internally.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5128
     (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
  5129
      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
  5130
      the display connection)."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5131
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5132
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5133
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5134
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5135
    if (ISCONNECTED) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5136
	/* ENTER ... LEAVE not needed; XEventsQueued will not block */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5137
	/* ENTER_XLIB(); */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5138
	if (XEventsQueued(myDpy, QueuedAlready)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5139
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5140
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5141
	/* LEAVE_XLIB(); */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5142
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5143
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5144
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5145
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5146
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5147
exposeEventPendingFor:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5148
    "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
  5149
     or any view (if the arg is nil).
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5150
     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
  5151
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5152
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5153
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5154
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5155
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5156
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5157
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5158
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5159
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5160
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5161
    if (ISCONNECTED) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5162
	Display *dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5163
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5164
	ENTER_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5165
	if (doSync == true) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5166
	    XSync(dpy, 0);      /* make certain everything is flushed */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5167
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5168
	if (__isExternalAddress(aWindowIdOrNil)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5169
	    win = __WindowVal(aWindowIdOrNil);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5170
	    thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5171
	} else {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5172
	    thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5173
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5174
	if (thereIsOne) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5175
	    XPutBackEvent(dpy, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5176
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5177
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5178
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5179
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5180
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5181
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5182
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5183
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5184
getEventFor:aViewIdOrNil withMask:eventMask into:anEventArray
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5185
    "read next event if there is one and put events data into anEventArray.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5186
     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
  5187
     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
  5188
     Returns true, if there was an event, false otherwise.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5189
     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
  5190
     before calling for it.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5191
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5192
     The event fields are placed them into anEventArray (must be at least size 13):
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5193
     the fields are:
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5194
	1:      windowID
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5195
	2:      eventType-ID
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5196
	3:      eventTypeSymbol
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5197
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5198
	4..     args
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5199
3948
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  5200
     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
  5201
     handler method to allow UNLIMITEDSTACK here.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5202
     (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
  5203
      #dispatchEvent:, since it dispatches out into ST-methods).
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5204
    "
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5205
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5206
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5207
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5208
    Display *dpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5209
    Window win, wWanted;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5210
    int evMask, returnValue;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5211
    XEvent ev;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5212
    OBJ eB;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5213
    KeySym keySym;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5214
    unsigned char buffer[10];
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5215
    int i, nchars;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5216
    char *keySymString;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5217
    char keySymStringBuffer[32];
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5218
    OBJ arg, sym, t, windowID;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5219
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5220
    if (! ISCONNECTED) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5221
	RETURN (false);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5222
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5223
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5224
    dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5225
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5226
    ev.type = 0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5227
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5228
    if (__isSmallInteger(eventMask)) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5229
	evMask = __intVal(eventMask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5230
    } else {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5231
	evMask = ~0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5232
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5233
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5234
    if (__isExternalAddress(aViewIdOrNil)) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5235
	wWanted = __WindowVal(aViewIdOrNil);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5236
	returnValue = XCheckWindowEvent(dpy, wWanted, evMask, &ev);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5237
    } else {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5238
	if (evMask == ~0) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5239
	    XNextEvent(dpy, &ev);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5240
	    returnValue = 1;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5241
	} else {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5242
	    returnValue = XCheckMaskEvent(dpy, evMask, &ev);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5243
	}
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5244
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5245
    if (!returnValue) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5246
	/* there is no event */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5247
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5248
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5249
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5250
    if (anEventArray == nil) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5251
	/* sender is not interested in the event */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5252
	RETURN(true);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5253
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5254
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5255
    if (!__isArray(anEventArray)) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5256
	console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5257
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5258
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5259
    if (__arraySize(anEventArray) < 11) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5260
	console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5261
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5262
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5263
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5264
#   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5265
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5266
#   define ae ((XAnyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5267
#   define ee ((XExposeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5268
#   define ke ((XKeyPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5269
#   define be ((XButtonPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5270
#   define ce ((XConfigureEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5271
#   define cr ((XConfigureRequestEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5272
#   define me ((XMotionEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5273
#   define ele ((XCrossingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5274
#   define de ((XDestroyWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5275
#   define ve ((XVisibilityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5276
#   define fe ((XFocusChangeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5277
#   define cre ((XCreateWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5278
#   define mape ((XMappingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5279
#   define gre ((XGravityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5280
#   define rr ((XResizeRequestEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5281
#   define cie ((XCirculateEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5282
#   define pe ((XPropertyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5283
#   define sce ((XSelectionClearEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5284
#   define cme ((XColormapEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5285
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5286
    if (((t = __INST(lastId)) != nil)
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5287
	 && __isExternalAddress(t)
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5288
	 && (__WindowVal(t) == ae->window)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5289
	windowID = t;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5290
    } else {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5291
	windowID = __MKEXTERNALADDRESS(ae->window);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5292
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5293
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5294
    __ArrayInstPtr(anEventArray)->a_element[0] = windowID; __STORE(anEventArray, windowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5295
    __ArrayInstPtr(anEventArray)->a_element[1] = __MKSMALLINT(ev.type);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5296
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5297
    switch (ev.type) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5298
	case KeyRelease:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5299
	    sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5300
	    goto keyPressAndRelease;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5301
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5302
	case KeyPress:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5303
	    sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5304
	    /* FALL INTO */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5305
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5306
	keyPressAndRelease:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5307
	    arg = nil;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5308
	    nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5309
	    if (nchars
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5310
	     && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5311
		 || (buffer[0] >= 0x80))) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5312
		arg = __MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5313
		keySymString = NULL;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5314
	    } else {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5315
		keySymString = XKeysymToString(keySym);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5316
		if (keySymString) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5317
		    arg = __MKSYMBOL(keySymString, 0);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5318
		} else {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5319
		    arg = nil;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5320
		}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5321
	    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5322
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5323
#ifdef IGNORE_UNKNOWN_KEYCODES
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5324
	    if (arg == nil) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5325
		/* happens sometimes (alt-graph on sun has no keysym) */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5326
		RETURN (false);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5327
	    }
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5328
#endif
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5329
	    __ArrayInstPtr(anEventArray)->a_element[2] = sym;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5330
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5331
	    __ArrayInstPtr(anEventArray)->a_element[3] = arg; __STORE(anEventArray, arg);
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5332
	    t = __MKUINT(ke->keycode); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5333
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ke->state);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5334
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ke->x);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5335
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ke->y);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5336
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ke->x_root);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5337
	    __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ke->y_root);
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5338
	    t = __MKUINT(ke->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5339
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5340
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5341
	case ButtonPress:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5342
	    sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5343
	    goto buttonPressAndRelease;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5344
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5345
	case ButtonRelease:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5346
	    sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5347
	    /* fall into */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5348
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5349
	buttonPressAndRelease:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5350
	    __ArrayInstPtr(anEventArray)->a_element[2] = sym;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5351
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(be->button);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5352
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ke->state);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5353
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(be->x);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5354
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(be->y);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5355
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(be->x_root);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5356
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(be->y_root);
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5357
	    t = __MKUINT(be->time); __ArrayInstPtr(anEventArray)->a_element[9] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5358
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5359
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5360
	case MotionNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5361
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(buttonMotion:state:x:y:rootX:rootY:time:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5362
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5363
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(me->state);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5364
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(me->x);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5365
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(me->y);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5366
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(me->x_root);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5367
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(me->y_root);
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5368
	    t = __MKUINT(me->time); __ArrayInstPtr(anEventArray)->a_element[8] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5369
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5370
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5371
	case FocusIn:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5372
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusIn:mode:detail:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5373
	    goto focusInOut;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5374
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5375
	case FocusOut:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5376
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusOut:mode:detail:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5377
	    /* fall into */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5378
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5379
	focusInOut:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5380
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(fe->mode);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5381
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(fe->detail);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5382
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5383
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5384
	case EnterNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5385
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerEnter:x:y:rootX:rootY:state:mode:detail:time:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5386
	    goto enterLeave;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5387
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5388
	case LeaveNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5389
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerLeave:x:y:rootX:rootY:state:mode:detail:time:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5390
	    /* fall into */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5391
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5392
	enterLeave:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5393
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ele->x);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5394
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ele->y);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5395
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ele->x_root);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5396
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ele->y_root);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5397
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ele->state);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5398
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ele->mode);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5399
	    __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ele->detail);
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5400
	    t = __MKUINT(ele->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5401
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5402
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5403
	case Expose:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5404
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(expose:x:y:width:height:count:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5405
	    goto expose;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5406
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5407
	case GraphicsExpose:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5408
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(graphicsExpose:x:y:width:height:count:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5409
	    /* fall into */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5410
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5411
	expose:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5412
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ee->x);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5413
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ee->y);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5414
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ee->width);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5415
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ee->height);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5416
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ee->count);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5417
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5418
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5419
	case NoExpose:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5420
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(noExposeView:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5421
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5422
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5423
	case VisibilityNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5424
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(visibilityNotify:state:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5425
	    switch (ve->state) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5426
		case VisibilityUnobscured:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5427
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(unobscured);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5428
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5429
		case VisibilityPartiallyObscured:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5430
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(partiallyObscured);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5431
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5432
		case VisibilityFullyObscured:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5433
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(fullyObscured);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5434
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5435
		default:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5436
		    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(ve->state);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5437
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5438
	    }
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5439
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5440
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5441
	case CreateNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5442
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(createWindow:x:y:width:height:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5443
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cre->x);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5444
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cre->y);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5445
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cre->width);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5446
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cre->height);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5447
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5448
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5449
	case DestroyNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5450
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(destroyedView:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5451
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5452
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5453
	case UnmapNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5454
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unmappedView:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5455
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5456
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5457
	case MapNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5458
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappedView:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5459
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5460
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5461
	case ConfigureNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5462
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configure:x:y:width:height:above:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5463
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ce->x);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5464
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ce->y);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5465
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ce->width);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5466
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ce->height);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5467
	    __ArrayInstPtr(anEventArray)->a_element[7] = nil;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5468
	    if (ce->above != None) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5469
		t = __MKEXTERNALADDRESS(ce->above); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5470
	    }
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5471
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5472
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5473
	case GravityNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5474
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(gravityNotify:x:y:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5475
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(gre->x);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5476
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(gre->y);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5477
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5478
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5479
	case ResizeRequest:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5480
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(resizeRequest:width:height:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5481
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(rr->width);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5482
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rr->height);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5483
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5484
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5485
	case ConfigureRequest:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5486
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configureRequest:x:y:width:height:above:detail:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5487
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cr->x);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5488
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cr->y);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5489
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cr->width);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5490
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cr->height);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5491
	    __ArrayInstPtr(anEventArray)->a_element[7] = nil;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5492
	    if (cr->above != None) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5493
		t = __MKEXTERNALADDRESS(cr->above); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5494
	    }
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5495
	    switch (cr->detail) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5496
		case Above:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5497
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(above);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5498
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5499
		case Below:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5500
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(below);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5501
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5502
		case TopIf:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5503
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(topIf);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5504
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5505
		case BottomIf:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5506
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(bottomIf);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5507
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5508
		case Opposite:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5509
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(opposite);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5510
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5511
		default:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5512
		    __ArrayInstPtr(anEventArray)->a_element[8] = __MKSMALLINT(cr->detail);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5513
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5514
	    }
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5515
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5516
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5517
	case CirculateNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5518
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateNotify:place:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5519
	    goto circulate;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5520
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5521
	case CirculateRequest:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5522
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateRequest:place:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5523
	    /* fall into */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5524
	circulate:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5525
	    switch (cie->place) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5526
		case PlaceOnTop:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5527
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnTop);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5528
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5529
		case PlaceOnBottom:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5530
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnBottom);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5531
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5532
		default:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5533
		    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(cie->place);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5534
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5535
	    }
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5536
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5537
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5538
	case PropertyNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5539
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(propertyChange:property:state:time:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5540
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(pe->atom);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5541
	    switch (pe->state) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5542
		case PropertyNewValue:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5543
		    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(newValue);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5544
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5545
		case PropertyDelete:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5546
		    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(deleted);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5547
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5548
		default:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5549
		    __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(pe->state);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5550
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5551
	    }
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5552
	    t = __MKUINT(pe->time); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5553
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5554
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5555
	case SelectionClear:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5556
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionClear:selection:time:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5557
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(sce->selection);
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5558
	    t = __MKUINT(sce->time); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5559
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5560
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5561
	case SelectionRequest:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5562
	    /*
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5563
	     * someone wants the selection
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5564
	     */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5565
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:);
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5566
	    t = __MKEXTERNALADDRESS(ev.xselectionrequest.requestor); __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5567
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselectionrequest.selection);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5568
	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselectionrequest.target);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5569
	    __ArrayInstPtr(anEventArray)->a_element[6] = __MKATOMOBJ(ev.xselectionrequest.property);
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5570
	    t = __MKUINT(ev.xselectionrequest.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5571
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5572
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5573
	case SelectionNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5574
	    /*
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5575
	     * returned selection value (answer from SelectionRequest)
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5576
	     */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5577
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5578
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xselection.selection);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5579
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselection.target);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5580
	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselection.property);
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5581
	    t = __MKEXTERNALADDRESS(ev.xselection.requestor); __ArrayInstPtr(anEventArray)->a_element[6] = t; __STORE(anEventArray, t);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5582
	    t = __MKUINT(ev.xselection.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5583
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5584
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5585
	case ColormapNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5586
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(colormapNotify:state:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5587
	    __ArrayInstPtr(anEventArray)->a_element[3] = cme->state == ColormapInstalled ? true : false;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5588
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5589
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5590
	case ClientMessage:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5591
	    if (ev.xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5592
		if ((ev.xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom)))
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5593
		 || (ev.xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5594
		    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(terminateView:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5595
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5596
		}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5597
		if (ev.xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5598
		    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(saveAndTerminateView:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5599
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5600
		}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5601
	    }
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5602
	    /*
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5603
	     * any other client message
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5604
	     */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5605
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(clientMessage:type:format:data:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5606
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xclient.message_type);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5607
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(ev.xclient.format);
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5608
	    t = __MKBYTEARRAY(ev.xclient.data, sizeof(ev.xclient.data)); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5609
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5610
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5611
	case MappingNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5612
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappingNotify:request:event:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5613
	    switch(mape->request) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5614
		case MappingModifier:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5615
		    arg = @symbol(mappingModifier);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5616
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5617
		case MappingKeyboard:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5618
		    arg = @symbol(mappingKeyboard);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5619
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5620
		case MappingPointer:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5621
		    arg = @symbol(mappingPointer);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5622
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5623
		default:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5624
		    arg = __MKSMALLINT(mape->request);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5625
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5626
	    }
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5627
	    __ArrayInstPtr(anEventArray)->a_element[3] = arg;
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  5628
	    t = __MKBYTEARRAY(&ev, sizeof(*mape)); __ArrayInstPtr(anEventArray)->a_element[4] = t;
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5629
	    __STORE(anEventArray, t);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5630
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5631
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5632
	case KeymapNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5633
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(keymapNotify:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5634
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5635
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5636
	case MapRequest:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5637
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mapRequest:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5638
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5639
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5640
	case ReparentNotify:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5641
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(reparentedView:);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5642
	    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5643
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5644
	default:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5645
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unknownX11Event);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5646
	    break;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5647
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5648
#undef ae
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5649
#undef ee
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5650
#undef ke
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5651
#undef be
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5652
#undef ce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5653
#undef cr
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5654
#undef cre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5655
#undef cle
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5656
#undef gre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5657
#undef me
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5658
#undef ewe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5659
#undef ele
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5660
#undef lwe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5661
#undef de
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5662
#undef mape
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5663
#undef ve
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5664
#undef fe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5665
#undef rr
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5666
#undef pe
3799
65c6905e1250 Instvar eventbuffer no longer needed
Stefan Vogel <sv@exept.de>
parents: 3798
diff changeset
  5667
#undef cie
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5668
#undef sce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5669
#undef cme
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5670
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5671
%}.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5672
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5673
    ^ true
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5674
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5675
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5676
handleAllEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5677
    "from now on, handle any kind of event"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5678
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5679
    dispatchingExpose := nil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5680
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5681
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5682
handleExposeOnlyFor:aView
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5683
    "from now on, handle expose events only"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5684
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5685
    dispatchingExpose := aView id
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5686
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5687
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5688
setEventMask:aMask in:aWindowId
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5689
    "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
  5690
     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
  5691
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5692
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5693
%{
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5694
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5695
    int mask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5696
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5697
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5698
     && __isExternalAddress(aWindowId)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5699
     && __isSmallInteger(aMask)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5700
	mask = __intVal(aMask);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5701
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5702
#ifdef OLD
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5703
	/* these may not be disabled */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5704
	mask |= ExposureMask | StructureNotifyMask |
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5705
		KeyPressMask | KeyReleaseMask |
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5706
		EnterWindowMask | LeaveWindowMask |
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5707
		ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5708
#endif
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5709
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5710
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5711
	XSelectInput(myDpy, __WindowVal(aWindowId), mask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5712
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5713
	RETURN ( self );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5714
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5715
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5716
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5717
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5718
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5719
startDispatch
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5720
    "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
  5721
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5722
    dispatching ifTrue:[^ self].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5723
    dispatchingExpose := nil.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5724
    super startDispatch
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5725
! !
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5726
3885
f00086641b23 method category rename
Claus Gittinger <cg@exept.de>
parents: 3883
diff changeset
  5727
!XWorkstation methodsFor:'event handling-old dispatch'!
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5728
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5729
buttonPress:button x:x y:y view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5730
    "forward a button-press event for some view"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5731
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5732
    aView isNil ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5733
	"/ event arrived, after I destroyed it myself
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5734
	^ self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5735
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5736
    button == 1 ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5737
	activateOnClick == true ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5738
	    "/ dont raise above an active popup view.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5739
	    (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5740
		aView topView raise.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5741
"/            ] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5742
"/                activeKeyboardGrab printCR.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5743
"/                activePointerGrab printCR.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5744
	    ]
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5745
	].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5746
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5747
    super buttonPress:button x:x y:y view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5748
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5749
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5750
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5751
! !
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5752
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5753
!XWorkstation methodsFor:'event sending'!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5754
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5755
sendClientEvent:msgType format:msgFormat to:targetWindowID data1:d1 data2:d2 data3:d3 data4:d4 data5:d5
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5756
    "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
  5757
     The client message gets message_type and msgFormat as specified by
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5758
     the arguments. The additional data arguments specify up to
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5759
     5 longWords of user data; each may be an integer or nil.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5760
     It is passed transparently in the events data field.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5761
     See XProtocol specification for more details."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5762
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5763
    "/ Event.xclient.type              = ClientMessage;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5764
    "/ Event.xclient.display           = dpy;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5765
    "/ Event.xclient.message_type      = msgType;
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5766
    "/ Event.xclient.format            = msgFormat;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5767
    "/ Event.xclient.window            = targetWindowID;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5768
    "/ Event.xclient.data.l[0]         = d1
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5769
    "/ Event.xclient.data.l[1]         = d2
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5770
    "/ Event.xclient.data.l[2]         = d3
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5771
    "/ Event.xclient.data.l[3]         = d4
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5772
    "/ Event.xclient.data.l[4]         = d5
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5773
    "/
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5774
    "/ XSendEvent(dpy,DispatchWindow,True,NoEventMask,&Event);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5775
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5776
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5777
%{
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5778
    int type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5779
    int state;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5780
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5781
    if (ISCONNECTED
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5782
     && __isInteger(msgType)
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5783
     && __isInteger(msgFormat)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5784
     && (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5785
	Display *dpy = myDpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5786
	XEvent ev;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5787
	Status result;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5788
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5789
	if (__isInteger(d1)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5790
	    ev.xclient.data.l[0] = __longIntVal(d1);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5791
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5792
	    if (__isExternalAddress(d1)) {
4401
Claus Gittinger <cg@exept.de>
parents: 4400
diff changeset
  5793
		ev.xclient.data.l[0] = (INT)__externalAddressVal(d1);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5794
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5795
		ev.xclient.data.l[0] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5796
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5797
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5798
	if (__isInteger(d2)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5799
	    ev.xclient.data.l[1] = __longIntVal(d2);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5800
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5801
	    if (__isExternalAddress(d2)) {
4401
Claus Gittinger <cg@exept.de>
parents: 4400
diff changeset
  5802
		ev.xclient.data.l[1] = (INT)__externalAddressVal(d2);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5803
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5804
		ev.xclient.data.l[1] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5805
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5806
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5807
	if (__isInteger(d3)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5808
	    ev.xclient.data.l[2] = __longIntVal(d3);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5809
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5810
	    if (__isExternalAddress(d3)) {
4401
Claus Gittinger <cg@exept.de>
parents: 4400
diff changeset
  5811
		ev.xclient.data.l[2] = (INT)__externalAddressVal(d3);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5812
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5813
		ev.xclient.data.l[2] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5814
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5815
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5816
	if (__isInteger(d4)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5817
	    ev.xclient.data.l[3] = __longIntVal(d4);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5818
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5819
	    if (__isExternalAddress(d4)) {
4401
Claus Gittinger <cg@exept.de>
parents: 4400
diff changeset
  5820
		ev.xclient.data.l[3] = (INT)__externalAddressVal(d4);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5821
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5822
		ev.xclient.data.l[3] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5823
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5824
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5825
	if (__isInteger(d5)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5826
	    ev.xclient.data.l[4] = __longIntVal(d5);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5827
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5828
	    if (__isExternalAddress(d5)) {
4401
Claus Gittinger <cg@exept.de>
parents: 4400
diff changeset
  5829
		ev.xclient.data.l[4] = (INT)__externalAddressVal(d5);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5830
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5831
		ev.xclient.data.l[4] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5832
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5833
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5834
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5835
	if (__isExternalAddress(targetWindowID)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5836
	    ev.xclient.window = __WindowVal(targetWindowID);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5837
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5838
	    ev.xclient.window = (Window)__longIntVal(targetWindowID);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5839
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5840
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5841
	ev.xclient.type              = ClientMessage;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5842
	ev.xclient.display           = dpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5843
	ev.xclient.message_type      = __longIntVal(msgType);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5844
	ev.xclient.format            = __longIntVal(msgFormat);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5845
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5846
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5847
	result = XSendEvent(dpy, ev.xclient.window, True, NoEventMask , &ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5848
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5849
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5850
	if ((result == BadValue) || (result == BadWindow)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5851
	    DPRINTF(("bad status in sendClientEvent\n"));
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5852
	    RETURN ( false )
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5853
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5854
	RETURN (true)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5855
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5856
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5857
    self primitiveFailedOrClosedConnection.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5858
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5859
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5860
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5861
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
  5862
    "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
  5863
     TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5864
     For buttonEvents, the keySymCodeOrButtonNr must be the buttons number (1, 2 ...);
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5865
     for key events, it can be either a symbol (as listen in X's keySyms)
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5866
     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
  5867
     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
  5868
     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
  5869
     (not very user friendly)"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5870
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5871
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5872
%{
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5873
    int type;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5874
    int state;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5875
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5876
    if (__isSmallInteger(stateMask)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5877
	state = __intVal(stateMask);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5878
    } else {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5879
	state = 0;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5880
    }
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5881
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5882
    if (ISCONNECTED
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5883
     && __isSmallInteger(xPos) && __isSmallInteger(yPos)
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5884
     && (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr))
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5885
     && (__isExternalAddress(targetId) || __isInteger(targetId))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5886
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5887
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5888
	XEvent ev;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5889
	Window target;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5890
	Status result;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5891
	KeySym keySym, *syms;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5892
	int screen = __intVal(__INST(screen));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5893
	char s[2];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5894
	int nSyms;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5895
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5896
	if ((typeSymbol == @symbol(keyPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5897
	 || (typeSymbol == @symbol(keyRelease))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5898
	    if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5899
		keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5900
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5901
		if (__isCharacter(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5902
		    s[0] = __intVal(__characterVal(keySymCodeOrButtonNr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5903
		    s[1] = '\0';
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5904
		    keySym = XStringToKeysym(s);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5905
		} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5906
		    keySym = (KeySym) __intVal(keySymCodeOrButtonNr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5907
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5908
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5909
	    ev.xkey.keycode = XKeysymToKeycode(dpy, keySym);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5910
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5911
	    if (stateMask == nil) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5912
		/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5913
		 * get the modifier from the keySym
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5914
		 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5915
		nSyms = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5916
		syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5917
		if (syms) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5918
		    int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5919
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5920
		    for (i=0; i<nSyms; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5921
			if (syms[i] == keySym) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5922
#ifdef MODIFIERDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5923
			    console_printf("modifier-index is %d\n", i);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5924
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5925
			    if (i) state = (1 << (i-1));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5926
			    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5927
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5928
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5929
		    XFree(syms);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5930
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5931
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5932
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5933
	    if ((typeSymbol == @symbol(buttonPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5934
	     || (typeSymbol == @symbol(buttonRelease))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5935
		if (__isSmallInteger(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5936
		    ev.xbutton.button = __intVal(keySymCodeOrButtonNr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5937
		} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5938
		    ev.xbutton.button = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5939
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5940
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5941
		DPRINTF(("invalid sendEvent typeSymbol\n"));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5942
		RETURN (false);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5943
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5944
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5945
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5946
	if (typeSymbol == @symbol(keyPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5947
	    ev.xany.type = KeyPress;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5948
	else if (typeSymbol == @symbol(keyRelease))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5949
	    ev.xany.type = KeyRelease;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5950
	else if (typeSymbol == @symbol(buttonPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5951
	    ev.xany.type = ButtonPress;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5952
	else if (typeSymbol == @symbol(buttonRelease))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5953
	    ev.xany.type = ButtonRelease;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5954
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5955
	if (__isExternalAddress(targetId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5956
	    target = __WindowVal(targetId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5957
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5958
	    target = (Window) __longIntVal(targetId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5959
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5960
	ev.xkey.window = target;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5961
	ev.xkey.same_screen = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5962
	ev.xkey.subwindow = 0;
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  5963
	ev.xkey.root = RootWindow(dpy, screen);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5964
	ev.xkey.x = __intVal(xPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5965
	ev.xkey.y = __intVal(yPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5966
	ev.xkey.state = state;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5967
	ev.xkey.time = CurrentTime;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5968
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5969
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5970
	result = XSendEvent(dpy, target, False, 0 , &ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5971
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5972
	if ((result == BadValue) || (result == BadWindow)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5973
	    DPRINTF(("bad status\n"));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5974
	    RETURN ( false )
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5975
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5976
	RETURN (true)
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5977
    }
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5978
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5979
    self primitiveFailedOrClosedConnection.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5980
    ^ false
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5981
! !
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5982
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5983
!XWorkstation methodsFor:'font stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5984
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5985
createFontFor:aFontName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5986
    "a basic method for X-font allocation; this method allows
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5987
     any font to be aquired (even those not conforming to
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5988
     standard naming conventions, such as cursor, fixed or k14)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5989
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5990
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5991
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5992
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5993
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5994
    XFontStruct *newFont;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5995
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5996
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5997
     && __isNonNilObject(aFontName)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5998
     && (__qIsString(aFontName) || __qIsSymbol(aFontName))) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5999
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6000
	ENTER_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6001
	newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6002
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  6003
#ifdef COUNT_RESOURCES
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6004
	if (newFont)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6005
	    __cnt_font++;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6006
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6007
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6008
	RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6009
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6010
%}.
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  6011
    "/ --- disabled due to UNLIMITEDSTACK -- self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6012
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6013
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6014
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6015
decomposeXFontName:aString into:aBlock
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6016
    "extract family, face, style and size from an
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6017
     X-font name
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6018
     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
  6019
      -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
  6020
     evaluate aBlock with these"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6021
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6022
    |family face style moreStyle fheight size
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6023
     resX resY registry encoding coding fields|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6024
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6025
    aString isNil ifTrue:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6026
    fields := aString asCollectionOfSubstringsSeparatedBy:$-.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6027
    fields size == 3 ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6028
	"take care of old font names: family-style-size"
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6029
	family := fields at:1.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6030
	style := fields at:2.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6031
	size := Number readFromString:(fields at:3) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6032
    ] ifFalse:[fields size == 2 ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6033
	"take care of old font names: family-size"
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6034
	family := fields at:1.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6035
	size := Number readFromString:(fields at:2) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6036
    ] ifFalse:[fields size >= 15 ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6037
	family := fields at:3.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6038
	face := fields at:4.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6039
	style := fields at:5.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6040
	style = 'o' ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6041
	    style := 'oblique'
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6042
	] ifFalse:[style = 'i' ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6043
	     style := 'italic'
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6044
	] ifFalse:[style = 'r' ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6045
	     style := 'roman'
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6046
	]]].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6047
	moreStyle := fields at:6.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6048
	(moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6049
	    style := style, '-', moreStyle.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6050
	].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6051
	fheight := fields at:8.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6052
	size := (Number readFromString:(fields at:9) onError:[^ false]) / 10.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6053
	resX := fields at:10.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6054
	resY := fields at:11.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6055
	registry := fields at:14.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6056
	encoding := fields at:15.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6057
	coding := registry , '-' , encoding.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6058
    ] ifFalse:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  6059
	^ false
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6060
    ]]].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6061
    aBlock value:family value:face value:style value:size value:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6062
    ^ true
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6063
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6064
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6065
encodingOf:aFontId
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6066
    "the fonts encoding - if the font does not provide that info,
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6067
     return nil (and assume #ascii, which is a subset of #iso8859)."
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6068
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6069
    |props reg enc coll|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6070
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6071
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6072
    reg := props at:#'CHARSET_REGISTRY' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6073
    enc := props at:#'CHARSET_ENCODING' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6074
    coll := props at:#'CHARSET_COLLECTIONS' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6075
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6076
    reg notNil ifTrue:[ reg := self atomName:reg].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6077
    enc notNil ifTrue:[ enc := self atomName:enc].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6078
    coll notNil ifTrue:[ coll := self atomName:coll].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6079
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6080
    ^ self extractEncodingFromRegistry:reg encoding:enc charSetCollections:coll
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6081
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6082
     "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6083
       Screen current encodingOf:Screen current getDefaultFont
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6084
     "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6085
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6086
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6087
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
  6088
    "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
  6089
     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
  6090
     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
  6091
     This is pure magic ..."
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6092
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6093
    |enc charSets|
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6094
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6095
    (registry size ~~ 0) ifTrue:[
4469
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6096
	enc := registry asLowercase.
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6097
	encoding size ~~ 0 ifTrue:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6098
	   enc := enc, '-', encoding asLowercase.
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6099
	].
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6100
	enc := enc asSymbol.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6101
    ] ifFalse:[
4469
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6102
	(encoding size ~~ 0) ifTrue:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6103
	    enc := encoding asLowercase asSymbol
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6104
	] ifFalse:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6105
	    charSets := charSetCollections.
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6106
	    (charSets notEmptyOrNil) ifTrue:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6107
		charSets := charSets asUppercase asCollectionOfWords.
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6108
		(charSets includes:'ISO8859-1') ifTrue:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6109
		    enc := #'iso8859-1'
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6110
		] ifFalse:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6111
		    (charSets includes:'ISO8859') ifTrue:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6112
			enc := #iso8859
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6113
		    ] ifFalse:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6114
			(charSets includes:'ASCII') ifTrue:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6115
			    enc := #ascii
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6116
			] ifFalse:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6117
			    (charSets includes:'ADOBE-STANDARD') ifTrue:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6118
				enc := #iso8859
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6119
			    ]
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6120
			]
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6121
		    ]
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6122
		]
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6123
	    ]
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
  6124
	]
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6125
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6126
    ^  enc
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6127
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6128
    "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
  6129
    "Modified: 17.4.1996 / 17:22:35 / cg"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6130
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6131
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6132
flushListOfAvailableFonts
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6133
    "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
  6134
     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
  6135
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6136
    listOfXFonts := nil
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6137
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6138
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6139
     Display flushListOfAvailableFonts.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6140
     Display listOfAvailableFonts
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6141
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6142
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6143
    "Modified: 27.9.1995 / 10:54:47 / stefan"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6144
    "Created: 20.2.1996 / 22:55:52 / cg"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6145
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6146
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6147
fontDescriptionFromXFontName:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6148
    "extract family, face, style and size from an
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6149
     X-font name
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6150
     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
  6151
      -brand-family-face-style-moreStyle- -height-size-resX-resY-??-??-registry-encoding;
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6152
     evaluate aBlock with these"
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6153
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6154
    |family face style moreStyle fheight size
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6155
     resX resY registry encoding coding fields|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6156
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6157
    aFontNameString isNil ifTrue:[^ nil].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6158
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6159
    Error handle:[:ex |
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6160
	family := nil.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6161
    ] do:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6162
	fields := aFontNameString asCollectionOfSubstringsSeparatedBy:$-.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6163
	fields size == 3 ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6164
	    "take care of old font names: family-style-size"
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6165
	    family := fields at:1.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6166
	    style := fields at:2.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6167
	    size := Number readFromString:(fields at:3).
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6168
	] ifFalse:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6169
	    fields size == 2 ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6170
		"take care of old font names: family-size"
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6171
		family := fields at:1.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6172
		size := Number readFromString:(fields at:2).
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6173
	    ] ifFalse:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6174
		fields size >= 15 ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6175
		    family := fields at:3.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6176
		    face := fields at:4.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6177
		    style := fields at:5.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6178
		    style = 'o' ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6179
			style := 'oblique'
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6180
		    ] ifFalse:[style = 'i' ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6181
			 style := 'italic'
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6182
		    ] ifFalse:[style = 'r' ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6183
			 style := 'roman'
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6184
		    ]]].
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6185
		    moreStyle := fields at:6.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6186
		    (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6187
			style := style, '-', moreStyle.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6188
		    ].
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6189
		    fheight := fields at:8.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6190
		    size := (Number readFromString:(fields at:9)) / 10.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6191
		    resX := fields at:10.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6192
		    resY := fields at:11.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6193
		    registry := fields at:14.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6194
		    encoding := fields at:15.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6195
		    coding := registry , '-' , encoding.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6196
		] ifFalse:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6197
		    "/ very old name (such as cursor, 5x7 etc)
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6198
		]
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6199
	    ]
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6200
	].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6201
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6202
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6203
    family notNil ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6204
       ^ FontDescription family:family face:face style:style size:size encoding:coding.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6205
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6206
    ^ FontDescription name:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6207
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6208
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6209
     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
  6210
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6211
!
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6212
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6213
fontMetricsOf:fontId
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6214
    "return a fonts metrics info object"
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6215
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6216
    <context: #return>
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6217
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6218
    |info avgAscent avgDescent minCode maxCode dir
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6219
     maxAscent maxDescent minWidth maxWidth avgWidth|
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6220
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  6221
%{  /* UNLIMITEDSTACK */
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6222
    XFontStruct *f;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6223
    int len;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6224
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6225
    if (ISCONNECTED) {
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6226
	if (__isExternalAddress(fontId)) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6227
	    f = __FontVal(fontId);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6228
	    if (f) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6229
		minCode = __MKUINT((f->min_byte1<<8) + f->min_char_or_byte2);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6230
		maxCode = __MKUINT((f->max_byte1<<8) + f->max_char_or_byte2);
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6231
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6232
		if (f->direction == FontLeftToRight) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6233
		    dir = @symbol(LeftToRight);
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6234
		} else if (f->direction == FontRightToLeft) {
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6235
		    dir = @symbol(RightToLeft);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6236
		}
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6237
		avgDescent = __MKSMALLINT(f->descent);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6238
		avgAscent = __MKSMALLINT(f->ascent);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6239
		avgDescent = __MKSMALLINT(f->descent);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6240
		maxAscent = __MKSMALLINT(f->max_bounds.ascent);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6241
		maxDescent = __MKSMALLINT(f->max_bounds.descent);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6242
		minWidth = __MKSMALLINT(f->min_bounds.width);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6243
		maxWidth = __MKSMALLINT(f->max_bounds.width);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6244
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6245
		ENTER_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6246
		len = XTextWidth(f, " ", 1);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6247
		LEAVE_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6248
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6249
		avgWidth = __MKSMALLINT( len );
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6250
	    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6251
	}
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6252
    }
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6253
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6254
    avgAscent == nil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6255
	self primitiveFailedOrClosedConnection.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6256
	^ nil
3670
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6257
    ].
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6258
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6259
    "DingBats font returns 0 for maxAscent/maxDescent"
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6260
    maxAscent := maxAscent max:avgAscent.
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6261
    maxDescent := maxDescent max:avgDescent.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6262
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6263
    info := DeviceWorkstation::DeviceFontMetrics new.
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6264
    info
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6265
      ascent:avgAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6266
      descent:avgDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6267
      maxAscent:maxAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6268
      maxDescent:maxDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6269
      minWidth:minWidth
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6270
      maxWidth:maxWidth
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6271
      avgWidth:avgWidth
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6272
      minCode:minCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6273
      maxCode:maxCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6274
      direction:dir.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6275
    ^ info
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6276
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6277
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6278
     Screen current fontMetricsOf:(View defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6279
     CharacterSetView openOn:(View defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6280
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6281
     Screen current fontMetricsOf:(MenuView defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6282
     CharacterSetView openOn:(MenuView defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6283
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6284
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6285
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6286
fontProperties:propertyNames of:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6287
    "Answer an array with selected property values of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6288
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6289
     PropertyNames is an array with property names (symbols or strings).
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6290
     Nonexistant properties are returned as nil"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6291
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6292
    |props|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6293
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6294
    props := self fontPropertiesOf:aFontId.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6295
    ^ propertyNames collect:[:propName | props at:propName ifAbsent:nil].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6296
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6297
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6298
     Screen current
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6299
	fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' #'RESOLUTION' notExistant)
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6300
	of:Screen current getDefaultFont
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6301
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6302
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6303
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6304
fontPropertiesOf:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6305
    "Answer an array with all the properties of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6306
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6307
     Odd indices contain the property name (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6308
     Even indices contain the property value (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6309
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6310
     Answer nil, if there are no properties"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6311
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6312
    |propsArray result|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6313
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6314
%{
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6315
    XFontStruct *f;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6316
    XFontProp *prop;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6317
    int n, i;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6318
    OBJ x;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6319
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6320
    if (__isExternalAddress(aFontId)) {
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6321
	f = __FontVal(aFontId);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6322
	if (f && (prop = f->properties) != 0) {
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6323
	    n = f->n_properties;
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6324
	    propsArray = __ARRAY_NEW_INT(n*2);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6325
	    for (i = 0; n; n--, prop++) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6326
		x = __MKUINT(prop->name); __ArrayInstPtr(propsArray)->a_element[i++] = x; __STORE(propsArray, x);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6327
		x = __MKUINT(prop->card32); __ArrayInstPtr(propsArray)->a_element[i++] = x; __STORE(propsArray, x);
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6328
	    }
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6329
	}
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6330
    }
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6331
%}.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6332
    result := Dictionary new.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6333
    propsArray notNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6334
	propsArray pairWiseDo:[:n :v | result at:(self atomName:n) put:v].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6335
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6336
    ^ result
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6337
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6338
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6339
     Screen current fontPropertiesOf:Screen current getDefaultFont
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6340
     Dictionary withKeysAndValues:(Screen current fontPropertiesOf:Screen current getDefaultFont)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6341
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6342
     |d|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6343
     d := Dictionary new.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6344
     (Screen current fontPropertiesOf:Screen current getDefaultFont) pairWiseDo:[:name :value|
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6345
	  d at:((Screen current atomName:name) ? name) put:value
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6346
     ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6347
     d
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6348
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6349
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6350
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6351
fontResolutionOf:fontId
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6352
    "return the resolution (as dpiX @ dpiY) of the font - this is usually the displays resolution,
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6353
     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
  6354
     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
  6355
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6356
    |props res resX resY|
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6357
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6358
    props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6359
    resX := props at:1.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6360
    resY := props at:2.
1046
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  6361
    (resX notNil and:[resY notNil]) ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6362
	^ resX @ resY
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6363
    ].
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6364
    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
  6365
    res notNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6366
	^ res @ res
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6367
    ].
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6368
    ^ self resolution
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6369
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6370
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6371
      Screen current fontResolutionOf:(Screen current getDefaultFont)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6372
    "
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6373
!
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6374
3417
88c4df032e94 Fix possible botch in #rootWindowId.
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  6375
fullFontNameOf:aFontId
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6376
    "the fonts fullName - this is very device specific and should only be
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6377
     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
  6378
     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
  6379
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6380
    |props fullName|
4012
956fc93c6381 fontName
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  6381
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6382
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6383
    #('FONT' 'FONT_NAME' 'FULL_NAME' 'FULLNAME' ) do:[:try |
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6384
	|fullNameID|
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6385
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6386
	fullNameID := props at:try ifAbsent:nil.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6387
	fullNameID notNil ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6388
	    fullName := self atomName:fullNameID.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6389
	    fullName notEmptyOrNil ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6390
		^ fullName
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6391
	    ].
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6392
	]
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6393
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6394
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6395
    ^ nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6396
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6397
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6398
     Screen current fullFontNameOf:(Screen current getDefaultFont)
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6399
    "
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6400
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6401
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6402
getAvailableFontsMatching:pattern
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6403
    "return an Array filled with font names matching aPattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6404
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6405
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6406
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6407
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6408
3801
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6409
    int nnames = 15000;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6410
    int available = nnames + 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6411
    char **fonts;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6412
    OBJ arr, str;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6413
    int i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6414
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6415
    if (ISCONNECTED) {
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6416
	if (__isString(pattern)) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6417
	    for (;;) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6418
		ENTER_XLIB();
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6419
		fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6420
		LEAVE_XLIB();
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6421
		if (fonts == 0) RETURN(nil);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6422
		if (available < nnames) break;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6423
		XFreeFontNames(fonts);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6424
		nnames = available * 2;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6425
	    }
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6426
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6427
	    /*
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6428
	     * now, that we know the number of font names,
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6429
	     * create the array ...
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6430
	     */
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6431
	    arr = __ARRAY_NEW_INT(available);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6432
	    if (arr != nil) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6433
		/*
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6434
		 * ... and fill it
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6435
		 */
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6436
		for (i=0; i<available; i++) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6437
		    __PROTECT__(arr);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6438
		    str = __MKSTRING(fonts[i]);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6439
		    __UNPROTECT__(arr);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6440
		    __ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6441
		}
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6442
	    }
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6443
	    XFreeFontNames(fonts);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6444
	    RETURN (arr);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6445
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6446
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6447
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6448
    ^ nil
3801
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6449
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6450
    "
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6451
      Screen current getAvailableFontsMatching:'*'
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6452
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6453
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6454
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6455
getDefaultFont
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6456
    "return a default font id - used when class Font cannot
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6457
     find anything usable"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6458
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6459
     ^ self createFontFor:'fixed'
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6460
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6461
     "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6462
       Screen current getDefaultFont
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6463
     "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6464
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6465
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6466
getFontWithFamily:familyString face:faceString
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6467
	    style:styleArgString size:sizeArg encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6468
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6469
    "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
  6470
     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
  6471
     as family and the other parameters as nil. For example, the cursor font
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6472
     can be aquired that way."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6473
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6474
    |styleString theName theId xlatedStyle
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6475
     id spacing encodingMatch idx roundedSize|
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6476
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6477
    styleString := styleArgString.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6478
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6479
    sizeArg notNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6480
	roundedSize := sizeArg rounded asInteger.
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6481
    ].
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6482
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6483
    "special: if face is nil, allow access to X-fonts"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6484
    faceString isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6485
	roundedSize notNil ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6486
	    theName := familyString , '-' , roundedSize printString
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6487
	] ifFalse:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6488
	    theName := familyString
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6489
	].
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6490
	theName isNil ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6491
	    "
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6492
	     mhmh - fall back to the default font
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6493
	    "
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6494
	    theName := 'fixed'
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6495
	].
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6496
	theId := self createFontFor:theName.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6497
	theId isNil ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6498
	    theId := self getDefaultFont
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6499
	].
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6500
	^ theId
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6501
    ].
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6502
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6503
    "/ 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
  6504
    "/ in style
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6505
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  6506
    (styleString notNil
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6507
     and:[(styleString endsWith:'-narrow')
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6508
	  or:[styleString endsWith:'-semicondensed']]) ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6509
	|i|
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6510
	i := styleString lastIndexOf:$-.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6511
	spacing := styleString copyFrom:(i+1).
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6512
	styleString := styleString copyTo:(i-1).
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6513
    ] ifFalse:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6514
	spacing := 'normal'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6515
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6516
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6517
    xlatedStyle := styleString.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6518
    xlatedStyle notNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6519
	xlatedStyle := xlatedStyle first asString
3449
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  6520
    ].
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  6521
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6522
    encoding isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6523
	encodingMatch := '*-*'.
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6524
    ] ifFalse:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6525
	idx := encoding indexOf:$-.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6526
	idx ~~ 0 ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6527
	    encodingMatch := encoding
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6528
	] ifFalse:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6529
	    encodingMatch := encoding , '-*'.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6530
	].
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6531
    ].
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6532
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6533
    id := self
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6534
	    getFontWithFoundry:'*'
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6535
	    family:familyString asLowercase
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6536
	    weight:faceString
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6537
	    slant:xlatedStyle
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6538
	    spacing:spacing
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6539
	    pixelSize:nil
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6540
	    size:roundedSize
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6541
	    encoding:encodingMatch.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6542
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6543
    id isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6544
	(encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6545
	    "/ too stupid: registries come in both cases
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6546
	    "/ and X does not ignore case
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6547
	    "/
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6548
	    id := self
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6549
		    getFontWithFoundry:'*'
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6550
		    family:familyString asLowercase
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6551
		    weight:faceString
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6552
		    slant:xlatedStyle
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6553
		    spacing:spacing
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6554
		    pixelSize:nil
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6555
		    size:roundedSize
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6556
		    encoding:encodingMatch asUppercase.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6557
	    id isNil ifTrue:[
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6558
		id := self
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6559
			getFontWithFoundry:'*'
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6560
			family:familyString asLowercase
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6561
			weight:faceString
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6562
			slant:xlatedStyle
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6563
			spacing:spacing
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6564
			pixelSize:nil
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6565
			size:roundedSize
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6566
			encoding:encodingMatch asLowercase.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6567
	    ]
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6568
	]
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6569
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6570
    ^ id
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6571
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6572
    "Modified: 4.7.1996 / 11:38:47 / stefan"
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6573
    "Modified: 10.4.1997 / 19:20:06 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6574
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6575
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6576
getFontWithFoundry:foundry family:family weight:weight
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6577
	      slant:slant spacing:spc pixelSize:pSize size:size
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6578
	      encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6579
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6580
    "get the specified font, if not available, return nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6581
     This is the new font creation method - all others will be changed to
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6582
     use this entry.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6583
     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
  6584
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6585
     foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6586
     family:  'helvetica' 'courier' 'times' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6587
     weight:  'bold' 'medium' 'demi' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6588
     slant:   'r(oman)' 'i(talic)' 'o(blique)'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6589
     spacing: 'narrow' 'normal' semicondensed' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6590
     pixelSize: 16,18 ... usually left empty
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6591
     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
  6592
     encoding:  iso8859-*, iso8859-1, iso10646-1 ... '*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6593
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6594
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6595
    |theName sizeMatch
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6596
     foundryMatch familyMatch weightMatch slantMatch spcMatch
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6597
     pSizeMatch encodingMatch|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6598
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6599
    "this works only on 'Release >= 3' - X-servers"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6600
    "name is:
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6601
	-foundry-family    -weight -slant-
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6602
	 sony    helvetica bold     r
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6603
	 adobe   courier   medium   i
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6604
	 msic    fixed              o
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6605
	 ...     ...
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6606
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6607
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6608
    size isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6609
	sizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6610
    ] ifFalse:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6611
	sizeMatch := size printString , '0'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6612
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6613
    foundry isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6614
	foundryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6615
    ] ifFalse:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6616
	foundryMatch := foundry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6617
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6618
    family isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6619
	familyMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6620
    ] ifFalse:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6621
	familyMatch := family
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6622
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6623
    weight isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6624
	weightMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6625
    ] ifFalse:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6626
	weightMatch := weight
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6627
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6628
    slant isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6629
	slantMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6630
    ] ifFalse:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6631
	slantMatch := slant
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6632
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6633
    spc isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6634
	spcMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6635
    ] ifFalse:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6636
	spcMatch := spc
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6637
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6638
    pSize isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6639
	pSizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6640
    ] ifFalse:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6641
	pSizeMatch := pSize printString
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6642
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6643
    encoding isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6644
	encodingMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6645
    ] ifFalse:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6646
	encodingMatch := encoding
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6647
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6648
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6649
    theName := ('-' , foundryMatch,
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6650
		'-' , familyMatch,
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6651
		'-' , weightMatch ,
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6652
		'-' , slantMatch ,
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6653
		'-' , spcMatch ,
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6654
		'-*' ,
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6655
		'-' , pSizeMatch ,
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6656
		'-' , sizeMatch ,
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6657
		'-*-*-*-*' ,
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6658
		'-' , encodingMatch).
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6659
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 652
diff changeset
  6660
"/  Transcript showCR:theName; endEntry.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6661
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6662
    ^ self createFontFor:theName.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6663
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6664
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6665
    "
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6666
     Display
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6667
	getFontWithFoundry:'*'
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6668
	family:'courier'
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6669
	weight:'medium'
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6670
	slant:'r'
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6671
	spacing:nil
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6672
	pixelSize:nil
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6673
	size:13
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6674
	encoding:'iso8859-*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6675
    "
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6676
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6677
    "Modified: 10.4.1997 / 19:15:44 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6678
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6679
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6680
listOfAvailableFonts
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6681
    "return a list with all available fonts on this display.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6682
     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
  6683
     next time. The elements of the returned collection are instances of
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6684
     FontDescription."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6685
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6686
    |names|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6687
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6688
    listOfXFonts isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6689
	names := self getAvailableFontsMatching:'*'.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6690
	names isNil ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6691
	    "no names returned ..."
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6692
	    ^ nil
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6693
	].
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  6694
	listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6695
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6696
    ^ listOfXFonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6697
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6698
    "
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6699
     Display flushListOfAvailableFonts.
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  6700
     Display listOfAvailableFonts.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  6701
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6702
     Display getAvailableFontsMatching:'*'.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6703
     Display getAvailableFontsMatching:'fixed'.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6704
     Display fontsInFamily:'fixed' filtering:nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6705
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6706
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6707
    "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
  6708
    "Modified: 17.4.1996 / 15:27:57 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6709
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6710
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6711
releaseFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6712
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6713
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6714
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6715
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6716
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  6717
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  6718
     * 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
  6719
     */
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6720
    if (! ISCONNECTED) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6721
	RETURN ( self );
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6722
    }
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6723
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6724
    if (__isExternalAddress(aFontId)) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6725
	f = __FontVal(aFontId);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6726
	if (f) {
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6727
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6728
	    ENTER_XLIB();
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6729
	    XFreeFont(myDpy, f);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6730
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  6731
#ifdef COUNT_RESOURCES
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6732
	    __cnt_font--;
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6733
#endif
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6734
	}
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  6735
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6736
    }
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6737
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6738
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6739
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6740
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6741
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6742
    "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
  6743
     on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6744
     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
  6745
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6746
    |sizes|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6747
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  6748
    sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6749
    (sizes notNil and:[sizes includes:0]) ifTrue:[
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  6750
	"special: in X11R5 and above, size 0 means:
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  6751
	 there are scaled versions in all sizes available"
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  6752
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  6753
	^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6754
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6755
    ^ sizes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6756
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6757
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6758
     Display sizesInFamily:'courier' face:'bold' style:'roman'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6759
    "
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  6760
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  6761
    "Created: 27.2.1996 / 01:38:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6762
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6763
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6764
widthOf:aString from:index1 to:index2 inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6765
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6766
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  6767
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  6768
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6769
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6770
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6771
    char *cp;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6772
    int len, n, i1, i2, l;
447
9a58924e921b dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6773
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6774
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6775
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  6776
    int nInstBytes;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6777
    int directionReturn, fontAscentReturn, fontDescentReturn;
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6778
    XCharStruct overAllReturn;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6779
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6780
    if (ISCONNECTED) {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6781
	if (__bothSmallInteger(index1, index2)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6782
	 && __isExternalAddress(aFontId)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6783
	 && __isNonNilObject(aString)) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6784
	    int lMax = __intVal(@global(MaxStringLength));
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6785
	    f = __FontVal(aFontId);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6786
	    if (! f) goto fail;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6787
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6788
	    i1 = __intVal(index1) - 1;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6789
	    cls = __qClass(aString);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6790
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6791
	    if (i1 >= 0) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6792
		i2 = __intVal(index2) - 1;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6793
		if (i2 < i1) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6794
		    RETURN ( __MKSMALLINT(0) );
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6795
		}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6796
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6797
		cp = (char *) __stringVal(aString);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6798
		l = i2 - i1 + 1;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6799
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6800
		if ((cls == @global(String)) || (cls == @global(Symbol))) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6801
		    n = __stringSize(aString);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6802
		    if (i2 < n) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6803
			cp += i1;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6804
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6805
#if 0
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6806
			ENTER_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6807
			len = XQueryTextExtents(myDpy, f->fid, cp, l,
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6808
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6809
						&overAllReturn);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6810
			LEAVE_XLIB();
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  6811
			console_printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6812
#endif
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6813
			ENTER_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6814
			len = XTextWidth(f, cp, l);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6815
			LEAVE_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6816
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6817
			RETURN ( __MKSMALLINT(len) );
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6818
		    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6819
		}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6820
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6821
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6822
		cp += nInstBytes;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6823
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6824
		if (__isBytes(aString)) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6825
		    n = __byteArraySize(aString) - nInstBytes;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6826
		    if (i2 < n) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6827
			cp += i1;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6828
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6829
			ENTER_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6830
			len = XTextWidth(f, cp, l);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6831
			LEAVE_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6832
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6833
			RETURN ( __MKSMALLINT(len) );
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6834
		    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6835
		}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6836
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6837
		/* TWOBYTESTRINGS */
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6838
		if (__isWords(aString)) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6839
		    n = (__byteArraySize(aString) - nInstBytes) / 2;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6840
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6841
		    if (i2 < n) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6842
			union {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6843
			    char b[2];
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6844
			    unsigned short s;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6845
			} u;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6846
			int i;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6847
			XChar2b *cp2 = (XChar2b *)0;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6848
			int mustFree = 0;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6849
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6850
			cp += (i1 * 2);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6851
			if (l > lMax) l = lMax;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6852
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6853
			/*
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6854
			 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6855
			 * X expects them MSB first
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6856
			 * convert as required
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6857
			 */
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6858
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6859
			u.s = 0x1234;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6860
			if (u.b[0] != 0x12) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6861
			    if (l <= NLOCALBUFFER) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6862
				cp2 = xlatebuffer;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6863
			    } else {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6864
				cp2 = (XChar2b *)(malloc(l * 2));
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6865
				mustFree = 1;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6866
			    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6867
			    for (i=0; i<l; i++) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6868
				cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6869
				cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6870
			    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6871
			    cp = (char *) cp2;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6872
			}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6873
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6874
			ENTER_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6875
			len = XTextWidth16(f, (XChar2b *)cp, l);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6876
			LEAVE_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6877
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6878
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6879
			if (mustFree) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6880
			    free(cp2);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6881
			}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6882
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6883
			RETURN ( __MKSMALLINT(len) );
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6884
		    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6885
		}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6886
		/* FOURBYTESTRINGS */
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6887
		if (__isLongs(aString)) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6888
		    int i;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6889
		    XChar2b *cp2;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6890
		    int mustFree = 0;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6891
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6892
		    n = (__byteArraySize(aString) - nInstBytes) / 4;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6893
		    if (i2 < n) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6894
			union {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6895
			    char b[2];
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6896
			    unsigned short s;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6897
			} u;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6898
			int i;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6899
			XChar2b *cp2 = (XChar2b *)0;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6900
			int mustFree = 0;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6901
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6902
			cp += (i1 * 4);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6903
			if (l > lMax) l = lMax;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6904
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6905
			/*
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6906
			 * For now: X does not support 32bit characters without the new 32Unicode extensions.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6907
			 * For now, treat chars above 0xFFFF as 0xFFFF (should we use default-char ?).
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6908
			 */
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6909
			if (l <= NLOCALBUFFER) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6910
			    cp2 = xlatebuffer;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6911
			} else {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6912
			    cp2 = (XChar2b *)(malloc(l * 2));
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6913
			    mustFree = 1;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6914
			}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6915
			for (i=0; i<l; i++) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6916
			    int codePoint;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6917
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6918
			    codePoint = ((unsigned int32 *)cp)[i];
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6919
			    if (codePoint > 0xFFFF) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6920
				codePoint = 0xFFFF;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6921
			    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6922
			    cp2[i].byte1 = codePoint & 0xFF;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6923
			    cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6924
			}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6925
			cp = (char *) cp2;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6926
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6927
			ENTER_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6928
			len = XTextWidth16(f, (XChar2b *)cp, l);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6929
			LEAVE_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6930
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6931
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6932
			if (mustFree) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6933
			    free(cp2);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6934
			}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6935
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6936
			RETURN ( __MKSMALLINT(len) );
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6937
		    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6938
		}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6939
	    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6940
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6941
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6942
#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
  6943
fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6944
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6945
    self primitiveFailedOrClosedConnection.
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  6946
    ^ 0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6947
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6948
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6949
widthOf:aString inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6950
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6951
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  6952
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  6953
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6954
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6955
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6956
    char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6957
    int len, n;
447
9a58924e921b dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6958
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6959
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6960
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  6961
    int nInstBytes;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6962
    int directionReturn, fontAscentReturn, fontDescentReturn;
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6963
    XCharStruct overAllReturn;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6964
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6965
    if (ISCONNECTED) {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6966
	if (__isExternalAddress(aFontId)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6967
	 && __isNonNilObject(aString)) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6968
	    int lMax = __intVal(@global(MaxStringLength));
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6969
	    f = __FontVal(aFontId);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6970
	    if (! f) goto fail;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6971
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6972
	    cls = __qClass(aString);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6973
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6974
	    cp = (char *) __stringVal(aString);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6975
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6976
	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6977
		n = __stringSize(aString);
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6978
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6979
#if 0
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6980
		ENTER_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6981
		len = XQueryTextExtents(myDpy, f->fid, cp, n,
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6982
					&directionReturn, &fontAscentReturn, &fontDescentReturn,
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6983
					&overAllReturn);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6984
		LEAVE_XLIB();
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  6985
		console_printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6986
#endif
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6987
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6988
		ENTER_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6989
		len = XTextWidth(f, cp, n);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6990
		LEAVE_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6991
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6992
		RETURN ( __MKSMALLINT(len) );
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6993
	    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6994
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6995
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6996
	    cp += nInstBytes;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6997
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6998
	    if (__isBytes(aString)) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6999
		n = __byteArraySize(aString) - nInstBytes;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7000
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7001
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7002
		ENTER_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7003
		len = XTextWidth(f, cp, n);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7004
		LEAVE_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7005
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7006
		RETURN ( __MKSMALLINT(len) );
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7007
	    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7008
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7009
	    /* TWOBYTESTRINGS */
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7010
	    if (__isWords(aString)) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7011
		union {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7012
		    char b[2];
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7013
		    unsigned short s;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7014
		} u;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7015
		int i;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7016
		XChar2b *cp2;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7017
		int mustFree = 0;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7018
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7019
		n = (__byteArraySize(aString) - nInstBytes) / 2;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7020
		if (n > lMax) n = lMax;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7021
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7022
		/*
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7023
		 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7024
		 * X expects them MSB first
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7025
		 * convert as required
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7026
		 */
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7027
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7028
		u.s = 0x1234;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7029
		if (u.b[0] != 0x12) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7030
		    if (n <= NLOCALBUFFER) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7031
			cp2 = xlatebuffer;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7032
		    } else {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7033
			cp2 = (XChar2b *)(malloc(n * 2));
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7034
			mustFree = 1;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7035
		    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7036
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7037
		    for (i=0; i<n; i++) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7038
			cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7039
			cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7040
		    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7041
		    cp = (char *) cp2;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7042
		}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7043
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7044
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7045
		ENTER_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7046
		len = XTextWidth16(f, (XChar2b *)cp, n);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7047
		LEAVE_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7048
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7049
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7050
		if (mustFree) {
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7051
		    free(cp2);
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7052
		}
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7053
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7054
		RETURN ( __MKSMALLINT(len) );
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7055
	    }
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7056
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7057
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7058
#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
  7059
  fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  7060
%}.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  7061
    ^ super widthOf:aString inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7062
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7063
3177
8aa3c800394a category rename
Claus Gittinger <cg@exept.de>
parents: 3146
diff changeset
  7064
!XWorkstation methodsFor:'grabbing'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7065
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7066
allowEvents:mode
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7067
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7068
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7069
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7070
    int _mode, ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7071
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7072
    if (mode == @symbol(asyncPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7073
	_mode = AsyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7074
    else if (mode == @symbol(syncPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7075
	_mode = SyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7076
    else if (mode == @symbol(asyncKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7077
	_mode = AsyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7078
    else if (mode == @symbol(syncKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7079
	_mode = SyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7080
    else if (mode == @symbol(syncBoth))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7081
	_mode = SyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7082
    else if (mode == @symbol(asyncBoth))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7083
	_mode = AsyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7084
    else if (mode == @symbol(replayPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7085
	_mode = ReplayPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7086
    else if (mode == @symbol(replayKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7087
	_mode = ReplayKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7088
    else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7089
	ok = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7090
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7091
    if (ok
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7092
     && ISCONNECTED) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7093
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7094
	XAllowEvents(myDpy, _mode, CurrentTime);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7095
	LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7096
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7097
	RETURN (self);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7098
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7099
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7100
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7101
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7102
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7103
grabKeyboardIn:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7104
    "grab the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7105
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7106
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7107
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7108
    int result, ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7109
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7110
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7111
	if (__isExternalAddress(aWindowId)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7112
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7113
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7114
	    result = XGrabKeyboard(myDpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7115
				   __WindowVal(aWindowId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7116
				   True /* False */,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7117
				   GrabModeAsync,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7118
				   GrabModeAsync,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7119
				   CurrentTime);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7120
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7121
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7122
	    ok = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7123
	    switch(result) {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7124
		case AlreadyGrabbed:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7125
		    if (@global(ErrorPrinting) == true) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  7126
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7127
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7128
		    break;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7129
		case GrabNotViewable:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7130
		    if (@global(ErrorPrinting) == true) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  7131
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7132
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7133
		    break;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7134
		case GrabInvalidTime:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7135
		    if (@global(ErrorPrinting) == true) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  7136
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7137
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7138
		    break;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7139
		case GrabFrozen:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7140
		    if (@global(ErrorPrinting) == true) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  7141
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7142
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7143
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7144
		default:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7145
		    ok = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7146
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7147
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7148
	    if (! ok) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7149
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7150
		XUngrabKeyboard(myDpy, CurrentTime);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7151
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7152
		RETURN (false);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7153
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7154
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7155
	    RETURN ( true );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7156
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7157
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  7158
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7159
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7160
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7161
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7162
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7163
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
  7164
    "grap the pointer - return true if ok"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7165
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7166
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7167
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7168
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7169
    int result, ok, evMask;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7170
    Window confineWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7171
    Cursor curs;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7172
    int pointer_mode, keyboard_mode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7173
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7174
    if (ISCONNECTED) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7175
	if (__isExternalAddress(aWindowId)) {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7176
	    if (__isExternalAddress(confineId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7177
		confineWin = __WindowVal(confineId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7178
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7179
		confineWin = (Window) None;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7180
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7181
	    if (__isExternalAddress(aCursorId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7182
		curs = __CursorVal(aCursorId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7183
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7184
		curs = (Cursor) None;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7185
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7186
	    if (pMode == @symbol(sync))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7187
		pointer_mode = GrabModeSync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7188
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7189
		pointer_mode = GrabModeAsync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7190
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7191
	    if (kMode == @symbol(sync))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7192
		keyboard_mode = GrabModeSync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7193
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7194
		keyboard_mode = GrabModeAsync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7195
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7196
	    if (__isSmallInteger(eventMask))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7197
		evMask = __intVal(eventMask);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7198
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7199
		evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7200
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7201
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7202
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7203
	    ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7204
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7205
	    result = XGrabPointer(myDpy,
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7206
				  __WindowVal(aWindowId),
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7207
				  False,
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7208
				  evMask,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7209
				  pointer_mode, keyboard_mode,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7210
				  confineWin,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7211
				  curs,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7212
				  CurrentTime);
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7213
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7214
	    LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7215
*/
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7216
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7217
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7218
	    ok = 0;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7219
	    switch (result) {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7220
		case AlreadyGrabbed:
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7221
		    if (@global(ErrorPrinting) == true) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  7222
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n");
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7223
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7224
		    break;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7225
		case GrabNotViewable:
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7226
		    if (@global(ErrorPrinting) == true) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  7227
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n");
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7228
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7229
		    break;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7230
		case GrabInvalidTime:
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7231
		    if (@global(ErrorPrinting) == true) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  7232
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n");
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7233
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7234
		    break;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7235
		case GrabFrozen:
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7236
		    if (@global(ErrorPrinting) == true) {
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  7237
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n");
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7238
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7239
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7240
		default:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7241
		    ok = 1;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7242
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7243
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7244
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7245
	    if (! ok) {
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7246
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7247
		ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7248
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7249
		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
  7250
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7251
		LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7252
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7253
		RETURN (false);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7254
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7255
	    RETURN ( true );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7256
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7257
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  7258
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7259
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7260
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7261
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7262
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7263
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
  7264
    "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
  7265
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7266
    ^ self
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7267
	grabPointerIn:aWindowId
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7268
	withCursor:aCursorId
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7269
	eventMask:nil
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7270
	pointerMode:pMode
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7271
	keyboardMode:kMode
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7272
	confineTo:confineId
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7273
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7274
    "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
  7275
!
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7276
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7277
primUngrabKeyboard
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7278
    "release the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7279
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7280
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7281
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7282
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7283
    if (ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7284
	Display *dpy = myDpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7285
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7286
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7287
	XUngrabKeyboard(dpy, CurrentTime);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7288
	XSync(dpy, 0);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7289
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7290
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7291
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7292
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7293
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7294
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7295
primUngrabPointer
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7296
    "release the pointer"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7297
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7298
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7299
%{
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7300
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7301
    if (ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7302
	Display *dpy = myDpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7304
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7305
	XUngrabPointer(dpy, CurrentTime);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7306
	XSync(dpy, 0);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7307
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7308
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7309
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7310
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7311
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7312
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7313
ungrabKeyboard
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7314
    "release the keyboard"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7315
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  7316
    activeKeyboardGrab notNil ifTrue:[
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  7317
	activeKeyboardGrab := nil.
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  7318
	self primUngrabKeyboard.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  7319
    ]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7320
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7321
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7322
ungrabPointer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7323
    "release the pointer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7324
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  7325
    activePointerGrab notNil ifTrue:[
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  7326
	activePointerGrab := nil.
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  7327
	self primUngrabPointer.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  7328
    ]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7329
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7330
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7331
!XWorkstation methodsFor:'graphic context stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7332
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  7333
noClipIn:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7334
    "disable clipping rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7335
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7336
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7337
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7338
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7339
    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
  7340
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7341
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7342
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7343
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7344
	    gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7345
	    gcv.clip_mask = None;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7346
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7347
	    XChangeGC(myDpy, gc, GCClipMask, &gcv);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7348
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7349
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7350
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7351
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7352
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7353
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7354
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7355
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7356
setBackground:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7357
    "set background color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7358
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7359
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7360
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7361
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7362
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7363
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7364
	 && __isSmallInteger(bgColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7365
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7366
	    XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7367
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7368
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7369
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7370
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7371
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7372
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7373
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7374
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7375
setBitmapMask:aBitmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7376
    "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
  7377
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7378
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7379
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7380
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7381
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7382
    Pixmap bitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7383
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7384
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7385
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7386
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7387
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7388
	    gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7389
	    if (__isExternalAddress(aBitmapId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7390
		bitmap = __PixmapVal(aBitmapId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7391
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7392
		XSetStipple(dpy, gc, bitmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7393
		XSetFillStyle(dpy, gc, FillOpaqueStippled);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7394
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7395
		RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7396
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7397
	    if (aBitmapId == nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7398
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7399
		XSetFillStyle(dpy, gc, FillSolid);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7400
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7401
		RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7402
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7403
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7404
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7405
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7406
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7407
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7408
1681
069ede63fb19 pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1627
diff changeset
  7409
setClipByChildren:aBool in:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7410
    "enable/disable drawing into child views"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7411
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7412
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7413
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7414
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7415
    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
  7416
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7417
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7418
    if (ISCONNECTED) {
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7419
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7420
	    gc = __GCVal(aGCId);
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7421
	    if (aBool == true)
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7422
		gcv.subwindow_mode = ClipByChildren;
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7423
	    else
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7424
		gcv.subwindow_mode = IncludeInferiors;
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7425
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7426
	    ENTER_XLIB();
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7427
	    XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7428
	    LEAVE_XLIB();
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7429
	    RETURN ( self );
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7430
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7431
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7432
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7433
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7434
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7435
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  7436
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
  7437
    "clip to a rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7438
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7439
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7440
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7441
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7442
    XRectangle r;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7443
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7444
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7445
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7446
	 && __bothSmallInteger(clipX, clipY)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7447
	 && __bothSmallInteger(clipWidth, clipHeight)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7448
	    r.x = __intVal(clipX);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7449
	    r.y = __intVal(clipY);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7450
	    r.width = __intVal(clipWidth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7451
	    r.height = __intVal(clipHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7452
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7453
	    XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7454
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7455
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7456
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7457
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7458
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7459
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7460
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7461
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7462
setDashes:dashList dashOffset:offset in:aGCId
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7463
    "set line attributes"
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7464
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7465
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7466
%{
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7467
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7468
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7469
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7470
	 && __isSmallInteger(offset)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7471
	 && __isByteArray(dashList)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7472
	    ENTER_XLIB();
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7473
	    XSetDashes(myDpy, __GCVal(aGCId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7474
		       __intVal(offset),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7475
		       __ByteArrayInstPtr(dashList)->ba_element,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7476
		       __byteArraySize(dashList));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7477
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7478
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7479
	}
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7480
    }
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7481
bad: ;
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7482
%}.
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7483
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7484
     either aGCId is invalid,
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7485
     and/or dashList is not a byteArray
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7486
     and/or offset is not a smallInteger
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7487
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7488
    self primitiveFailedOrClosedConnection
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7489
!
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7490
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7491
setFont:aFontId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7492
    "set font to be drawn in"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7493
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7494
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7495
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7496
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7497
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7498
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7499
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7500
	if (__isExternalAddress(aFontId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7501
	 && __isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7502
	    f = (XFontStruct *) __FontVal(aFontId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7503
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7504
	    XSetFont(myDpy, __GCVal(aGCId), f->fid);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7505
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7506
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7507
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7508
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7509
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7510
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7511
     aGCId and/or aFontId are invalid
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7512
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7513
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7514
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7515
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7516
setForeground:fgColorIndex background:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7517
    "set foreground and background colors to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7518
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7519
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7520
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7521
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7522
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7523
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7524
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7525
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7526
	if (__bothSmallInteger(fgColorIndex, bgColorIndex)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7527
	 && __isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7528
	    gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7529
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7530
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7531
	    XSetForeground(dpy, gc, __intVal(fgColorIndex));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7532
	    XSetBackground(dpy, gc, __intVal(bgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7533
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7534
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7535
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7536
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7537
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7538
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7539
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7540
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7541
setForeground:fgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7542
    "set foreground color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7543
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7544
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7545
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7546
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7547
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7548
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7549
	 && __isSmallInteger(fgColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7550
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7551
	    XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7552
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7553
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7554
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7555
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7556
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7557
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7558
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7559
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7560
setFunction:aFunctionSymbol in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7561
    "set alu function to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7562
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7563
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7564
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7565
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7566
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7567
    int fun = -1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7568
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7569
    if (ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7570
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7571
	    gc = __GCVal(aGCId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7572
	    if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7573
	    else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7574
	    else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7575
	    else if (aFunctionSymbol == @symbol(and)) fun = GXand;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7576
	    else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7577
	    else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7578
	    else if (aFunctionSymbol == @symbol(or)) fun = GXor;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7579
	    else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7580
	    else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7581
	    else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7582
	    else if (aFunctionSymbol == @symbol(clear)) fun = GXclear;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7583
	    else if (aFunctionSymbol == @symbol(set)) fun = GXset;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7584
	    else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7585
	    else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7586
	    else if (aFunctionSymbol == @symbol(nand)) fun = GXnand;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7587
	    if (fun != -1) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7588
		ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7589
		XSetFunction(myDpy, gc, fun);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7590
		LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7591
		RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7592
	    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7593
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7594
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7595
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7596
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7597
     either aGCId is not an integer, or an invalid symbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7598
     was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7599
     #andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7600
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7601
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7602
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7603
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7604
setGraphicsExposures:aBoolean in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7605
    "set or clear the graphics exposures flag"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7606
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7607
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7608
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7609
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7610
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7611
	if (__isExternalAddress(aGCId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7612
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7613
	    XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7614
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7615
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7616
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7617
    }
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7618
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7619
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7620
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7621
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7622
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7623
    "set line attributes;
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7624
     lineStyle must be one of #solid, #dashed or #doubleDashed;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7625
     capStyle one of: #notLast, #butt, #round or #projecting;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7626
     joinStyle one of: #miter, #bevel or #round."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7627
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7628
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7629
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7630
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7631
    int x_style, x_cap, x_join;
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7632
    static char dashList[2] = { 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7633
    static char dotList[2]  = { 4,4 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7634
    static char dashDotList[4]    = { 4,1 , 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7635
    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
  7636
    char *x_dashes = 0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7637
    int x_nDash;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7638
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7639
    if (ISCONNECTED) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7640
	if (__isExternalAddress(aGCId)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7641
	 && __isSmallInteger(aNumber)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  7642
	    Display *dpy = myDpy;
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  7643
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7644
	    if (lineStyle == @symbol(solid)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7645
		x_dashes = (char *)0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7646
		x_style = LineSolid;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7647
	    } else if (lineStyle == @symbol(dashed)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7648
		x_dashes = dashList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7649
		x_nDash = sizeof(dashList);
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  7650
		x_style = LineOnOffDash;
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7651
	    } else if (lineStyle == @symbol(doubleDashed)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7652
		x_dashes = dashList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7653
		x_nDash = sizeof(dashList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7654
		x_style = LineDoubleDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7655
	    } else if (lineStyle == @symbol(dotted)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7656
		x_dashes = dotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7657
		x_nDash = sizeof(dotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7658
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7659
	    } else if (lineStyle == @symbol(dashDot)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7660
		x_dashes = dashDotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7661
		x_nDash = sizeof(dashDotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7662
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7663
	    } else if (lineStyle == @symbol(dashDotDot)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7664
		x_dashes = dashDotDotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7665
		x_nDash = sizeof(dashDotDotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7666
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7667
	    } else goto bad;
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7668
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7669
	    if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7670
	    else if (capStyle == @symbol(butt)) x_cap = CapButt;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7671
	    else if (capStyle == @symbol(round)) x_cap  = CapRound;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7672
	    else if (capStyle == @symbol(projecting)) x_cap  = CapProjecting;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7673
	    else goto bad;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7674
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7675
	    if (joinStyle == @symbol(miter)) x_join = JoinMiter;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7676
	    else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7677
	    else if (joinStyle == @symbol(round)) x_join  = JoinRound;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7678
	    else goto bad;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7679
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7680
	    ENTER_XLIB();
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7681
	    if (x_dashes) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7682
		XSetDashes(dpy, __GCVal(aGCId), 0, x_dashes, x_nDash);
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7683
	    }
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  7684
	    XSetLineAttributes(dpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7685
			       __GCVal(aGCId), __intVal(aNumber),
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7686
			       x_style, x_cap, x_join);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7687
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7688
	    RETURN ( self );
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7689
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7690
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7691
bad: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7692
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7693
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7694
     either aGCId is invalid,
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7695
     and/or lineWidth is not a smallInteger,
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7696
     and/or lineStyle is none of #solid, #dashed, #doubleDashed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7697
     and/or capStyle is none of #notLast, #butt, #round, #projecting
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7698
     and/or joinStyle is none of #miter, #bevel, #round
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7699
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7700
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7701
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7702
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7703
setMaskOriginX:orgX y:orgY in:aGCid
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7704
    "set the mask origin"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7705
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7706
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7707
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7708
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7709
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7710
	if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7711
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7712
	    XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7713
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7714
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7715
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7716
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7717
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7718
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7719
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7720
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7721
setPixmapMask:aPixmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7722
    "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
  7723
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7724
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7725
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7726
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7727
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7728
    Pixmap pixmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7729
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7730
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7731
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7732
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7733
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7734
	    gc = __GCVal(aGCId);
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7735
	    if (__isExternalAddress(aPixmapId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7736
		pixmap = __PixmapVal(aPixmapId);
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7737
		ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7738
		XSetTile(dpy, gc, pixmap);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7739
		XSetFillStyle(dpy, gc, FillTiled);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7740
		LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7741
		RETURN ( self );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7742
	    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7743
	    if (aPixmapId == nil) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7744
		ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7745
		XSetFillStyle(dpy, gc, FillSolid);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7746
		LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7747
		RETURN ( self );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7748
	    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7749
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7750
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7751
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7752
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7753
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7754
3883
4e01a59afccb method category rename
Claus Gittinger <cg@exept.de>
parents: 3856
diff changeset
  7755
!XWorkstation methodsFor:'initialization & release'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7756
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7757
closeConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7758
    "close down the connection to the X-server"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7759
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7760
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7761
3061
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  7762
"/ 'closing' errorPrintCR.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  7763
"/ thisContext fullPrintAll.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  7764
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  7765
%{ /* UNLIMITEDSTACK */   /* calls XSync()! */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7766
    if (ISCONNECTED) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7767
	Display *dpy = myDpy;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7768
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7769
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7770
	__INST(displayId) = nil;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7771
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7772
	XCloseDisplay(dpy);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7773
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7774
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7775
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7776
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7777
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7778
emergencyCloseConnection
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7779
    "low level close of the displays connection (without sending any buffered
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7780
     requests to the display). Only used in case of emergency (brokenConnection)"
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7781
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7782
%{
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7783
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7784
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7785
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7786
	__INST(displayId) = nil;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7787
	close(ConnectionNumber(dpy));
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7788
    }
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7789
%}
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7790
!
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7791
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7792
eventBufferSize
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7793
%{
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7794
    RETURN ( __MKSMALLINT(sizeof(XEvent) + 100) );
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7795
%}
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7796
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7797
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7798
initializeDefaultValues
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  7799
    activateOnClick := false.
2862
2f43bf146110 moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents: 2856
diff changeset
  7800
    super initializeDefaultValues.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7801
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7802
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7803
initializeDeviceSignals
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7804
    super initializeDeviceSignals.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7805
2984
6a278fd02e74 Signal init.
Stefan Vogel <sv@exept.de>
parents: 2977
diff changeset
  7806
    deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignal.
2856
95cb0ea5f7cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2855
diff changeset
  7807
    deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7808
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7809
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7810
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7811
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7812
!
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7813
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7814
initializeFor:aDisplayName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7815
    "initialize the receiver for a connection to an X-Server;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7816
     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
  7817
     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
  7818
     as hostname:number"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7819
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7820
    displayId notNil ifTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7821
	"/ already connected - you bad guy try to trick me manually ?
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7822
	^ self
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  7823
    ].
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  7824
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  7825
    displayId := self openConnectionTo:aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7826
    displayId isNil ifTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7827
	"/ could not connect.
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7828
	DeviceOpenErrorSignal raiseWith:aDisplayName.
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7829
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7830
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7831
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7832
    xlibTimeout := xlibTimeout ? DefaultXLibTimeout.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7833
    xlibTimeoutForWindowCreation := xlibTimeoutForWindowCreation ? DefaultXLibTimeoutForWindowCreation.
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7834
    hasConnectionBroken := false.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7835
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7836
    dispatching := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7837
    dispatchingExpose := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7838
    isSlow := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7839
    shiftDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7840
    ctrlDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7841
    metaDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7842
    altDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7843
    motionEventCompression := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7844
    buttonsPressed := 0.
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  7845
    displayName := aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7846
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7847
    listOfXFonts := nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7848
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7849
    atoms := nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7850
    protocolsAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7851
    deleteWindowAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7852
    saveYourselfAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7853
    quitAppAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7854
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  7855
    self initializeDeviceResourceTables.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7856
    self initializeScreenProperties.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7857
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7858
    self initializeDefaultValues.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7859
    self initializeSpecialFlags.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7860
    self initializeKeyboardMap.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7861
    self initializeDeviceSignals.
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  7862
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  7863
    self initializeViewStyle.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7864
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7865
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7866
initializeModifierMappings
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7867
    "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
  7868
     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
  7869
     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
  7870
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7871
    |map|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7872
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7873
    super initializeModifierMappings.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7874
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  7875
    rawKeySymTranslation := RawKeySymTranslation.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  7876
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7877
    map := self modifierMapping.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  7878
    map isNil ifTrue:[
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7879
	"/
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7880
	"/ mhmh - a crippled Xlib which does not provide modifier mappings
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7881
	"/ setup some reasonable default. If that is not sufficient,
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7882
	"/ you have to change things from your display.rc file.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7883
	"/
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7884
	altModifierMask := self modifier1Mask.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7885
	metaModifierMask := self modifier2Mask.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  7886
    ] ifFalse:[
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7887
	| mod stringFromKeyCode nonNilOnes |
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7888
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7889
	altModifierMask := 0.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7890
	metaModifierMask := 0.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7891
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7892
	stringFromKeyCode := [:key |
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7893
				    |s|
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7894
				    s := self stringFromKeycode:key.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7895
				    s notNil
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7896
					ifTrue:[s asSymbol]
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7897
					ifFalse:[nil]
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7898
			     ].
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7899
	nonNilOnes := [:str | str notNil].
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7900
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7901
	mod := map at:1.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7902
	mod notNil ifTrue:[
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7903
	    shiftModifiers := (mod collect:stringFromKeyCode thenSelect:nonNilOnes) asArray.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7904
	].
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7905
	mod := map at:3.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7906
	mod notNil ifTrue:[
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7907
	    ctrlModifiers  := (mod collect:stringFromKeyCode thenSelect:nonNilOnes) asArray.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7908
	].
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7909
	mod := map at:4.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7910
	mod notNil ifTrue:[
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7911
	    mod := (mod collect:stringFromKeyCode thenSelect:nonNilOnes) asArray.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7912
	    (mod includes:'Num_Lock') ifFalse:[
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7913
		metaModifiers := mod.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7914
		metaModifierMask := 1 bitShift:(4-1).
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7915
	    ].
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7916
	].
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7917
	mod := map at:5.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7918
	mod notNil ifTrue:[
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7919
	    mod := (mod collect:stringFromKeyCode thenSelect:nonNilOnes) asArray.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7920
	    (mod includes:'Num_Lock') ifFalse:[
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7921
		altModifiers   := mod.
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7922
		altModifierMask := 1 bitShift:(5-1).
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7923
	    ].
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  7924
	]
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7925
    ].
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7926
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7927
    "
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7928
     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
  7929
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7930
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7931
    "Modified: 1.12.1995 / 23:44:40 / stefan"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7932
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7933
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7934
initializeScreenProperties
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7935
    |masks|
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7936
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  7937
    super initializeScreenProperties.
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  7938
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7939
    hasShapeExtension := self queryShapeExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7940
    hasShmExtension := self querySHMExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7941
    hasDPSExtension := self queryDPSExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7942
    hasXVideoExtension := self queryXVideoExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7943
    hasMbufExtension := self queryMBUFExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7944
    hasPEXExtension := self queryPEXExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7945
    hasImageExtension := self queryXIEExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7946
    hasInputExtension := self queryXIExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7947
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7948
    primaryAtom := self atomIDOf:#PRIMARY.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7949
    stringAtom := self atomIDOf:#STRING.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  7950
    clipboardAtom := self atomIDOf:#CLIPBOARD.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7951
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7952
    altModifierMask := self modifier2Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7953
    metaModifierMask := self modifier1Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7954
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7955
    screen := self queryDefaultScreen.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7956
    depth := self queryDepth.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7957
    ncells := self queryCells.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7958
    width := self queryWidth.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7959
    height := self queryHeight.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7960
    widthMM := self queryWidthMM.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7961
    heightMM := self queryHeightMM.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7962
    blackpixel := self queryBlackPixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7963
    whitepixel := self queryWhitePixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7964
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7965
    monitorType := #unknown.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7966
    visualType := self queryDefaultVisualType.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7967
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7968
    hasColors := hasGreyscales := true.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7969
    (visualType == #StaticGray
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7970
    or:[ visualType == #GrayScale]) ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7971
	hasColors := false.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7972
	monitorType := #monochrome.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7973
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7974
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7975
    ncells == 2 ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7976
	hasColors := hasGreyscales := false.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7977
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7978
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7979
    masks := self queryRGBMasks.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7980
    redMask := masks at:1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7981
    greenMask := masks at:2.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7982
    blueMask := masks at:3.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7983
    bitsPerRGB := masks at:4.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7984
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7985
    visualType == #TrueColor ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7986
	redShift := redMask lowBit - 1.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7987
	greenShift := greenMask lowBit - 1.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7988
	blueShift := blueMask lowBit - 1.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7989
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7990
	bitsRed := redMask highBit - redMask lowBit + 1.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7991
	bitsGreen := greenMask highBit - greenMask lowBit + 1.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7992
	bitsBlue := blueMask highBit - blueMask lowBit + 1.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7993
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7994
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  7995
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7996
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7997
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7998
    int scr;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7999
    Visual *visual;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8000
    XVisualInfo viproto;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8001
    XVisualInfo *vip;                   /* retured info */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8002
    int maxRGBDepth;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8003
    int rgbRedMask, rgbGreenMask, rgbBlueMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8004
    int rgbVisualID;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8005
    int nvi, i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8006
    char *type, *nm;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8007
    int dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8008
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8009
    if (ISCONNECTED) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8010
	dpy = myDpy;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8011
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8012
	/*
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8013
	 * look for RGB visual
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8014
	 */
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8015
	nvi = 0;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8016
	viproto.screen = scr;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8017
	vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8018
	maxRGBDepth = 0;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8019
	for (i = 0; i < nvi; i++) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8020
	    switch (vip[i].class) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8021
		case TrueColor:
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8022
		    if (vip[i].depth > maxRGBDepth) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8023
			maxRGBDepth = vip[i].depth;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8024
			rgbRedMask = vip[i].red_mask;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8025
			rgbGreenMask = vip[i].green_mask;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8026
			rgbBlueMask = vip[i].blue_mask;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8027
			rgbVisualID = vip[i].visualid;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8028
		    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8029
		    break;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8030
	    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8031
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8032
	if (vip) XFree ((char *) vip);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8033
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8034
	if (maxRGBDepth) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8035
	    __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  8036
	}
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  8037
    }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  8038
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8039
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8040
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8041
initializeSpecialFlags
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8042
    "perform additional special server implementation flags"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8043
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8044
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8045
    "/ assume we have it ... (should check)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8046
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8047
    hasSaveUnder := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8048
    ignoreBackingStore := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8049
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8050
    (self serverVendor = 'X11/NeWS') ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8051
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8052
	"/ this is a kludge around a bug in the X11/NeWS server,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8053
	"/ which does not correctly handle saveUnder
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8054
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8055
	hasSaveUnder := false.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8056
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8057
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8058
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8059
initializeUniqueID
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8060
    uniqueDeviceID isNil ifTrue:[
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8061
	uniqueDeviceID := UUID genUUID.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8062
    ]
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8063
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8064
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8065
openConnectionTo:dpyName
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8066
    "open a connection to some display;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8067
     return the displayId if ok, nil of not ok"
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8068
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  8069
%{ /* STACK:100000 */    /* XOpenDisplay() calls gethostbyname() */
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8070
    Display *dpy;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8071
    int i;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8072
    char *nm;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8073
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8074
    if (__isString(dpyName))
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8075
	nm = (char *) __stringVal(dpyName);
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8076
    else {
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8077
	nm = NULL;
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8078
    }
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8079
    dpy = XOpenDisplay(nm);
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8080
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8081
    if (dpy) {
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8082
	static int firstCall = 1;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8083
	OBJ dpyID;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8084
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8085
	dpyID = __MKEXTERNALADDRESS(dpy);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8086
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8087
	if (firstCall) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8088
	    firstCall = 0;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8089
	    XSetErrorHandler(__XErrorHandler__);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8090
	    XSetIOErrorHandler(__XIOErrorHandler__);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8091
	}
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  8092
	RETURN (dpyID);
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8093
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8094
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8095
    ^ nil
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8096
!
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8097
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8098
queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8099
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8100
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8101
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8102
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8103
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8104
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8105
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8106
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8107
	RETURN ( __MKSMALLINT(BlackPixel(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8108
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8109
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8110
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8111
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8112
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8113
     Display queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8114
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8115
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8116
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8117
queryCells
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8118
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8119
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8120
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8121
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8122
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8123
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8124
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8125
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8126
	RETURN ( __MKSMALLINT(DisplayCells(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8127
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8128
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8129
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8130
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8131
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8132
     Display queryCells
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8133
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8134
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8135
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8136
queryDPSExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8137
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8138
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8139
#ifdef DPS
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8140
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8141
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8142
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8143
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8144
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8145
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8146
	if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8147
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8148
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8149
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8150
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8151
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8152
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8153
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8154
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8155
     Display queryDPSExtension
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8156
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8157
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8158
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8159
queryDefaultScreen
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8160
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8161
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8162
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8163
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8164
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8165
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8166
	RETURN ( __MKSMALLINT(DefaultScreen(dpy)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8167
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8168
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8169
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8170
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8171
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8172
     Display queryDefaultScreen
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8173
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8174
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8175
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8176
queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8177
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8178
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8179
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8180
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8181
	Visual *visual;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8182
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8183
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8184
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8185
	switch (visual->class) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8186
	    case StaticGray:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8187
		RETURN ( @symbol(StaticGray) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8188
	    case GrayScale:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8189
		RETURN ( @symbol(GrayScale) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8190
	    case StaticColor:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8191
		RETURN ( @symbol(StaticColor) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8192
	    case PseudoColor:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8193
		RETURN ( @symbol(PseudoColor) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8194
	    case TrueColor:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8195
		RETURN ( @symbol(TrueColor) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8196
	    case DirectColor:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8197
		RETURN ( @symbol(DirectColor) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8198
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8199
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8200
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8201
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8202
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8203
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8204
     Display queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8205
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8206
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8207
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8208
queryDepth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8209
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8210
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8211
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8212
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8213
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8214
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8215
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8216
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8217
	RETURN ( __MKSMALLINT(DisplayPlanes(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8218
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8219
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8220
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8221
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8222
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8223
     Display queryDepth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8224
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8225
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8226
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8227
queryHeight
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8228
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8229
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8230
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8231
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8232
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8233
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8234
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8235
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8236
	RETURN ( __MKSMALLINT(DisplayHeight(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8237
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8238
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8239
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8240
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8241
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8242
     Display queryHeight
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8243
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8244
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8245
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8246
queryHeightMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8247
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8248
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8249
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8250
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8251
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8252
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8253
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8254
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8255
	RETURN ( __MKSMALLINT(DisplayHeightMM(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8256
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8257
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8258
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8259
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8260
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8261
     Display queryHeightMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8262
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8263
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8264
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8265
queryMBUFExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8266
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8267
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8268
#ifdef MBUF
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8269
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8270
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8271
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8272
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8273
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8274
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8275
	if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8276
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8277
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8278
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8279
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8280
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8281
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8282
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8283
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8284
     Display queryMBUFExtension
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8285
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8286
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8287
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8288
queryPEXExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8289
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8290
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8291
#ifdef PEX5
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8292
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8293
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8294
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8295
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8296
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8297
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8298
	if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8299
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8300
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8301
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8302
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8303
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8304
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8305
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8306
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8307
     Display queryPEXExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8308
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8309
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8310
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8311
queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8312
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8313
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8314
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8315
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8316
	Visual *visual;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8317
	OBJ redMask, greenMask, blueMask, bprgb;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8318
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8319
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8320
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8321
	redMask   = __MKSMALLINT(visual->red_mask);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8322
	greenMask = __MKSMALLINT(visual->green_mask);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8323
	blueMask  = __MKSMALLINT(visual->blue_mask);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8324
	bprgb  = __MKSMALLINT(visual->bits_per_rgb);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8325
	RETURN ( __ARRAY_WITH4(redMask, greenMask, blueMask, bprgb) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8326
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8327
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8328
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8329
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8330
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8331
     Display queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8332
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8333
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8334
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8335
querySHMExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8336
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8337
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8338
#ifdef xxSHM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8339
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8340
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8341
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8342
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8343
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8344
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8345
	if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8346
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8347
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8348
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8349
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8350
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8351
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8352
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8353
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8354
     Display querySHMExtension
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8355
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8356
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8357
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8358
queryShapeExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8359
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8360
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8361
#ifdef SHAPE
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8362
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8363
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8364
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8365
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8366
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8367
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8368
	if (XShapeQueryExtension(dpy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8369
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8370
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8371
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8372
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8373
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8374
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8375
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8376
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8377
     Display queryShapeExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8378
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8379
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8380
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8381
queryWhitePixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8382
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8383
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8384
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8385
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8386
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8387
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8388
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8389
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8390
	RETURN ( __MKSMALLINT(WhitePixel(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8391
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8392
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8393
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8394
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8395
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8396
     Display queryWhitePixel
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8397
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8398
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8399
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8400
queryWidth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8401
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8402
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8403
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8404
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8405
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8406
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8407
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8408
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8409
	RETURN ( __MKSMALLINT(DisplayWidth(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8410
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8411
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8412
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8413
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8414
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8415
     Display queryWidth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8416
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8417
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8418
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8419
queryWidthMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8420
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8421
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8422
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8423
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8424
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8425
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8426
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8427
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8428
	RETURN ( __MKSMALLINT(DisplayWidthMM(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8429
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8430
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8431
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8432
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8433
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8434
     Display queryWidthMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8435
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8436
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8437
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8438
queryXIEExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8439
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8440
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8441
#ifdef XIE
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8442
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8443
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8444
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8445
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8446
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8447
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8448
	if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8449
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8450
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8451
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8452
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8453
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8454
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8455
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8456
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8457
     Display queryXIEExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8458
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8459
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8460
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8461
queryXIExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8462
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8463
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8464
#ifdef XI
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8465
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8466
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8467
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8468
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8469
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8470
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8471
	if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8472
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8473
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8474
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8475
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8476
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8477
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8478
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8479
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8480
     Display queryXIExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8481
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8482
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8483
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8484
queryXVideoExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8485
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8486
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8487
#ifdef XVIDEO
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8488
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8489
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8490
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8491
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8492
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8493
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8494
	if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8495
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8496
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8497
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8498
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8499
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8500
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8501
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8502
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8503
     Display queryXVideoExtension
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8504
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8505
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8506
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8507
reinitialize
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8508
    preWaitAction notNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  8509
	Processor removePreWaitAction:preWaitAction.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  8510
	preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8511
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8512
    virtualRootId := rootId := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8513
    selectionFetchers := nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8514
    super reinitialize.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8515
    dispatchingExpose := nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8516
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8517
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8518
releaseDeviceResources
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8519
    preWaitAction notNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  8520
	Processor removePreWaitAction:preWaitAction.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  8521
	preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8522
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8523
    selectionFetchers := nil.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8524
    super releaseDeviceResources.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8525
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8526
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8527
!XWorkstation methodsFor:'keyboard mapping'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8528
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8529
altModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8530
    "return the mask (in motionEvents) for the alt-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8531
     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
  8532
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8533
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8534
    ^ altModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8535
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8536
    "Created: 23.3.1996 / 12:43:22 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8537
    "Modified: 23.3.1996 / 12:44:56 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8538
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8539
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8540
altModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8541
    "define which key takes the role of an alt-key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8542
     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
  8543
     most keyboards. However, there may be exceptions to this,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8544
     and the setting can be changed with:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8545
	Display altModifierMask:(Display modifier2Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8546
     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
  8547
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8548
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8549
    altModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8550
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8551
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8552
ctrlModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8553
    "return the Xlib mask bit for the control modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8554
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8555
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8556
    RETURN (__MKSMALLINT(ControlMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8557
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8558
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8559
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8560
metaModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8561
    "return the mask (in motionEvents) for the meta-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8562
     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
  8563
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8564
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8565
    ^ metaModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8566
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8567
    "Created: 23.3.1996 / 12:43:39 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8568
    "Modified: 23.3.1996 / 12:45:09 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8569
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8570
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8571
metaModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8572
    "define which key takes the role of a meta key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8573
     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
  8574
     most keyboards (if present at all).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8575
     However, there may be exceptions to this, and the setting can
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8576
     be changed with:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8577
	Display metaModifierMask:(Display modifier1Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8578
     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
  8579
     As reported, some Xservers place the Meta-key onto NumLock,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8580
     and having NumLock enabled makes ST/X think, that meta is pressed
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8581
     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
  8582
     the mask to 0.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8583
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8584
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8585
    metaModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8586
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8587
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8588
modifier1Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8589
    "return the Xlib mask bit for the 1st modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8590
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8591
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8592
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8593
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8594
    RETURN (__MKSMALLINT(Mod1Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8595
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8596
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8597
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8598
modifier2Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8599
    "return the Xlib mask bit for the 2nd modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8600
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8601
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8602
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8603
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8604
    RETURN (__MKSMALLINT(Mod2Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8605
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8606
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8607
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8608
modifier3Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8609
    "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
  8610
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8611
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8612
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8613
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8614
    RETURN (__MKSMALLINT(Mod3Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8615
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8616
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8617
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8618
modifier4Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8619
    "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
  8620
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8621
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8622
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8623
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8624
    RETURN (__MKSMALLINT(Mod4Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8625
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8626
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8627
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8628
modifier5Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8629
    "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
  8630
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8631
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8632
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8633
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8634
    RETURN (__MKSMALLINT(Mod5Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8635
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8636
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8637
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8638
modifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8639
    "Get the Modifier Mapping.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8640
     We return an array of arrays of keycodes"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8641
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8642
    |modifierKeyMap maxKeyPerMod ret nextKey|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8643
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8644
    modifierKeyMap := self rawModifierMapping.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8645
    maxKeyPerMod := modifierKeyMap size // 8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8646
    modifierKeyMap isNil ifTrue:[^ nil].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8647
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8648
    ret := Array new:8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8649
    nextKey := 1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8650
    1 to:8 do:[ :i |
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8651
	(modifierKeyMap at:nextKey) ~= 0 ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8652
	    |mod|
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8653
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8654
	    mod := OrderedCollection new:maxKeyPerMod.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8655
	    modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8656
		key ~= 0 ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8657
		    mod add:key
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8658
		].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8659
	    ].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8660
	    ret at:i put:mod.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8661
	].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8662
	nextKey := nextKey+maxKeyPerMod.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8663
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8664
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8665
    ^ ret
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8666
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8667
    "
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8668
     Display modifierMapping
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8669
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8670
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8671
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8672
     |mapping|
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8673
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8674
     mapping := Display modifierMapping.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8675
     ^ mapping collect:[:eachRow |
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8676
			     eachRow notNil ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8677
				 eachRow collect:[ :key | Display stringFromKeycode:key ].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8678
			     ] ifFalse:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8679
				 nil
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8680
			     ]
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8681
		       ].
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8682
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8683
!
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8684
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8685
rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8686
    "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
  8687
     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
  8688
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8689
    ^ rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8690
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8691
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8692
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8693
     Display rawKeySymTranslation
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8694
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8695
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8696
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8697
rawModifierMapping
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8698
    "Get the raw Modifier Mapping."
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8699
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8700
    |modifierKeyMap maxKeyPerMod |
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8701
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8702
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8703
    XModifierKeymap *modmap;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8704
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8705
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8706
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8707
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8708
	if ((modmap = XGetModifierMapping(dpy)) != 0) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8709
	   maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8710
	   modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8711
	   if (modifierKeyMap != nil) {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8712
		memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element,
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8713
		       (char *)modmap->modifiermap, modmap->max_keypermod * 8);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8714
	   }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8715
	   XFreeModifiermap(modmap);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8716
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8717
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8718
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8719
    ^ modifierKeyMap
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8720
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8721
    "
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8722
	Display rawModifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8723
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8724
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8725
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8726
shiftModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8727
    "return the Xlib mask bit for the shift modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8728
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8729
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8730
    RETURN (__MKSMALLINT(ShiftMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8731
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8732
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8733
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8734
stringFromKeycode:code
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8735
    "Get a KeySymbol (a smalltalk symbol) from the keycode."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8736
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8737
    |str|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8738
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8739
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8740
    KeySym keysym;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8741
    char *keystring;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8742
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8743
    if (ISCONNECTED
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8744
     && __isSmallInteger(code)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8745
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8746
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  8747
	if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol &&
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8748
	    (keystring = XKeysymToString(keysym)) != 0)
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8749
	    str = __MKSTRING(keystring);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8750
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8751
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8752
    ^ str
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8753
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8754
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8755
	Display stringFromKeycode:28
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8756
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8757
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8758
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8759
superModifierMask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8760
    "return the Xlib mask bit for the super modifier key"
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8761
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8762
    ^ self modifier4Mask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8763
! !
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
!XWorkstation methodsFor:'misc'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8766
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8767
beep
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8768
    "output an audible beep or bell"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8769
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  8770
    UserPreferences current beepEnabled ifTrue:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8771
	self beep:50
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8772
    ]
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  8773
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  8774
    "Modified: / 3.12.1999 / 17:13:59 / ps"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8775
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8776
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8777
beep:volumeInPercent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8778
    "output an audible beep"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8779
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8780
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8781
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8782
    int volume;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8783
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8784
    if (__isSmallInteger(volumeInPercent)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8785
     && ISCONNECTED) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  8786
	/* stupid: X wants -100 .. 100 and calls this percent */
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  8787
	volume = __intVal(volumeInPercent) * 2 - 100;
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  8788
	if (volume < -100) volume = -100;
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  8789
	else if (volume > 100) volume = 100;
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  8790
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  8791
	ENTER_XLIB();
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  8792
	XBell(myDpy, volume);
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
  8793
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8794
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8795
%}
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8798
buffered
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8799
    "buffer drawing - do not send it immediately to the display.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8800
     This is the default anyway.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8801
     See #unBuffered for additional info."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8802
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8803
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8804
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8805
    if (ISCONNECTED) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8806
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8807
	XSynchronize(myDpy, 0);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8808
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8809
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8810
%}
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8811
    "
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8812
     Display buffered
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8813
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8814
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8815
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8816
flush
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8817
    "send all buffered drawing to the display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8818
     This may be required to make certain, that all previous operations
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8819
     are really sent to the display before continuing. For example,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8820
     after a cursor-change with a followup long computation.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8821
     (otherwise, the cursor change request may still be in the output buffer)
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8822
     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
  8823
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8824
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8825
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8826
    if (ISCONNECTED) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8827
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8828
	XFlush(myDpy);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8829
	LEAVE_XLIB();
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8830
    }
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8831
%}
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8832
!
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8833
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8834
flushDpsContext:aDPSContext
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8835
    <context: #return>
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8836
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8837
#ifdef DPS
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8838
    if (ISCONNECTED
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8839
	&& __isExternalAddress(aDPSContext)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8840
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8841
	DPSFlushContext(__DPSContextVal(aDPSContext));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8842
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8843
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8844
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8845
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8846
#endif
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8847
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8848
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8849
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8850
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8851
primSync
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8852
    "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
  8853
     has finished drawing it.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8854
     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
  8855
     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
  8856
     to be finished. See also #flush."
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8857
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8858
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8859
%{
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8860
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8861
    if (ISCONNECTED) {
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8862
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8863
	ENTER_XLIB();
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8864
	XSync(myDpy, 0);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8865
	LEAVE_XLIB();
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8866
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8867
    }
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8868
%}
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8869
!
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8870
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8871
refreshKeyboardMapping:eB
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8872
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8873
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8874
    XMappingEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8875
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8876
    if (ISCONNECTED
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8877
     && __isByteArray(eB)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8878
	ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8879
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8880
	XRefreshKeyboardMapping(ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8881
	LEAVE_XLIB();
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8882
	RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8883
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8884
%}.
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
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8888
roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8889
    "answer the round trip time in milliSeconds.
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8890
     May be used to detect slow X11 connections"
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8891
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8892
    self sync.
4119
a770b7e08c72 Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 4114
diff changeset
  8893
    ^ Timestamp millisecondsToRun:[ self primSync ].
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8894
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8895
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8896
     Screen current roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8897
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8898
!
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8899
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8900
setInputFocusTo:aWindowId
2871
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  8901
    "set the focus to the view as defined by aWindowId.
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  8902
     When released, return the focus to the root window"
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  8903
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8904
"/    self setInputFocusTo:aWindowId revertTo:#parent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8905
    self setInputFocusTo:aWindowId revertTo:#root
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8906
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8907
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8908
setInputFocusTo:aWindowId revertTo:revertSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8909
    "set the focus to the view as defined by aWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8910
     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
  8911
     input until a new focus is set.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8912
     RevertSymbol specifies what should happen if the view becomes invisible;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8913
     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
  8914
     given to the parent view, the root view or no view."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8915
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8916
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8917
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8918
    int arg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8919
    Window focusWindow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8920
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8921
    if (ISCONNECTED) {
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8922
	if (__isExternalAddress(aWindowId)) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8923
	    focusWindow = __WindowVal(aWindowId);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8924
	} else if (aWindowId == nil) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8925
	    focusWindow = None;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8926
	} else
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8927
	    goto err;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8928
	if (revertSymbol == @symbol(parent))
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8929
	    arg = RevertToParent;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8930
	else if (revertSymbol == @symbol(root))
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8931
	    arg = RevertToPointerRoot;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8932
	else
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8933
	    arg = RevertToNone;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8934
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8935
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8936
	ENTER_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8937
	XSetInputFocus(myDpy, focusWindow, arg, CurrentTime);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8938
	LEAVE_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8939
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8940
	RETURN ( self );
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  8941
    }
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  8942
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8943
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8944
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8945
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8946
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8947
sync
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8948
    "send all buffered drawing to the display AND wait until the display
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8949
     has finished drawing it.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8950
     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
  8951
     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
  8952
     to be finished. See also #flush."
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8953
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8954
    self primSync.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8955
    self dispatchPendingEvents.
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8956
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8957
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8958
unBuffered
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8959
    "make all drawing be sent immediately to the display.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8960
     This makes all graphics synchronous and turns off any buffering
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8961
     (i.e. each individual draw-request is sent immediately without
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8962
      packing multiple requests into a larger message buffer).
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8963
     Be prepared, that this slows down graphics considerably.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8964
     However, it allows display errors to be handled immediately and
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8965
     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
  8966
     which was responsible for it. See also #buffered."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8967
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8968
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8969
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8970
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8971
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8972
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8973
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8974
	XSynchronize(myDpy, 1);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8975
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8976
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8977
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8978
%}
1813
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  8979
    "
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  8980
     Display unBuffered
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  8981
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8982
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8983
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8984
!XWorkstation methodsFor:'pointer stuff'!
295
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
anyButtonStateMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8987
    "return an integer for masking out any button from a
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8988
     buttonStates value."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8989
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8990
    "/ should use ``Display buttonXMotionMask bitOr:....''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8991
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8992
    ^ 256 + 512 + 1024
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8993
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8994
    "Modified: 23.3.1996 / 12:41:33 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8995
    "Created: 23.3.1996 / 12:46:35 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8996
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8997
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8998
buttonStates
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8999
    "return an integer representing the state of the pointer buttons;
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9000
     a one-bit in positions 0.. represent a pressed button.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9001
     See the button1Mask/button2Mask/button3Mask,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9002
     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
  9003
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9004
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9005
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9006
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  9007
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9008
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9009
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9010
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9011
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9012
    if (ISCONNECTED) {
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9013
	Display *dpy = myDpy;
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9014
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9015
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9016
#ifdef VIRTUAL_ROOT
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  9017
	ENTER_XLIB();
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  9018
	w = getRootWindow(dpy, screen);
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  9019
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9020
#else
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9021
	w = RootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9022
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9023
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9024
	if (w) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9025
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9026
	    ENTER_XLIB();
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9027
	    XQueryPointer(dpy, w, &rootRet, &childRet,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9028
				 &rootX, &rootY,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9029
				 &winX, &winY,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9030
				 &mask);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9031
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9032
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9033
	    RETURN (__MKSMALLINT(mask));
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9034
	}
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9035
    }
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9036
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9037
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9038
    ^ nil
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9039
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9040
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9041
     Display buttonStates
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9042
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9043
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9044
    "is the control-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9045
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9046
     Display buttonStates bitTest:(Display controlMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9047
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9048
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9049
    "is the alt/meta-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9050
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9051
     Display buttonStates bitTest:(Display altModifierMask)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9052
     Display buttonStates bitTest:(Display metaModifierMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9056
leftButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9057
    "return an integer for masking out the left button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9058
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9059
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9060
    "/ should use ``Display button1MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9061
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9062
    ^ 256
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9063
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9064
    "Modified: 23.3.1996 / 12:41:33 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9065
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9066
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9067
middleButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9068
    "return an integer for masking out the middle button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9069
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9070
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9071
    "/ should use ``Display button2MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9072
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9073
    ^ 512
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9074
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9075
    "Modified: 23.3.1996 / 12:41:43 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9076
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9077
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9078
pointerPosition
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9079
    "return the current pointer position in root-window coordinates"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9080
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9081
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9082
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9083
    |xpos ypos|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9084
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9085
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9086
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  9087
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9088
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9089
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9090
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9091
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9092
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9093
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9094
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9095
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9096
#ifdef VIRTUAL_ROOT
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  9097
	ENTER_XLIB();
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  9098
	w = getRootWindow(dpy, screen);
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  9099
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9100
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9101
	w = RootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9102
#endif
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9103
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9104
	XQueryPointer(dpy, w, &rootRet, &childRet,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9105
			      &rootX, &rootY,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9106
			      &winX, &winY,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9107
			      &mask);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9108
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9109
	xpos = __MKSMALLINT(rootX);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9110
	ypos = __MKSMALLINT(rootY);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9111
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9112
    }
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9113
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9114
    xpos isNil ifTrue:[
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9115
	self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9116
	^ nil
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9117
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9118
    ^ xpos @ ypos
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9119
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9120
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9121
rightButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9122
    "return an integer for masking out the right button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9123
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9124
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9125
    "/ should use ``Display button3MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9126
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9127
    ^ 1024
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9128
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9129
    "Modified: 23.3.1996 / 12:41:52 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9130
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9131
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9132
rootPositionOfLastEvent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9133
    "return the position in root-window coordinates
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9134
     of the last button, key or pointer event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9135
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9136
    ^ eventRootX @ eventRootY
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9137
!
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9138
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9139
setPointerPosition:newPosition in:aWindowId
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9140
    "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
  9141
     given windows origin (which may be the rootWindow).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  9142
     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
  9143
     to change the mousePointer position.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9144
     This interface is provided for special applications (presentation
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9145
     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
  9146
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9147
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9148
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9149
    |xpos ypos|
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9150
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9151
    xpos := newPosition x.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9152
    ypos := newPosition y.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9153
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9154
%{
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9155
    if (ISCONNECTED
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9156
     && __isExternalAddress(aWindowId)
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9157
     && __bothSmallInteger(xpos, ypos)) {
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9158
	Display *dpy = myDpy;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9159
	Window w = __WindowVal(aWindowId);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9160
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9161
	ENTER_XLIB();
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9162
	XWarpPointer(dpy,
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9163
		     None,  /* src window */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9164
		     w,  /* dst window */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9165
		     0,  /* src_x */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9166
		     0,  /* src_y */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9167
		     0,  /* src_w */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9168
		     0,  /* src_h */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9169
		     __intVal(xpos),  /* dst_x */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9170
		     __intVal(ypos)   /* dst_y */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9171
		    );
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9172
	LEAVE_XLIB();
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9173
    }
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9174
%}.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9175
    ^ self
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9176
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9177
    "
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9178
     Display setPointerPosition:1000@1000
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9179
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9180
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9181
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9182
!XWorkstation methodsFor:'private'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9183
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9184
findSelectionFetcher:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9185
    "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
  9186
     Answer nil, if there is none"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9187
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9188
    selectionFetchers isNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9189
	^ nil.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9190
    ].
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9191
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9192
    ^ selectionFetchers detect:[:eachFetcher|
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9193
	    eachFetcher matchesDrawableId:aDrawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9194
    ] ifNone:[].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9195
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9196
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9197
registerSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9198
    "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
  9199
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9200
    selectionFetchers isNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9201
	selectionFetchers := OrderedCollection new.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9202
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9203
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9204
    selectionFetchers add:aSelectionFetcher.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9205
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9206
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9207
unregisterSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9208
    "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
  9209
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9210
    selectionFetchers remove:aSelectionFetcher.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9211
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9212
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9213
!XWorkstation methodsFor:'properties'!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9214
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9215
deleteProperty:propertyID for:aWindowID
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9216
    "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
  9217
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9218
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9219
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9220
%{
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9221
    if (ISCONNECTED && __isAtomID(propertyID)) {
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9222
	Display *dpy = myDpy;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9223
	Atom prop;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9224
	Window window;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9225
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9226
	prop = __AtomVal(propertyID);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9227
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9228
	if (__isExternalAddress(aWindowID)) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9229
	    window = __WindowVal(aWindowID);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9230
	} else if (aWindowID == nil) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9231
	    window = DefaultRootWindow(dpy);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9232
	} else if (__isInteger(aWindowID)) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9233
	    window = (Window)__unsignedLongIntVal(aWindowID);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9234
	} else {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9235
	    goto fail;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9236
	}
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9237
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9238
	ENTER_XLIB();
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9239
	XDeleteProperty(dpy, window, prop);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9240
	LEAVE_XLIB();
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9241
	RETURN(true);
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9242
    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9243
fail:;
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9244
%}.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9245
    self primitiveFailedOrClosedConnection.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9246
!
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9247
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9248
getProperty:propertySymbolOrAtomID from:aWindowOrWindowIDOrNil delete:doDelete
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9249
    "get a property as an association propertyType->propertyValue"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9250
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9251
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9252
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9253
    |val typeID propertyID windowID|
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9254
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9255
    propertySymbolOrAtomID isString ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9256
	propertyID := self atomIDOf:propertySymbolOrAtomID create:false.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9257
	propertyID isNil ifTrue:[^ nil].
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9258
    ] ifFalse:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9259
	propertyID := propertySymbolOrAtomID.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9260
    ].
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9261
    aWindowOrWindowIDOrNil isView ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9262
	windowID := aWindowOrWindowIDOrNil id.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9263
    ] ifFalse:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9264
	windowID := aWindowOrWindowIDOrNil.
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  9265
    ].
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  9266
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9267
%{
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9268
    Window window;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9269
    Atom property;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9270
    char *cp, *cp2;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9271
    Atom actual_type;
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9272
    int actual_format;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9273
    unsigned long nitems, bytes_after, nread;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9274
    unsigned char *data;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9275
    int ok = 1;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9276
#   define PROP_SIZE    2048
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9277
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9278
    if (ISCONNECTED) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9279
	Display *dpy = myDpy;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9280
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9281
	if (__isAtomID(propertyID)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9282
	    property = __AtomVal(propertyID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9283
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9284
	    if (__isExternalAddress(windowID)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9285
		window = __WindowVal(windowID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9286
	    } else if (windowID == nil) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9287
		window = DefaultRootWindow(dpy);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9288
	    } else
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9289
		goto fail;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9290
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9291
	    nread = 0;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9292
	    cp = 0;
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9293
#ifdef PROPERTY_DEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  9294
	    console_fprintf(stderr, "getProperty %x\n", property);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9295
#endif
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9296
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9297
	    do {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9298
		int retVal;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9299
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9300
		ENTER_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9301
		retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9302
					    doDelete == true,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9303
					    AnyPropertyType, &actual_type, &actual_format,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9304
					    &nitems, &bytes_after, (unsigned char **)&data);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9305
		LEAVE_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9306
		if (retVal != Success) {
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9307
#ifdef PROPERTY_DEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  9308
		    console_fprintf(stderr, "- no success\n");
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9309
#endif
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9310
		    ok = 0;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9311
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9312
		}
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9313
#ifdef PROPERTY_DEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  9314
		console_fprintf(stderr, "- type:%x\n", actual_type);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9315
#endif
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9316
		nitems *= (actual_format / 8);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9317
		typeID = __MKATOMOBJ(actual_type);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9318
		if (! cp) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9319
		    cp = cp2 = (char *)malloc(nitems+bytes_after);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9320
		} else {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9321
		    cp2 = cp + nread;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9322
		}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9323
		if (! cp) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9324
		    XFree(data);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9325
		    goto fail;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9326
		}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9327
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9328
		nread += nitems;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9329
		bcopy(data, cp2, nitems);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9330
		XFree(data);
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9331
#ifdef PROPERTY_DEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  9332
		console_fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9333
#endif
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9334
	    } while (bytes_after > 0);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9335
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9336
	    if (ok) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9337
		switch (actual_format) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9338
		case 32:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9339
		    val = __stArrayFromCUIntArray(cp, nread/4);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9340
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9341
		case 16:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9342
		    val = __stArrayFromCUShortArray(cp, nread/2);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9343
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9344
		case 8:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9345
		default:
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9346
		    if (actual_type == XA_STRING) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9347
			val = __MKSTRING_L(cp, nread);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9348
		    } else {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9349
			val = __MKBYTEARRAY(cp, nread);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9350
		    }
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9351
		    break;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9352
		}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9353
	    }
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9354
	    if (cp)
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9355
		free(cp);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9356
	}
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9357
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9358
fail: ;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9359
%}.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9360
    typeID isNil ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9361
	^ nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9362
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9363
    ^ typeID->val
3977
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9364
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9365
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9366
     Display
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9367
	getProperty:#'_NET_WM_ICON_GEOMETRY'
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9368
	from:nil
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9369
	delete:false
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9370
    "
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9371
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9372
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9373
propertiesOf:aWindowOrWindowIDOrNil
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9374
    "return a collection of all properties' atomIDs of a window.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9375
     Returns the rootWindows props for a nil window argument."
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9376
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9377
    <context: #return>
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9378
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9379
    |windowID atoms|
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9380
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9381
    aWindowOrWindowIDOrNil isView ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9382
	windowID := aWindowOrWindowIDOrNil id.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9383
    ] ifFalse:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9384
	windowID := aWindowOrWindowIDOrNil.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9385
    ].
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9386
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9387
%{
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9388
    Window window;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9389
    Atom *atomListPtr;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9390
    int i;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9391
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9392
    if (ISCONNECTED) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9393
	Display *dpy = myDpy;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9394
	int numProps = 0;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9395
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9396
	if (__isExternalAddress(windowID)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9397
	    window = __WindowVal(windowID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9398
	} else if (windowID == nil) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9399
	    window = DefaultRootWindow(dpy);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9400
	} else if (__isInteger(windowID)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9401
	    window = (Window)__unsignedLongIntVal(windowID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9402
	} else {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9403
	    goto fail;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9404
	}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9405
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9406
	ENTER_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9407
	atomListPtr = XListProperties(dpy, window, &numProps);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9408
	LEAVE_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9409
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9410
	if (atomListPtr == NULL) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9411
	    RETURN (nil);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9412
	}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9413
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9414
	atoms = __ARRAY_NEW_INT(numProps);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9415
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9416
	if (atoms == nil) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9417
	    goto fail;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9418
	}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9419
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9420
	for (i=0; i<numProps; i++) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9421
	    OBJ atm;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9422
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9423
	    atm = __MKATOMOBJ(atomListPtr[i]);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9424
	    __ArrayInstPtr(atoms)->a_element[i] = atm; __STORE(atoms, atm);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9425
	}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9426
	XFree(atomListPtr);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9427
	RETURN (atoms);
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9428
    }
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9429
fail: ;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9430
%}.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9431
    ^ self primitiveFailed
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9432
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9433
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9434
     Display propertiesOf:nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9435
     Display propertiesOf:Transcript view id
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9436
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9437
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9438
     (Display propertiesOf:nil) do:[:atm |
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9439
	|v|
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9440
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9441
	Transcript show:((Display atomName:atm) printStringLeftPaddedTo:5).
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9442
	Transcript show:': '.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9443
	Display getProperty:atm from:nil delete:false into:[:type :val | v := (Display atomName:type)->val].
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9444
	Transcript showCR:v.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9445
     ]
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9446
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9447
!
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9448
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9449
setProperty:propertyID type:typeID value:anObject for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9450
    "set a property in the XServer"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9451
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9452
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  9453
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9454
    |retval|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9455
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9456
    retval := false.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9457
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9458
%{  /* UNLIMITEDSTACK */
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9459
    if (ISCONNECTED && __isAtomID(propertyID) && __isAtomID(typeID)) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9460
	Display *dpy = myDpy;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9461
	Atom prop, type;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9462
	Window window;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9463
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9464
	prop = __AtomVal(propertyID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9465
	type = __AtomVal(typeID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9466
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9467
	if (__isExternalAddress(aWindowID)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9468
	    window = __WindowVal(aWindowID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9469
	} else if (aWindowID == nil) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9470
	    window = DefaultRootWindow(dpy);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9471
	} else if (__isInteger(aWindowID)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9472
	    window = (Window)__unsignedLongIntVal(aWindowID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9473
	} else {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9474
	    RETURN(false);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9475
	}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9476
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9477
	retval = true;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9478
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9479
	ENTER_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9480
	if (__isInteger(anObject)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9481
	    unsigned INT value = __longIntVal(anObject);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9482
	    XChangeProperty(dpy, window, prop, type, 32,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9483
			    PropModeReplace,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9484
			    (unsigned char *)&value, 1);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9485
	} else if (__isByteArray(anObject)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9486
	    XChangeProperty(dpy, window, prop, type, 8,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9487
			    PropModeReplace,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9488
			    __byteArrayVal(anObject),
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9489
			    __byteArraySize(anObject));
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9490
	} else if (__isWords(anObject)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9491
	    /* wordArray-like (16bit-string) object */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9492
	    XChangeProperty(dpy, window, prop, type, 16,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9493
			    PropModeReplace,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9494
			    __stringVal(anObject),
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9495
			    __wordArraySize(anObject));
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9496
	} else if (__isIntegerArray(anObject)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9497
	    /* array of atoms */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9498
	    XChangeProperty(dpy, window, prop, type, 32,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9499
			    PropModeReplace,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9500
			    (char *)__integerArrayVal(anObject),
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9501
			    __integerArraySize(anObject));
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9502
	} else if (__isStringLike(anObject)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9503
	    XChangeProperty(dpy, window, prop, type, 8,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9504
			    PropModeReplace,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9505
			    __stringVal(anObject),
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9506
			    __stringSize(anObject));
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9507
	} else {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9508
	    retval = false;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9509
	}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9510
	LEAVE_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9511
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9512
	DPRINTF(("changeProp win=%x prop=%x type=%x\n", window, prop, type));
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9513
    }
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9514
%}.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9515
    ^ retval
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9516
! !
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9517
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9518
!XWorkstation methodsFor:'queries'!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9519
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9520
supportedClipboards
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9521
    "answer a collection of symbols with the supported clipboards.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9522
     X11 additionaly supports a buffer containing the currently selected text
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9523
     (in xterm) - the PRIMARY selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9524
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9525
    ^ #(clipboard selection)
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9526
!
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9527
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9528
supportsUTF8WindowLabels
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9529
    "answer true, if window labels are to be utf-8 encoded"
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9530
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9531
    ^ false
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9532
! !
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9533
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9534
!XWorkstation methodsFor:'resources'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9535
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9536
atomIDOf:aStringOrSymbol
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9537
    "return an X11 atoms ID; dont create if not already present.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9538
     This is highly X specific and only for local use (with selections).
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9539
     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
  9540
     speed up future lookups"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9541
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9542
    ^ self atomIDOf:aStringOrSymbol create:true
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9543
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9544
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9545
     Display atomIDOf:#'FACE_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9546
     Display atomIDOf:#'FULL_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9547
     Display atomIDOf:#DndProtocol
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9548
     Display atomIDOf:#DndSelection
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9549
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9550
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  9551
    "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
  9552
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9553
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9554
atomIDOf:aStringOrSymbol create:create
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9555
    "return an Atoms ID given its name.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9556
     If it already exists, return its ID.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9557
     If not and the create argument is true, it is created.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9558
     Otherwise, nil is returned.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9559
     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
  9560
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9561
    |atomSymbol atom|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9562
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9563
    atomSymbol := aStringOrSymbol asSymbol.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9564
    (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:nil) notNil]) ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  9565
	^ atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9566
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9567
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9568
    atom := self primAtomIDOf:atomSymbol create:create.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9569
    atom notNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  9570
	atoms isNil ifTrue:[
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  9571
	    atoms := IdentityDictionary new.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  9572
	].
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  9573
	atoms at:atomSymbol put:atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9574
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9575
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9576
    ^ atom
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9577
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9578
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9579
     Display atomIDOf:#'VT_SELECTION' create:false
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9580
     Display atomIDOf:#CLIPBOARD create:false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9581
     Display atomIDOf:'STRING' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9582
     Display atomIDOf:'PRIMARY' create:false
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9583
     Display atomIDOf:'blabla' create:false
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9584
    "
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9585
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9586
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9587
atomName:anAtomID
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9588
    "given an AtomID, return its name.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9589
     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
  9590
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9591
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9592
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9593
%{
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9594
    OBJ str;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9595
    char *name;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9596
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9597
    if (ISCONNECTED && __isAtomID(anAtomID)) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9598
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9599
	name = XGetAtomName(myDpy, __AtomVal(anAtomID));
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9600
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9601
	if (name == 0) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9602
	    RETURN (nil);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9603
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9604
	str = __MKSTRING(name);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9605
	XFree(name);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9606
	RETURN ( str );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9607
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9608
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9609
    self primitiveFailedOrClosedConnection.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9610
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9611
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9612
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9613
     Display atomName:1    'PRIMARY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9614
     Display atomName:130  '_DEC_DEVICE_FONTNAMES'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9615
     Display atomName:132  'FONTNAME_REGISTRY'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9616
     Display atomName:135 'FOUNDRY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9617
     Display atomName:150  'CHARSET_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9618
     Display atomName:151  'ISO8859'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9619
     Display atomName:152 'CHARSET_ENCODING'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9620
     Display atomName:154
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9621
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9622
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9623
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9624
getResource:name class:cls
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9625
    "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
  9626
     of name in a resource class.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9627
     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
  9628
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9629
     Notice:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9630
	we do not plan to use X's resources for ST/X's defaults,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9631
	styles or resources. This would make porting of applications
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9632
	to different platforms much more difficult (Windows has no resource
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9633
	database). If you stay within ST/X's resource files, these can be
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9634
	easily transported to other platforms.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9635
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9636
     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
  9637
     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
  9638
     platforms."
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9639
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9640
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9641
    char *rslt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9642
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9643
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9644
     && __isNonNilObject(name)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9645
     && (__qIsString(name) || __qIsSymbol(name))
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9646
     && __isNonNilObject(cls)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9647
     && (__qIsString(cls) || __qIsSymbol(cls))) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9648
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  9649
	rslt = XGetDefault(myDpy, (char *) __stringVal(cls),
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  9650
				  (char *) __stringVal(name));
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9651
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9652
	RETURN (rslt ? __MKSTRING(rslt) : nil );
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9653
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9654
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9655
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9656
    ^ nil.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9657
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9658
    "if your ~/.Xdefaults contains an entry such as:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9659
	OpenWindows.Beep:       notices
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9660
     the following returns 'notices'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9661
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9662
	 Display getResource:'Beep' class:'OpenWindows'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9663
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9664
     if your ~/.Xdefaults contains an entry such as:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9665
	*.beNiceToColormap:       false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9666
     the following return 'false'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9667
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9668
	 Display getResource:'beNiceToColormap' class:'any'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9669
	 Display getResource:'beNiceToColormap' class:''
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9670
    "
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9671
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9672
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9673
primAtomIDOf:aStringOrSymbol create:create
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9674
    "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
  9675
     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
  9676
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9677
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9678
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9679
%{
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9680
    Atom prop;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9681
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9682
    if (ISCONNECTED
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9683
     && __isNonNilObject(aStringOrSymbol)
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9684
     && (__qIsString(aStringOrSymbol) || __qIsSymbol(aStringOrSymbol))) {
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9685
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9686
	ENTER_XLIB();
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9687
	prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol),
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9688
				  (create == true) ? False : True);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9689
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9690
	if (prop == None) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9691
	    RETURN (nil);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9692
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9693
	RETURN ( __MKATOMOBJ(prop) );
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9694
    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9695
%}.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9696
    self primitiveFailedOrClosedConnection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9697
    ^ nil
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9698
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9699
    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9700
     Display primAtomIDOf:'VT_SELECTION' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9701
     Display primAtomIDOf:'CUT_BUFFER0' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9702
     Display primAtomIDOf:'STRING' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9703
     Display primAtomIDOf:'PRIMARY' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9704
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9705
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9706
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9707
!XWorkstation methodsFor:'retrieving pixels'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9708
1462
f8b2909deb3c renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  9709
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
  9710
    "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
  9711
     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
  9712
     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
  9713
     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
  9714
     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
  9715
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  9716
    |rawInfo info|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9717
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9718
    ((w <= 0) or:[h <= 0]) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9719
	self primitiveFailed.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9720
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9721
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9722
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  9723
    rawInfo := Array new:8.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9724
		  "1 -> bit order"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9725
		  "2 -> depth"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9726
		  "3 -> bytes_per_line"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9727
		  "4 -> byte_order"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9728
		  "5 -> format"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9729
		  "6 -> bitmap_unit"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9730
		  "7 -> bitmap_pad"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9731
		  "8 -> bits_per_pixel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9732
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9733
    "/ 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
  9734
    "/ unlimitedStack (some implementations use alloca and require huge amounts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9735
    "/ of temporary stack space
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9736
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  9737
    (self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9738
	info := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9739
	info at:#bitOrder put:(rawInfo at:1).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9740
	info at:#depth put:(rawInfo at:2).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9741
	info at:#bytesPerLine put:(rawInfo at:3).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9742
	info at:#byteOrder put:(rawInfo at:4).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9743
	info at:#format put:(rawInfo at:5).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9744
	info at:#bitmapUnit put:(rawInfo at:6).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9745
	info at:#bitmapPad put:(rawInfo at:7).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9746
	info at:#bitsPerPixel put:(rawInfo at:8).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9747
	^ info
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9748
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9749
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9750
     some error occured - either args are not smallintegers, imageBits is not a ByteArray
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9751
     or is too small to hold the bits
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9752
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9753
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9754
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9755
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9756
2713
1aef3acb4e04 need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
  9757
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
  9758
    "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
  9759
     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
  9760
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9761
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  9762
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9763
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9764
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  9765
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9766
    XImage *img;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9767
    int ret;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9768
    int xpos, ypos;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9769
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  9770
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  9771
     && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9772
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9773
	xpos = __intVal(x);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9774
	ypos = __intVal(y);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9775
	if ((xpos < 0) || (ypos < 0)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9776
	    RETURN ( __MKSMALLINT(0) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9777
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9778
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9779
	img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9780
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9781
	if (img != 0) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9782
	    ret = XGetPixel(img, 0, 0);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9783
	    XDestroyImage(img);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9784
	    RETURN (  __MKSMALLINT(ret) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9785
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9786
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9787
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9788
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9789
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9790
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9791
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
  9792
    "since XGetImage may allocate huge amount of stack space
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9793
     (some implementations use alloca), this must run with unlimited stack."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9794
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9795
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  9796
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9797
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9798
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  9799
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9800
    XImage *image = (XImage *)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9801
    int pad, bytes_per_line, numBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9802
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9803
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9804
     && __isExternalAddress(aDrawableId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9805
     && __bothSmallInteger(srcx, srcy)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9806
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9807
     && __isArray(info)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9808
     && __isByteArray(imageBits)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9809
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9810
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9811
	win = __WindowVal(aDrawableId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9812
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9813
	image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9814
				    __intVal(w), __intVal(h),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9815
				    (unsigned)AllPlanes, ZPixmap);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9816
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9817
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9818
	if (! image) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9819
	    RETURN ( false );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9820
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9821
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9822
	pad = image->bitmap_pad;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9823
#ifdef SUPERDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  9824
	console_printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9825
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9826
	switch (image->depth) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9827
	    case 1:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9828
	    case 2:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9829
	    case 4:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9830
	    case 8:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9831
	    case 16:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9832
	    case 24:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9833
	    case 32:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9834
		numBytes = image->bytes_per_line * image->height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9835
		break;
1728
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  9836
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9837
	    default:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9838
		/* unsupported depth ? */
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  9839
		console_fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9840
		numBytes = image->bytes_per_line * image->height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9841
		break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9842
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9843
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9844
#ifdef SUPERDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  9845
	console_printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9846
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9847
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9848
	if (numBytes > __byteArraySize(imageBits)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9849
	    /* imageBits too small */
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  9850
	    console_fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  9851
	    console_fprintf(stderr, "  bytes need:%d given:%d\n", numBytes, __byteArraySize(imageBits));
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  9852
	    console_fprintf(stderr, "  pad:%d depth:%d imgBytesPerLine:%d\n",
1728
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  9853
				image->bitmap_pad, image->depth, image->bytes_per_line);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9854
	    goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9855
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9856
	if (image->bitmap_bit_order == MSBFirst)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9857
	    __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9858
	else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9859
	    __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9860
	__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9861
	__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9862
	if (image->byte_order == MSBFirst)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9863
	    __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9864
	else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9865
	    __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9866
	if (image->format == XYBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9867
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9868
	else if (image->format == XYPixmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9869
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9870
	else if (image->format == ZPixmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9871
	    __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9872
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9873
	__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9874
	__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9875
	__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9876
	bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9877
	XDestroyImage(image);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9878
	RETURN ( true );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9879
    }
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9880
fail:
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9881
    if (image) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9882
	XDestroyImage(image);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9883
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9884
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9885
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9886
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9887
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9888
!XWorkstation methodsFor:'selection fetching'!
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  9889
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9890
addSelectionHandler:someone
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9891
    "register someone to be notified when the selection changes"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9892
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9893
    selectionHandlers isNil ifTrue:[
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9894
	selectionHandlers := IdentitySet new.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9895
    ].
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9896
    selectionHandlers add:someone
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9897
!
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9898
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
  9899
getClipboardObjectFor:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9900
    "get the object selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9901
     Returns nil, if no selection is available.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9902
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9903
     Smalltalk puts ST_OBJECT only into the CLIPBOARD"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9904
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9905
    |selectionOwnerWindowId selection|
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9906
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9907
    selectionOwnerWindowId := self getSelectionOwnerOf:clipboardAtom.
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9908
    selectionOwnerWindowId isNil ifTrue:[
4845
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9909
        "no selection. There is the possibilty that one of our (modal)
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9910
         views has been closed. Get the selection from the copyBuffer"
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9911
        ^ copyBuffer.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9912
    ].
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
  9913
    selectionOwnerWindowId = selectionOwner ifTrue:[
4845
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9914
        "I still hold the selection, so return my locally buffered data"
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9915
        ^ copyBuffer
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9916
    ].
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9917
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9918
    drawableId notNil ifTrue:[
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9919
        "sorry, cannot fetch a selection, if there is now drawableId.
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9920
         Should I borrow a drawableId from another window?"
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9921
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9922
        selection := SelectionFetcher
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9923
            requestSelection:clipboardAtom
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9924
            type:(self atomIDOf:#'ST_OBJECT')
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9925
            onDevice:self for:drawableId.
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9926
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9927
        selection isNil ifTrue:[
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9928
            selection := SelectionFetcher
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9929
                requestSelection:clipboardAtom
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9930
                type:(self atomIDOf:#'UTF8_STRING')
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9931
                onDevice:self for:drawableId.
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9932
        ].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9933
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9934
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9935
    ^ selection.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9936
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9937
    "
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9938
       Display getSelectionFor:Transcript id
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9939
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9940
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9941
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
  9942
getClipboardText:selectionBufferSymbol for:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9943
    "get the text selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9944
     Returns nil, if no selection is available"
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9945
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9946
    |selectionId selectionOwnerWindowId selection|
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9947
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9948
    selectionBufferSymbol == #selection ifTrue:[
4845
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9949
        selectionId := primaryAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9950
    ] ifFalse:[
4845
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9951
        selectionId := clipboardAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9952
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9953
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9954
    selectionOwnerWindowId := self getSelectionOwnerOf:selectionId.
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9955
    selectionOwnerWindowId isNil ifTrue:[
4845
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9956
        "no selection. There is the possibilty that one of our (modal)
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9957
         views has been closed. Get the selection from the copyBuffer"
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9958
        ^ self copyBufferAsString.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9959
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9960
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
  9961
    selectionOwnerWindowId = selectionOwner ifTrue:[
4845
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9962
        "I still hold the selection, so return my locally buffered data"
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9963
        ^ self copyBufferAsString.
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9964
    ].
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9965
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9966
    drawableId notNil ifTrue:[
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9967
        "sorry, cannot fetch a selection, if there is now drawableId.
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9968
         Should I borrow a drawableId from another window?"
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9969
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9970
        selection := SelectionFetcher
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9971
            requestSelection:selectionId
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9972
            type:(self atomIDOf:#'UTF8_STRING')
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9973
            onDevice:self for:drawableId.
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9974
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9975
        selection isNil ifTrue:[
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9976
            selection := SelectionFetcher
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9977
                requestSelection:selectionId
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9978
                type:(self atomIDOf:#STRING)
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9979
                onDevice:self for:drawableId.
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
  9980
        ].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9981
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9982
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9983
    ^ selection
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9984
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9985
     "
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9986
       Display getTextSelection:#clipboard for:Transcript id
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9987
       Display getTextSelection:#selection for:Transcript id
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9988
     "
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9989
!
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9990
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9991
removeSelectionHandler:someone
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9992
    "no longer tell someone about selection changes"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9993
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9994
    selectionHandlers notNil ifTrue:[
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9995
	selectionHandlers remove:someone ifAbsent:nil.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9996
	selectionHandlers isEmpty ifTrue:[
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9997
	    selectionHandlers := nil
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9998
	]
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9999
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10000
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10001
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10002
!XWorkstation methodsFor:'selection sending'!
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10003
4282
b487fe05c51d Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents: 4280
diff changeset
 10004
copyBufferAs:aTargetAtom
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10005
    "convert the current selection to the format defined by aTargetAtom.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10006
     Answer the converted selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10007
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10008
    (aTargetAtom == (self atomIDOf:#STRING)) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10009
	"the other view wants the selection as string"
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10010
	^ self copyBufferAsString.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10011
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10012
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10013
    (aTargetAtom == (self atomIDOf:#UTF8_STRING)) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10014
	"the other view wants the selection as utf8 string"
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10015
	^ self copyBufferAsString utf8Encoded.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10016
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10017
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10018
    (aTargetAtom == (self atomIDOf:#TIMESTAMP)) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10019
	"the other view wants to know when we acquired ownership of the selection"
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10020
	^ selectionTime.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10021
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10022
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10023
    (aTargetAtom == (self atomIDOf:#TARGETS)) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10024
	"the other view wants to know which targets we support"
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10025
	^ self supportedTargetAtoms.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10026
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10027
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10028
    (aTargetAtom == (self atomIDOf:#'ST_OBJECT')) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10029
	"send the selection in binaryStore format"
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10030
	"require libboss to be loaded"
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10031
	(Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[^ nil].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10032
	^ self getCopyBuffer binaryStoreBytes.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10033
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10034
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10035
    aTargetAtom == (self atomIDOf:#LENGTH) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10036
	"the other one wants to know the size of our selection.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10037
	 LENGTH is deprecated, since we do not know how the selection is
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10038
	 going to be converted. The client must not rely on the length returned"
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10039
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10040
	^ self copyBufferAsString size
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10041
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10042
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10043
    "we do not support the requestet target type"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10044
    ^ nil.
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 10045
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 10046
    "Modified: / 23-08-2006 / 15:56:08 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10047
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10048
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 10049
setClipboardObject:anObject owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10050
    "set the object selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10051
     This can be used by other Smalltalk(X) applications only.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10052
     We set only the CLIPBOARD selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10053
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10054
    selectionTime := lastEventTime.
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 10055
    self setSelectionOwner:aWindowId of:clipboardAtom time:selectionTime
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10056
!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10057
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 10058
setClipboardText:aString owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10059
    "set the text selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10060
     This can be used by any other X application.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10061
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10062
     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
 10063
     into xterm."
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10064
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10065
    selectionTime := lastEventTime.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10066
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 10067
    self setSelectionOwner:aWindowId of:clipboardAtom time:selectionTime.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10068
    self setSelectionOwner:aWindowId of:primaryAtom time:selectionTime.
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10069
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10070
    "Modified: / 17.6.1998 / 19:48:54 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10071
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10072
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10073
supportedTargetAtoms
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10074
    "answer an integer array containing the list of supported targets
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10075
     i.e. supported clipboard formats"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10076
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10077
    |supportedTargets numericTargetArray|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10078
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 10079
    supportedTargets := #(ST_OBJECT STRING UTF8_STRING TIMESTAMP TARGETS LENGTH).
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10080
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10081
    numericTargetArray := IntegerArray new:supportedTargets size.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10082
    supportedTargets keysAndValuesDo:[:index :targetSymbol|
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10083
	numericTargetArray at:index put:(self atomIDOf:targetSymbol)
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10084
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10085
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10086
    ^ numericTargetArray
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10087
! !
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10088
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10089
!XWorkstation methodsFor:'selections-basic'!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10090
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10091
getSelectionOwnerOf:selectionAtomSymbolOrID
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10092
    "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
 10093
     Answer nil, if there is no owner"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10094
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10095
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10096
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10097
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10098
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10099
    selectionAtomSymbolOrID isString ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10100
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10101
    ] ifFalse:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10102
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10103
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10104
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10105
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10106
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10107
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10108
    if (__isAtomID(selectionAtomID) && ISCONNECTED) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10109
	Display *dpy = myDpy;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10110
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10111
	ENTER_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10112
	window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10113
	LEAVE_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10114
	RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10115
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10116
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10117
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10118
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10119
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10120
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10121
requestSelection:selectionID type:typeID for:aWindowId intoProperty:propertyID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10122
    "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
 10123
     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
 10124
     with the selections value)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10125
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10126
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10127
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10128
    |anIntegerTimestamp|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10129
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10130
    anIntegerTimestamp := lastEventTime.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10131
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10132
%{
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10133
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10134
    if (ISCONNECTED
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10135
     && __isAtomID(typeID)
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10136
     && __isAtomID(propertyID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10137
     && __isAtomID(selectionID)) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10138
	Display *dpy = myDpy;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10139
	Window w;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10140
	Time time;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10141
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10142
	if (__isExternalAddress(aWindowId)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10143
	    w = __WindowVal(aWindowId);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10144
	} else if (aWindowId == nil) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10145
	    w = (Window)0;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10146
	} else
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10147
	    goto err;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10148
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10149
	if (anIntegerTimestamp == nil) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10150
	    /*
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10151
	     * the ICCCM convention says: you should set the time to the time when
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10152
	     * the selection was requested and not to CurrentTime
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10153
	     */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10154
	    time = CurrentTime;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10155
	} else if (__isInteger(anIntegerTimestamp)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10156
	    time = __unsignedLongIntVal(anIntegerTimestamp);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10157
	} else
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10158
	    goto err;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10159
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10160
	ENTER_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10161
	XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID),
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10162
			       __AtomVal(propertyID), w, time);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10163
	LEAVE_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10164
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10165
	RETURN (true);
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10166
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10167
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10168
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10169
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10170
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10171
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10172
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10173
     Display
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10174
	requestSelection:(Display atomIDOf:'PRIMARY')
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10175
	property:(Display atomIDOf:'VT_SELECTION')
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10176
	type:(Display atomIDOf:'STRING')
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10177
	for:Transcript id
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10178
    "
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10179
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10180
     Display
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10181
	requestSelection:(Display atomIDOf:'PRIMARY')
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10182
	property:(Display atomIDOf:'VT_SELECTION')
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10183
	type:(Display atomIDOf:'C_STRING')
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10184
	for:Transcript id
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10185
    "
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10186
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10187
4286
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 10188
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
 10189
    "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
 10190
     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
 10191
     could not be converted.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10192
     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
 10193
     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
 10194
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10195
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10196
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10197
    if (ISCONNECTED
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10198
	&& (__isAtomID(propertyID) || propertyID == nil)
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10199
	&& __isAtomID(targetID) && __isAtomID(selectionID)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10200
	Display *dpy = myDpy;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10201
	XEvent ev;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10202
	Window requestor;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10203
	Status result;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10204
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10205
	if (__isExternalAddress(requestorID)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10206
	    requestor = __WindowVal(requestorID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10207
	} else if (__isSmallInteger(requestorID)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10208
	    requestor = (Window)__smallIntegerVal(requestorID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10209
	} else if (requestorID == nil) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10210
	    requestor = DefaultRootWindow(dpy);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10211
	} else {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10212
	    requestor = (Window)__unsignedLongIntVal(requestorID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10213
	}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10214
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10215
	ev.xselection.type = SelectionNotify;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10216
	ev.xselection.display = dpy;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10217
	ev.xselection.selection = __AtomVal(selectionID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10218
	ev.xselection.target = __AtomVal(targetID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10219
	ev.xselection.requestor = requestor;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10220
4286
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 10221
	if (__isExternalAddress(aTime)) {
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 10222
	    ev.xselection.time = (INT)(__externalAddressVal(aTime));
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 10223
	} else if (__isSmallInteger(aTime)) {
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 10224
	    ev.xselection.time = __smallIntegerVal(aTime);
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 10225
	} else if (aTime == nil) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10226
	    ev.xselection.time = CurrentTime;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10227
	} else {
4286
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 10228
	    ev.xselection.time = (INT)__unsignedLongIntVal(aTime);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10229
	}
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
 10230
#if 0
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
 10231
	console_printf("ev.xselection.selection: %x\n", ev.xselection.selection);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
 10232
	console_printf("ev.xselection.target: %x\n", ev.xselection.target);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
 10233
	console_printf("ev.xselection.requestor: %x\n", ev.xselection.requestor);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
 10234
	console_printf("ev.xselection.time: %x\n", ev.xselection.time);
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
 10235
	console_printf("requestor: %x\n", requestor);
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10236
#endif
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10237
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10238
	/* send nil property if selection cannot be converted */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10239
	if (propertyID == nil)
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10240
	    ev.xselection.property = None;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10241
	else
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10242
	    ev.xselection.property = __AtomVal(propertyID);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10243
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10244
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10245
	DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n",
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10246
		ev.xselection.selection,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10247
		ev.xselection.property,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10248
		ev.xselection.target,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10249
		ev.xselection.requestor,
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10250
		requestor));
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10251
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10252
	ENTER_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10253
	result = XSendEvent(dpy, requestor, False, 0 , &ev);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10254
	LEAVE_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10255
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10256
	if ((result == BadValue) || (result == BadWindow)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10257
	    DPRINTF(("bad status\n"));
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10258
	    RETURN (false);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10259
	}
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10260
	ENTER_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10261
	XFlush(dpy);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10262
	LEAVE_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10263
	RETURN (true)
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10264
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10265
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10266
    self primitiveFailedOrClosedConnection.
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
 10267
    ^ false
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10268
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10269
    "Modified: / 17.6.1998 / 20:23:20 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10270
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10271
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10272
setSelectionOwner:aWindowId of:selectionAtomSymbolOrID time:anIntegerTimestamp
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10273
    "set the owner of a selection; return false if failed"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10274
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10275
    <context: #return>
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10276
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10277
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10278
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10279
    "store the current owner of the selection.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10280
     If we still own the selection on paste,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10281
     we can avoid the X11 overhead"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10282
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10283
    selectionOwner := aWindowId.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10284
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10285
    selectionAtomSymbolOrID isString ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10286
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10287
    ] ifFalse:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10288
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10289
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10290
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10291
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10292
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10293
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10294
    if (__isExternalAddress(aWindowId)
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10295
     && __isAtomID(selectionAtomID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10296
     && ISCONNECTED) {
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10297
	Display *dpy = myDpy;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10298
	Time time;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10299
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10300
	win = __WindowVal(aWindowId);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10301
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10302
	if (anIntegerTimestamp == nil) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10303
	    /*
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10304
	     * the ICCCM convention says: you should set the time to the time when
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10305
	     * the selection was acquired and not to CurrentTime
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10306
	     */
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10307
	    time = CurrentTime;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10308
	} else if (__isInteger(anIntegerTimestamp)) {
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10309
	    time = __unsignedLongIntVal(anIntegerTimestamp);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10310
	} else
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10311
	    goto err;
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10312
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10313
	DPRINTF(("setOwner prop=%x win=%x\n", __AtomVal(selectionAtomID), win));
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10314
	ENTER_XLIB();
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10315
	XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, time);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10316
	RETURN (self);
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10317
	LEAVE_XLIB();
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10318
    }
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10319
err:;
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10320
%}.
3303
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
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10324
!XWorkstation methodsFor:'window queries'!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10325
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10326
allChildIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10327
    "return all children-ids of the given window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10328
     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
 10329
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10330
    |childIDs allChildIDs|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10331
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10332
    allChildIDs := OrderedCollection new.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10333
    childIDs := self childIdsOf:aWindowId.
4411
5e5d008efba2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
 10334
    childIDs notNil ifTrue:[
4469
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10335
	allChildIDs addAll:childIDs.
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10336
	childIDs do:[:eachChildId |
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10337
	    allChildIDs addAll:(self allChildIdsOf:eachChildId).
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10338
	].
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10339
    ].
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10340
    ^ allChildIDs
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10341
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10342
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10343
     Display allChildIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10344
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10345
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10346
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10347
     |deviceIDAtom uuidAtom|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10348
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10349
     deviceIDAtom := (Display atomIDOf:#'STX_DEVICE_ID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10350
     uuidAtom     := (Display atomIDOf:#'UUID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10351
     (Display allChildIdsOf:(Display rootWindowId))
4469
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10352
	select:[:id |
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10353
	    |uuid|
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10354
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10355
	    Display
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10356
		getProperty:deviceIDAtom
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10357
		from:id
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10358
		delete:false
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10359
		into:[:type :value |
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10360
		    type == uuidAtom ifTrue:[
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10361
			uuid := UUID fromBytes:value.
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10362
		    ].
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10363
		].
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10364
	    uuid notNil.
19d67853c6d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
 10365
	]
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10366
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10367
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10368
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10369
childIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10370
    "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
 10371
     enumerated, if we start at the root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10372
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10373
    |childIdArray|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10374
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10375
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10376
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10377
    if (ISCONNECTED
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10378
     && __isExternalAddress(aWindowId)) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10379
	Display *dpy = myDpy;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10380
	Window win = __WindowVal(aWindowId);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10381
	Window rootReturn, parentReturn;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10382
	Window* children = (Window *)0;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10383
	unsigned int numChildren;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10384
	int i;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10385
	int rslt;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10386
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10387
	ENTER_XLIB();
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10388
	rslt = XQueryTree(dpy, win,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10389
		       &rootReturn, &parentReturn,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10390
		       &children, &numChildren);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10391
	LEAVE_XLIB();
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10392
	if (rslt) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10393
	    childIdArray = __ARRAY_NEW_INT(numChildren);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10394
	    if (childIdArray != nil) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10395
		for (i=0; i < numChildren; i++) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10396
		    if (children[i]) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10397
			OBJ childId;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10398
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10399
			childId = __MKEXTERNALADDRESS(children[i]);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10400
			__ArrayInstPtr(childIdArray)->a_element[i] = childId;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10401
			__STORE(childIdArray, childId);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10402
		    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10403
		}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10404
		if (children) XFree(children);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10405
	    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10406
	    RETURN (childIdArray);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10407
	}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10408
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10409
%}.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10410
    ^ nil.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10411
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10412
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10413
      Display childIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10414
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10415
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10416
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10417
realRootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10418
    "return the id of the real root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10419
     This may not be the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10420
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10421
     of it. Except for very special cases, use #rootWindowId, which takes
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10422
     care of any virtual root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10423
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10424
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10425
    int screen = __intVal(__INST(screen));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10426
    Window root;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10427
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10428
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10429
    if (__INST(rootId) != nil) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10430
	RETURN (__INST(rootId));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10431
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10432
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10433
    if (ISCONNECTED) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10434
	root = RootWindow(myDpy, screen);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10435
	if (! root) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10436
	    id = nil;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10437
	} else {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10438
	    id = __MKEXTERNALADDRESS(root); __INST(rootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10439
	}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10440
	RETURN (id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10441
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10442
%}.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10443
    self primitiveFailedOrClosedConnection.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10444
    ^ nil
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10445
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10446
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10447
rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10448
    "return the id of the root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10449
     This is the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10450
     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
 10451
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10452
     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
 10453
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10454
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10455
    int screen = __intVal(__INST(screen));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10456
    Window rootWin, vRootWin = 0;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10457
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10458
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10459
    if (__INST(virtualRootId) != nil) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10460
	RETURN (__INST(virtualRootId));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10461
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10462
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10463
    if (ISCONNECTED) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10464
	Display *dpy = myDpy;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10465
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10466
	rootWin = RootWindow(dpy, screen);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10467
#ifndef IRIS
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10468
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10469
	/*
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10470
	 * on IRIS, this creates a badwindow error - why ?
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10471
	 * children contains a funny window (000034)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10472
	 */
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10473
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10474
	/*
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10475
	 * care for virtual root windows (tvtwm & friends)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10476
	 */
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10477
	{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10478
	    Atom vRootAtom, kwinAtom;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10479
	    int i;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10480
	    Window rootReturn, parentReturn;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10481
	    Window* children = (Window *)0;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10482
	    unsigned int numChildren;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10483
	    int ignoreVRoot = 0;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10484
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10485
	    /*
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10486
	     * Take care of KDE 2.1.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10487
	     * they define _SWM_ROOT but this is not the parent of
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10488
	     * the application windows.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10489
	     * Instead it is used for background painting
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10490
	     */
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10491
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10492
	    kwinAtom = XInternAtom(dpy, "KWIN_RUNNING", True);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10493
	    if (kwinAtom != None) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10494
		Atom actual_type;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10495
		int actual_format;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10496
		unsigned long nitems, bytesafter;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10497
		unsigned char *retVal = 0;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10498
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10499
		ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10500
				       0L, 1L, False, kwinAtom,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10501
				       &actual_type, &actual_format,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10502
				       &nitems, &bytesafter, &retVal) == Success
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10503
			      && actual_type != 0;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10504
		if (retVal)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10505
		    XFree(retVal);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10506
	    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10507
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10508
	    if (!ignoreVRoot) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10509
		vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10510
		if (vRootAtom != None) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10511
		    if (XQueryTree(dpy, rootWin,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10512
				       &rootReturn, &parentReturn,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10513
				       &children, &numChildren)) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10514
			for (i=0; i < numChildren; i++) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10515
			    Atom actual_type;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10516
			    int actual_format;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10517
			    unsigned long nitems, bytesafter;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10518
			    Window* newRoot = (Window*) 0;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10519
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10520
			    if (children[i]) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10521
				if (XGetWindowProperty(dpy, children[i], vRootAtom,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10522
						       0L, 1L, False, XA_WINDOW,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10523
						       &actual_type, &actual_format,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10524
						       &nitems, &bytesafter,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10525
						       (unsigned char**) &newRoot
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10526
						      ) == Success && newRoot) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10527
				    vRootWin = *newRoot;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10528
				    XFree(newRoot); /* XXX */
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10529
				    break;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10530
				}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10531
			    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10532
			}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10533
			if (children) XFree(children);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10534
		    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10535
		}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10536
	     }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10537
	}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10538
#endif
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10539
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10540
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10541
    if (! vRootWin) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10542
	vRootWin = rootWin;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10543
	if (! vRootWin) {
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10544
	    RETURN ( nil );
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10545
	}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10546
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10547
    id = __MKEXTERNALADDRESS(rootWin); __INST(rootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10548
    id = __MKEXTERNALADDRESS(vRootWin); __INST(virtualRootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10549
    RETURN ( id );
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10550
%}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10551
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10552
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10553
      Display rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10554
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10555
! !
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10556
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10557
!XWorkstation methodsFor:'window stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10558
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10559
clearRectangleX:x y:y width:width height:height in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10560
    "clear a rectangular area to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10561
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10562
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10563
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10564
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10565
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10566
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10567
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10568
	if (__isExternalAddress(aWindowId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10569
	 && __bothSmallInteger(x, y)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10570
	 && __bothSmallInteger(width, height)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10571
	    w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10572
	    h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10573
	    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10574
	     * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10575
	     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10576
	    if ((w >= 0) && (h >= 0)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10577
		ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10578
		XClearArea(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10579
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10580
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10581
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10582
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10583
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10584
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10585
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10586
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10587
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10588
clearWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10589
    "clear a window to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10590
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10591
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10592
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10593
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10594
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10595
	if (__isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10596
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10597
	    XClearWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10598
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10599
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10600
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10601
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10602
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10603
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10604
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10605
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10606
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10607
    "configure stacking operation of aWindowId w.r.t siblingId"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10608
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10609
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10610
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10611
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10612
    XWindowChanges chg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10613
    int mask = CWSibling | CWStackMode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10614
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10615
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10616
	if (__isExternalAddress(aWindowId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10617
	 && __isExternalAddress(siblingId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10618
	    if (modeSymbol == @symbol(above)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10619
		chg.stack_mode = Above;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10620
	    } else if (modeSymbol == @symbol(below)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10621
		chg.stack_mode = Below;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10622
	    } else if (modeSymbol == @symbol(topIf)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10623
		chg.stack_mode = TopIf;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10624
	    } else if (modeSymbol == @symbol(bottomIf)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10625
		chg.stack_mode = BottomIf;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10626
	    } else if (modeSymbol == @symbol(opposite)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10627
		chg.stack_mode = Opposite;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10628
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10629
		mask = CWSibling;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10630
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10631
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10632
	    chg.sibling = __WindowVal(siblingId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10633
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10634
	    XConfigureWindow(myDpy, __WindowVal(aWindowId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10635
				    mask, &chg);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10636
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10637
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10638
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10639
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10640
bad: ;
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10641
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10642
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10643
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10644
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10645
getGeometryOf:aWindowId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10646
    "get a windows geometry.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10647
     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
 10648
     decoration views (top label, resize boundaries etc.).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10649
     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
 10650
     relative to such a wrapper.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10651
     In contrast, the values found in the views instance variables are virtual dimensions
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10652
     (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
 10653
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10654
    <context: #return>
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10655
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10656
    |x y width height depth borderWidth info|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10657
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10658
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10659
    int x_ret, y_ret;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10660
    unsigned int width_ret, height_ret,
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10661
		 border_width_ret, depth_ret;
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10662
    Window root_ret;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10663
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10664
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10665
     && __isExternalAddress(aWindowId)) {
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10666
	ENTER_XLIB();
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10667
	XGetGeometry(myDpy, __WindowVal(aWindowId),
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10668
		     &root_ret,
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10669
		     &x_ret, &y_ret,
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10670
		     &width_ret, &height_ret, &border_width_ret,
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10671
		     &depth_ret);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10672
	LEAVE_XLIB();
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10673
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10674
	x = __MKSMALLINT(x_ret);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10675
	y = __MKSMALLINT(y_ret);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10676
	width = __MKSMALLINT(width_ret);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10677
	height = __MKSMALLINT(height_ret);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10678
	depth = __MKSMALLINT(depth_ret);
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10679
	borderWidth = __MKSMALLINT(border_width_ret);
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10680
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10681
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10682
    borderWidth isNil ifTrue:[
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10683
	self primitiveFailedOrClosedConnection.
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10684
	^ nil
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10685
    ].
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10686
    info := Dictionary new.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10687
    info at:#origin put:(x @ y).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10688
    info at:#extent put:(width @ height).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10689
    info at:#depth  put:depth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10690
    info at:#borderWidth put:borderWidth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10691
    ^ info
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10692
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10693
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10694
     Transcript topView device
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10695
	getGeometryOf:(Transcript id)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10696
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10697
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10698
     Transcript topView device
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10699
	getGeometryOf:(Transcript topView id)
4024
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10700
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10701
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10702
     Display
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
 10703
	getGeometryOf:(Display viewIdFromUser)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10704
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10705
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10706
     |d|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10707
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10708
     d := Transcript topView device.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10709
     d getGeometryOf:(d parentWindowIdOf:Transcript topView id)
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10710
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10711
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10712
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10713
isValidWindowId:aWindowId
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10714
    "return true, if the given window ID is (still) valid.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10715
     Especially useful, if the passed windowID is
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10716
     an alien (external) windows id."
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10717
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10718
    |ret|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10719
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10720
%{
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10721
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10722
    if (ISCONNECTED
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10723
     && __isExternalAddress(aWindowId)) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10724
	char *name = NULL;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10725
	Status ok;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10726
	Window root, parent, *children = NULL;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10727
	int nChildren;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10728
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10729
/*        ENTER_XLIB(); */
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10730
	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10731
			&root, &parent, &children, &nChildren);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10732
	if (children) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10733
	    XFree(children);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10734
	}
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10735
/*        LEAVE_XLIB();   */
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10736
	if (ok) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10737
	    RETURN (true);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10738
	}
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10739
	RETURN (false);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10740
    }
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10741
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10742
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10743
    ^ false
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10744
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10745
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10746
     |v aWindowId ok|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10747
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10748
     v := StandardSystemView new.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10749
     v label:'hello'.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10750
     v openAndWait.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10751
     aWindowId := v id.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10752
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10753
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10754
     Delay waitForSeconds:1.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10755
     v destroy.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10756
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10757
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10758
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10759
!
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10760
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10761
lowerWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10762
    "bring a window to back"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10763
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10764
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10765
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10766
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10767
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10768
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10769
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10770
	XLowerWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10771
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10772
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10773
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10774
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10775
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10776
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10777
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10778
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10779
	      width:w height:h minExtent:minExt maxExtent:maxExt
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10780
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10781
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10782
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10783
    "make a window visible - either as icon or as a real view
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10784
     in addition, allow change of extend, position, minExtend and maxExtent.
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10785
     Needed for restart, to allow recreating a view as iconified,
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10786
     and to collaps/expand windows."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10787
4480
3e1449309dfa Set icon mask in #mapWindow:....
Stefan Vogel <sv@exept.de>
parents: 4478
diff changeset
 10788
    |wicon wiconId iconMaskId wiconView wiconViewId wlabel minW minH maxW maxH|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10789
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10790
    aBoolean ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10791
	wicon := aView icon.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10792
	wicon notNil ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10793
	    wiconId := wicon id.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10794
	    wicon mask notNil ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10795
		iconMaskId := wicon mask id.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10796
	    ].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10797
	].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10798
	wiconView := aView iconView.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10799
	wiconView notNil ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10800
	    wiconViewId := wiconView id
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10801
	].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10802
	wlabel := aView label.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10803
    ].
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10804
    minExt notNil ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10805
	minW := minExt x.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10806
	minH := minExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10807
    ].
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10808
    maxExt notNil ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10809
	maxW := maxExt x.
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10810
	maxH := maxExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10811
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10812
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10813
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10814
    XWMHints wmhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10815
    XSizeHints szhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10816
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10817
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10818
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10819
     && __isExternalAddress(aWindowId)) {
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10820
	Display *dpy = myDpy;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10821
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10822
	win = __WindowVal(aWindowId);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10823
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10824
	szhints.flags = 0;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10825
	if (__bothSmallInteger(xPos, yPos)) {
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10826
	    szhints.x = __intVal(xPos);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10827
	    szhints.y = __intVal(yPos);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10828
	    szhints.flags |= USPosition;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10829
	}
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10830
	if (__bothSmallInteger(w, h)) {
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10831
	    szhints.width = __intVal(w);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10832
	    szhints.height = __intVal(h);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10833
	    szhints.flags |= USSize;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10834
	}
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10835
	if (__bothSmallInteger(minW, minH)) {
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10836
	    szhints.flags |= PMinSize;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10837
	    szhints.min_width = __intVal(minW);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10838
	    szhints.min_height = __intVal(minH);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10839
	}
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10840
	if (__bothSmallInteger(maxW, maxH)) {
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10841
	    szhints.flags |= PMaxSize;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10842
	    szhints.max_width = __intVal(maxW);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10843
	    szhints.max_height = __intVal(maxH);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10844
	}
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10845
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10846
	if (aBoolean == true) {
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10847
	    char *windowName = "";
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10848
	    Pixmap iconBitmap = (Pixmap)0;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10849
	    Pixmap iconMask = (Pixmap)0;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10850
	    Window iconWindow = (Window)0;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10851
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10852
	    if (__isExternalAddress(wiconId))
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10853
		iconBitmap = __PixmapVal(wiconId);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10854
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10855
	    if (__isExternalAddress(iconMaskId)) {
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10856
		iconMask = __PixmapVal(iconMaskId);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10857
	    }
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10858
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10859
	    if (__isExternalAddress(wiconViewId))
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10860
		iconWindow = __WindowVal(wiconViewId);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10861
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10862
	    if (__isString(wlabel) || __isSymbol(wlabel))
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10863
		windowName = (char *) __stringVal(wlabel);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10864
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10865
	    if (iconBitmap || windowName) {
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10866
		ENTER_XLIB();
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10867
		XSetStandardProperties(dpy, win,
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10868
					windowName, windowName,
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10869
					iconBitmap,
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10870
					0, 0, &szhints);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10871
		LEAVE_XLIB();
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10872
	    }
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10873
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10874
	    wmhints.flags = 0;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10875
	    if (iconBitmap) {
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10876
		wmhints.flags |= IconPixmapHint;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10877
		wmhints.icon_pixmap = iconBitmap;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10878
	    }
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10879
	    if (iconMask) {
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10880
		wmhints.flags |= IconMaskHint;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10881
		wmhints.icon_mask = iconMask;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10882
	    }
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10883
	    if (iconWindow) {
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10884
		wmhints.flags |= IconWindowHint;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10885
		wmhints.icon_window = iconWindow;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10886
	    }
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10887
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10888
	    wmhints.initial_state = IconicState;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10889
	    wmhints.flags |= StateHint;
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10890
	    ENTER_XLIB();
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10891
	    XSetWMHints(dpy, win, &wmhints);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10892
	    LEAVE_XLIB();
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10893
	}
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10894
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10895
	if (szhints.flags) {
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10896
	    ENTER_XLIB();
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10897
	    XSetNormalHints(dpy, win, &szhints);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10898
	    LEAVE_XLIB();
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10899
	}
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10900
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10901
	ENTER_XLIB();
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10902
	XMapWindow(dpy, win);
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10903
	LEAVE_XLIB();
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 10904
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10905
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10906
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10907
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10908
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10909
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10910
mapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10911
    "make a window visible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10912
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10913
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10914
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10915
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10916
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10917
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10918
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10919
	XMapWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10920
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10921
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10922
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10923
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10924
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10925
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10926
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10927
moveResizeWindow:aWindowId x:x y:y width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10928
    "move and resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10929
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10930
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10931
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10932
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10933
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10934
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10935
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10936
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10937
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10938
     && __bothSmallInteger(x, y)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10939
	newWidth = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10940
	newHeight = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10941
	if (newWidth < 1) newWidth = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10942
	if (newHeight < 1) newHeight = 1;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10943
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10944
	XMoveResizeWindow(myDpy, __WindowVal(aWindowId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10945
			      __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10946
			      newWidth, newHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10947
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10948
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10949
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10950
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10951
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10952
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10953
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10954
moveWindow:aWindowId x:x y:y
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10955
    "move a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10956
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10957
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10958
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10959
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10960
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10961
     && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10962
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10963
	XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10964
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10965
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10966
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10967
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10968
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10969
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10970
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10971
parentWindowIdOf:aWindowId
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10972
    "return a windows parent-window id.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10973
     Useful with getGeometryOf:, to compute information about the decoration."
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10974
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10975
%{
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10976
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10977
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10978
     && __isExternalAddress(aWindowId)) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10979
	Status ok;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10980
	Window root, parent, *children = NULL;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10981
	int nChildren;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10982
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10983
/*        ENTER_XLIB(); */
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10984
	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10985
			&root, &parent, &children, &nChildren);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10986
	if (children) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10987
	    XFree(children);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10988
	}
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10989
/*        LEAVE_XLIB();   */
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10990
	if (! ok) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10991
	    RETURN ( nil );
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10992
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10993
	RETURN ( __MKEXTERNALADDRESS(parent) );
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10994
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10995
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10996
    self primitiveFailedOrClosedConnection.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10997
    ^ false
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10998
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10999
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11000
     |id|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11001
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11002
     id := Transcript device parentWindowIdOf:(Transcript id).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11003
     self assert: ( Transcript container id = id ).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11004
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11005
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11006
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11007
primSetWindowName:aString in:aWindowId
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11008
    "define a windows name"
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11009
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11010
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11011
%{
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11012
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11013
    if (ISCONNECTED
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11014
     && __isNonNilObject(aString)
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11015
     && (__qIsString(aString) || __qIsSymbol(aString))
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11016
     && __isExternalAddress(aWindowId)) {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11017
	ENTER_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11018
	XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString));
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11019
	LEAVE_XLIB();
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11020
	RETURN ( self );
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11021
    }
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11022
%}.
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11023
    self primitiveFailedOrClosedConnection
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11024
!
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11025
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11026
raiseWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11027
    "bring a window to front"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11028
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11029
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11030
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11031
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11032
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11033
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11034
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11035
	XRaiseWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11036
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11037
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11038
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11039
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11040
    self primitiveFailedOrClosedConnection
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11041
!
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11042
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11043
reparentWindow:windowId to:newParentWindowId
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11044
    "change a windows parent (an optional interface)"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11045
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11046
    <context: #return>
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11047
%{
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11048
    if (ISCONNECTED
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11049
     && __isExternalAddress(windowId)
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11050
     && __isExternalAddress(newParentWindowId)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11051
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11052
	Window _child, _newParent;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11053
	int i;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11054
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11055
	_child = __WindowVal(windowId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11056
	_newParent = __WindowVal(newParentWindowId);
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11057
	ENTER_XLIB();
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11058
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 11059
#if 0
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11060
	XWithdrawWindow (dpy, _child, DefaultScreen(dpy));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11061
	XSync (dpy, 0);
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 11062
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11063
	/*
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11064
	 * Code 'stolen' from xswallow source ...
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11065
	 * ... mhmh - what is this loop for ?
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11066
	 */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11067
	for (i=0; i<5; i++) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11068
	    XReparentWindow (dpy, _child, _newParent, 0, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11069
	    XSync (dpy, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11070
	}
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 11071
#if 0
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11072
	XMapWindow (dpy, _child);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11073
	XSync (dpy, 0);
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 11074
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11075
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11076
	RETURN ( true );
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11077
    }
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11078
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11079
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11080
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11081
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11082
resizeWindow:aWindowId width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11083
    "resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11084
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11085
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11086
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11087
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11088
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11089
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11090
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11091
     && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11092
	newWidth = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11093
	newHeight = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11094
	if (newWidth < 1) newWidth = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11095
	if (newHeight < 1) newHeight = 1;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11096
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11097
	XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11098
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11099
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11100
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11101
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11102
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11103
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11104
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11105
setBackingStore:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11106
    "turn on/off backing-store for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11107
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11108
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11109
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11110
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11111
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11112
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11113
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11114
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11115
	if (__INST(ignoreBackingStore) != true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11116
	    if (how == @symbol(always)) wa.backing_store = Always;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11117
	    else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11118
	    else if (how == true) wa.backing_store = Always;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11119
	    else wa.backing_store = 0;
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11120
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11121
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11122
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11123
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11124
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11125
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11126
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11127
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11128
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11129
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11130
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11131
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11132
setBitGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11133
    "set bit gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11134
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11135
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11136
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11137
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11138
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11139
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11140
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11141
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11142
	if (how == @symbol(NorthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11143
	    wa.bit_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11144
	} else if (how == @symbol(NorthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11145
	    wa.bit_gravity = NorthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11146
	} else if (how == @symbol(SouthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11147
	    wa.bit_gravity = SouthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11148
	} else if (how == @symbol(SouthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11149
	    wa.bit_gravity = SouthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11150
	} else if (how == @symbol(Center)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11151
	    wa.bit_gravity = CenterGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11152
	} else if (how == @symbol(North)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11153
	    wa.bit_gravity = NorthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11154
	} else if (how == @symbol(South)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11155
	    wa.bit_gravity = SouthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11156
	} else if (how == @symbol(West)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11157
	    wa.bit_gravity = WestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11158
	} else if (how == @symbol(East)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11159
	    wa.bit_gravity = EastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11160
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11161
	    wa.bit_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11162
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11163
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11164
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11165
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11166
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11167
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11168
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11169
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11170
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11171
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11172
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11173
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11174
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11175
setCursor:aCursorId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11176
    "define a windows cursor"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11177
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11178
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11179
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11180
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11181
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11182
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11183
     && __isExternalAddress(aCursorId)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11184
	Display *dpy = myDpy;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11185
	Window w = __WindowVal(aWindowId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11186
	Cursor c = __CursorVal(aCursorId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11187
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11188
	if (w && c) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11189
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11190
	    XDefineCursor(dpy, w, c);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11191
	    LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11192
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11193
	RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11194
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11195
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11196
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11197
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11198
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11199
setIconName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11200
    "define a windows iconname"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11201
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11202
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11203
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11204
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11205
    if (ISCONNECTED
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11206
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11207
     && (__qIsString(aString) || __qIsSymbol(aString))
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11208
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11209
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11210
	XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11211
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11212
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11213
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11214
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11215
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11216
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11217
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11218
setSaveUnder:yesOrNo in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11219
    "turn on/off save-under for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11220
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11221
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11222
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11223
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11224
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11225
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11226
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11227
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11228
	if (__INST(hasSaveUnder) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11229
	    wa.save_under = (yesOrNo == true) ? 1 : 0;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11230
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11231
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11232
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11233
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11234
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11235
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11236
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11237
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11238
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11239
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11240
setTransient:aWindowId for:aMainWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11241
    "set aWindowId to be a transient of aMainWindow"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11242
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11243
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11244
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11245
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11246
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11247
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11248
	Window w;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11249
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11250
	if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11251
	    w = (Window) 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11252
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11253
	    if (__isExternalAddress(aMainWindowId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11254
		w = __WindowVal(aMainWindowId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11255
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11256
		goto getOutOfHere;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11257
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11258
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11259
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11260
	XSetTransientForHint(myDpy, __WindowVal(aWindowId), w);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11261
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11262
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11263
    }
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
 11264
 getOutOfHere: ;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11265
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11266
    self primitiveFailedOrClosedConnection
295
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11269
setWindowBackground:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11270
    "set the windows background color. This is the color with which
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11271
     the view is filled whenever exposed. Do not confuse this with
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11272
     the background drawing color, which is used with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11273
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11274
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11275
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11276
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11277
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11278
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11279
     && __isSmallInteger(aColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11280
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11281
	XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11282
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11283
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11284
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11285
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11286
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11287
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11288
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11289
setWindowBackgroundPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11290
    "set the windows background pattern to be a form.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11291
     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
 11292
     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
 11293
     with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11294
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11295
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
 11296
%{  /* STACK: 64000 */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11297
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11298
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11299
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11300
     && __isExternalAddress(aPixmapId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11301
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11302
	XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11303
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11304
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11305
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11306
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11307
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11308
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11309
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11310
setWindowBorderColor:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11311
    "set the windows border color"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11312
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11313
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11314
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11315
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11316
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11317
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11318
     && __isSmallInteger(aColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11319
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11320
	XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11321
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11322
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11323
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11324
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11325
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11326
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11327
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11328
setWindowBorderPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11329
    "set the windows border pattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11330
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11331
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11332
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11333
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11334
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11335
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11336
     && __isExternalAddress(aPixmapId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11337
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11338
	XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11339
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11340
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11341
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11342
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11343
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11344
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11345
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11346
setWindowBorderShape:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11347
    "set the windows border shape"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11348
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11349
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11350
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11351
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11352
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11353
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11354
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11355
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11356
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11357
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11358
    if (__isExternalAddress(aPixmapId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11359
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11360
    else
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11361
	shapeBitmap = (Pixmap)0;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11362
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11363
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11364
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11365
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11366
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding,
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11367
			  0, 0, shapeBitmap, ShapeSet);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11368
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11369
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11370
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11371
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11372
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11373
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11374
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11375
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11376
setWindowBorderWidth:aNumber in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11377
    "set the windows border width"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11378
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11379
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11380
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11381
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11382
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11383
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11384
     && __isSmallInteger(aNumber)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11385
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11386
	XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11387
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11388
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11389
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11390
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11391
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11392
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11393
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11394
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
 11395
    "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
 11396
     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
 11397
     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
 11398
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11399
    <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
 11400
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11401
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11402
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11403
	XClassHint classhint;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11404
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11405
	classhint.res_class = classhint.res_name = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11406
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11407
	if (__isString(wClass) || __isSymbol(wClass)) {
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
 11408
	    classhint.res_class = (char *) __stringVal(wClass);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11409
	} else if (wClass != nil)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11410
	    goto error;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11411
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11412
	if (__isString(wName) || __isSymbol(wName)) {
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
 11413
	    classhint.res_name = (char *) __stringVal(wName);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11414
	} else if (wName != nil)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11415
	    goto error;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11416
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11417
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11418
	XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11419
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11420
	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
 11421
error:;
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11422
    }
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11423
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11424
    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
 11425
!
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11426
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11427
setWindowGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11428
    "set window gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11429
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11430
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11431
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11432
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11433
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11434
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11435
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11436
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11437
	if (how == @symbol(NorthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11438
	    wa.win_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11439
	} else if (how == @symbol(NorthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11440
	    wa.win_gravity = NorthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11441
	} else if (how == @symbol(SouthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11442
	    wa.win_gravity = SouthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11443
	} else if (how == @symbol(SouthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11444
	    wa.win_gravity = SouthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11445
	} else if (how == @symbol(Center)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11446
	    wa.win_gravity = CenterGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11447
	} else if (how == @symbol(North)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11448
	    wa.win_gravity = NorthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11449
	} else if (how == @symbol(South)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11450
	    wa.win_gravity = SouthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11451
	} else if (how == @symbol(West)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11452
	    wa.win_gravity = WestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11453
	} else if (how == @symbol(East)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11454
	    wa.win_gravity = EastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11455
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11456
	    wa.win_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11457
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11458
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11459
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11460
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11461
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11462
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11463
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11464
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11465
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11466
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11467
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11468
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11469
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11470
setWindowIcon:aForm in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11471
    "define a bitmap to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11472
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11473
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11474
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11475
    |iconId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11476
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11477
    aForm notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11478
	iconId := aForm id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11479
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11480
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11481
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11482
     && __isExternalAddress(iconId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11483
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11484
	XWMHints hints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11485
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11486
	hints.icon_pixmap = __PixmapVal(iconId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11487
	hints.flags = IconPixmapHint;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11488
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11489
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11490
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11491
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11492
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11493
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11494
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11495
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11496
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11497
setWindowIcon:aForm mask:aMaskForm in:aWindowId
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11498
    "define a windows icon and (optional) iconMask."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11499
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11500
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11501
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11502
    |iconId maskId|
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11503
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11504
    aForm notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11505
	iconId := aForm id
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11506
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11507
    aMaskForm notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11508
	maskId := aMaskForm id.
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11509
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11510
%{
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11511
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11512
     && __isExternalAddress(iconId)
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11513
     && __isExternalAddress(aWindowId)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11514
	XWMHints hints;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11515
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11516
	hints.icon_pixmap = __PixmapVal(iconId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11517
	hints.flags = IconPixmapHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11518
	if ((maskId != nil)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11519
	 && __isExternalAddress(maskId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11520
	    hints.icon_mask = __PixmapVal(maskId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11521
	    hints.flags |= IconMaskHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11522
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11523
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11524
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11525
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11526
	RETURN ( self );
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11527
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11528
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11529
    self primitiveFailedOrClosedConnection
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11530
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11531
!
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11532
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11533
setWindowIconWindow:aView in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11534
    "define a window to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11535
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11536
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11537
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11538
    |iconWindowId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11539
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11540
    aView notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11541
	iconWindowId := aView id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11542
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11543
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11544
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11545
     && __isExternalAddress(iconWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11546
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11547
	XWMHints wmhints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11548
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11549
	wmhints.icon_window = __WindowVal(iconWindowId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11550
	wmhints.flags = IconWindowHint;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11551
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11552
	XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11553
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11554
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11555
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11556
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11557
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11558
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11559
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
 11560
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
 11561
    "set a windows minimum & max extents.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11562
     nil arguments are ignored."
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11563
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11564
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11565
%{
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11566
    if (ISCONNECTED
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11567
     && __isExternalAddress(aWindowId)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11568
	Display *dpy = myDpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11569
	XSizeHints szhints;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11570
	Window win;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11571
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11572
	win = __WindowVal(aWindowId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11573
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11574
	szhints.flags = 0;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11575
	if (__bothSmallInteger(minW, minH)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11576
	    szhints.flags |= PMinSize;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11577
	    szhints.min_width = __intVal(minW);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11578
	    szhints.min_height = __intVal(minH);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11579
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11580
	if (__bothSmallInteger(maxW, maxH)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11581
	    szhints.flags |= PMaxSize;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11582
	    szhints.max_width = __intVal(maxW);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11583
	    szhints.max_height = __intVal(maxH);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11584
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11585
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11586
	if (szhints.flags) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11587
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11588
	    XSetNormalHints(dpy, win, &szhints);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11589
	    LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11590
	}
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11591
    }
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11592
%}.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11593
!
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11594
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11595
setWindowName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11596
    "define a windows name"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11597
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11598
    |stringUsed|
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11599
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11600
    stringUsed := aString.
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11601
    self supportsUTF8WindowLabels ifTrue:[
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11602
	stringUsed := aString utf8Encoded.
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11603
    ] ifFalse:[
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11604
	aString bitsPerCharacter > 8 ifTrue:[
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11605
	    stringUsed := aString utf8Encoded.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11606
	].
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11607
    ].
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11608
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 11609
    self primSetWindowName:stringUsed in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11610
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11611
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11612
setWindowShape:aPixmapId in:aWindowId
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11613
    "set the windows shape.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11614
     Returns false, if the display does not support the
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11615
     X shape extension."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11616
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11617
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11618
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11619
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11620
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11621
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11622
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11623
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11624
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11625
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11626
    if (__isExternalAddress(aPixmapId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11627
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11628
    else
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11629
	shapeBitmap = (Pixmap)0;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11630
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11631
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11632
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11633
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11634
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip,
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11635
			  0, 0,
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11636
			  shapeBitmap, ShapeSet);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11637
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11638
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11639
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11640
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11641
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11642
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11643
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11644
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11645
unmapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11646
    "make a window invisible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11647
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11648
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11649
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 11650
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 11651
     * 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
 11652
     */
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 11653
    if (! ISCONNECTED) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11654
	RETURN ( self );
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 11655
    }
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 11656
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 11657
    if (__isExternalAddress(aWindowId)) {
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11658
	ENTER_XLIB();
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11659
	XUnmapWindow(myDpy, __WindowVal(aWindowId));
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11660
	LEAVE_XLIB();
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11661
	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
 11662
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 11663
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 11664
    self primitiveFailed
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11665
!
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11666
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11667
windowIsIconified:aWindowId
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11668
    "return true, if some window is iconified.
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11669
     The passed windowID may be an alien windows id."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11670
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11671
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11672
%{
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11673
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11674
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11675
     && __isExternalAddress(aWindowId)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11676
	Atom JunkAtom;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11677
	int JunkInt;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11678
	unsigned long WinState,JunkLong;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11679
	unsigned char *Property;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11680
	Atom WM_STATE_Atom;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11681
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11682
	if (__INST(wmStateAtom) != nil) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11683
	    WM_STATE_Atom = __AtomVal(__INST(wmStateAtom));
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11684
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11685
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11686
	    XGetWindowProperty(myDpy, __WindowVal(aWindowId),
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11687
			       WM_STATE_Atom,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11688
			       0L, 2L, False, AnyPropertyType,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11689
			       &JunkAtom,&JunkInt,&WinState,&JunkLong,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11690
			       &Property);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11691
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11692
	    WinState=(unsigned long)(*((long*)Property));
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11693
	    if (WinState==3) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11694
		RETURN (true);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11695
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11696
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11697
	RETURN (false);
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11698
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11699
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11700
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11701
    ^ false "/ or true or what ?
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11702
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11703
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11704
!XWorkstation::SelectionFetcher class methodsFor:'documentation'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11705
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11706
documentation
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11707
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11708
    This class is responsible for fetching the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11709
    The X11 clipboard is implemented via asynchonous messages.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11710
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11711
    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
 11712
    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
 11713
    process that requests the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11714
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11715
    [author:]
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11716
	Stefan Vogel (stefan@zwerg)
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11717
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11718
    [instance variables:]
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
    [class variables:]
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
    [see also:]
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
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11725
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11726
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11727
!XWorkstation::SelectionFetcher class methodsFor:'selections'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11728
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11729
requestSelection:selectionId type:aTargetId onDevice:aDisplay for:aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11730
    ^ 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
 11731
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11732
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11733
!XWorkstation::SelectionFetcher methodsFor:'accessing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11734
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11735
getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11736
    "convert the data in buffer to a selection"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11737
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11738
    |selection|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11739
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11740
    buffer isNil ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11741
	^ nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11742
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11743
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11744
    targetID == (display atomIDOf:#STRING) ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11745
	display clipboardEncoding notNil ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11746
	    selection := buffer decodeFrom:display clipboardEncoding
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11747
	].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11748
	selection := buffer.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11749
    ] ifFalse:[targetID == (display atomIDOf:#'UTF8_STRING') ifTrue:[
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11750
"/ Transcript show:'UTF8: '; showCR:buffer storeString.
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11751
	selection := CharacterArray fromUTF8Bytes:buffer
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11752
    ] ifFalse:[targetID == (display atomIDOf:#TEXT) ifTrue:[
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11753
"/ Transcript show:'TEXT: '; showCR:buffer storeString.
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11754
	selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11755
    ] ifFalse:[targetID == (display atomIDOf:#'COMPOUND_TEXT') ifTrue:[
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11756
"/ Transcript show:'COMPOUND_TEXT: '; showCR:buffer storeString.
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11757
	selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11758
    ]]]].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11759
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11760
    selection notNil ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11761
	(selection endsWith:Character cr) ifTrue:[
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11762
	    selection := selection asStringCollection copyWith:''
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11763
	].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11764
	^ selection.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11765
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11766
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 11767
    targetID == (display atomIDOf:#'TARGETS') ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11768
	^ buffer
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 11769
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11770
    targetID == (display atomIDOf:#'ST_OBJECT') ifTrue:[
4631
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11771
	"require libboss to be loaded"
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11772
	(Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[^ nil].
99e437da6273 blockingPrimitiveTimeoutArg is now a garbage-collected object
Michael Beyl <mb@exept.de>
parents: 4559
diff changeset
 11773
	^ (Object readBinaryFrom:(ReadStream on:buffer) onError:[nil])
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11774
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11775
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11776
    '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
 11777
    ' buffer:' infoPrint. buffer infoPrintCR.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11778
    ^ nil
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 11779
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 11780
    "Modified: / 23-08-2006 / 15:56:04 / cg"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11781
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11782
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11783
!XWorkstation::SelectionFetcher methodsFor:'event handling'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11784
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11785
message:aMessage
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11786
    "got an asynchronous event from the display.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11787
     Save and wake up waiters"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11788
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11789
    aMessage selector == #propertyChange:property:state:time: ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11790
	(aMessage arguments at:2) ~~ propertyID ifTrue:[
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11791
	    "I am only interested in changes of the property used to
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11792
	     store the selection"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11793
	    ^ self.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11794
	].
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11795
	message notNil ifTrue:[
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11796
	    "this should not happen - bad selection holder?"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11797
	    'XWorkstation(error): message overflow: ' errorPrint. display errorPrintCR.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11798
	    ^ self.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11799
	].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11800
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11801
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11802
    "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
 11803
     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
 11804
     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
 11805
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11806
    message := aMessage.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11807
    sema signal.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11808
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11809
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11810
propertyChange:aView property:aPropertyId state:stateSymbol time:time
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11811
    "this is a forwarded propretyChange event from XWorkstation"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11812
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11813
    |property propertyValue|
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11814
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11815
    incremental ifFalse:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11816
	"ignore property changes until we are in incremental mode"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11817
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11818
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11819
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11820
    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
 11821
    propertyValue := property value.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11822
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11823
    propertyValue size == 0 ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11824
	"property with size 0 signals end of transfer"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11825
	done := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11826
    ] ifFalse:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11827
	buffer isNil ifTrue:[
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11828
	    targetID := property key.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11829
	    buffer := propertyValue.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11830
	] ifFalse:[
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11831
	    targetID ~= property key ifTrue:[
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11832
		'XWorkstation(warning): targetID change in incremental select: ' errorPrint. display errorPrintCR.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11833
	    ].
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11834
	    buffer := buffer, propertyValue.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11835
	].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11836
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11837
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11838
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11839
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
 11840
    "this is a forwarded selectionNotify event from XWorkstation"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11841
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11842
    |property propertyKey|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11843
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11844
    aSelectionID ~~ selectionID ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11845
	"ignore notification that is not for our selection"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11846
	^ self.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11847
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11848
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11849
    aPropertyID == 0 ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11850
	"the selection owner could not convert the selection to our target type"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11851
	done := true.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11852
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11853
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11854
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11855
    property := display getProperty:aPropertyID from:drawableID delete:true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11856
    propertyKey := property key.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11857
    propertyKey == aTargetID ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11858
	"good, the property is consistent with our request.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11859
	 The whole selection is in the property"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11860
	buffer := property value.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11861
	done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11862
    ] ifFalse:[propertyKey == (display atomIDOf:#INCR) ifTrue:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11863
	"this is an incremental transfer. Wait for property change"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11864
	incremental := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11865
    ] ifFalse:[
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11866
	'XWorkstation(error): unexpected targetID in selectionNotify: ' errorPrint.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11867
	display errorPrintCR.
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11868
	done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11869
    ]].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11870
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11871
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11872
!XWorkstation::SelectionFetcher methodsFor:'selection actions'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11873
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11874
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
 11875
    "request the selection of type targetId.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11876
     Wait for next asynchronous message and process it,
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11877
     until done"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11878
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11879
    display := aDisplay.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11880
    drawableID := aDrawableId.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11881
    selectionID := aSelectionId.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11882
    propertyID := display atomIDOf:#'VT_SELECTION'.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11883
    targetID := aTargetId.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11884
    sema := Semaphore new name:'X11SelectionFetcher'.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11885
    done := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11886
    incremental := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11887
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11888
    [
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11889
	|timeout|
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11890
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11891
	display registerSelectionFetcher:self.
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11892
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11893
	display
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11894
	    requestSelection:aSelectionId
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11895
	    type:aTargetId
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11896
	    for:drawableID
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11897
	    intoProperty:propertyID.
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11898
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11899
	timeout := display xlibTimeout.
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11900
	[
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11901
	    |currentMessage|
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11902
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11903
	    (sema waitWithTimeout:timeout) isNil ifTrue:[
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11904
		"the selection owner didn't respond within reasonable time"
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11905
		'XWorkstation(error): selection owner does not respond:' infoPrint. display infoPrintCR.
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11906
		^ nil.
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11907
	    ].
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11908
	    currentMessage := message.
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11909
	    message := nil.
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11910
	    currentMessage notNil ifTrue:[currentMessage sendTo:self].
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11911
	] doUntil:[done].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11912
    ] ensure:[
4388
39bcaddc2e22 STORE macro (gcc3.4 bug workaround)
Claus Gittinger <cg@exept.de>
parents: 4334
diff changeset
 11913
	display unregisterSelectionFetcher:self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11914
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11915
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11916
    ^ self getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11917
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11918
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11919
!XWorkstation::SelectionFetcher methodsFor:'testing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11920
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11921
matchesDrawableId:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11922
    "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
 11923
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11924
    ^ drawableID = aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11925
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11926
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
 11927
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11928
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11929
version
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
 11930
    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.496 2008-03-15 17:17:21 stefan Exp $'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11931
! !
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 11932
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11933
XWorkstation initialize!