XWorkstation.st
author Claus Gittinger <cg@exept.de>
Mon, 09 Oct 2000 16:28:46 +0200
changeset 3326 5d58d51bf927
parent 3322 1c92a842f099
child 3329 05ac7164c99d
permissions -rw-r--r--
sync checks for pending events
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
"
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
    13
"{ 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
    14
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    15
DeviceWorkstation subclass:#XWorkstation
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
    16
	instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    17
		hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    18
		hasImageExtension hasInputExtension ignoreBackingStore blackpixel
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
    19
		whitepixel atoms protocolsAtom deleteWindowAtom saveYourselfAtom
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
    20
		quitAppAtom primaryAtom cutBuffer0Atom stringAtom lengthAtom
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
    21
		wmStateAtom listOfXFonts buttonsPressed eventRootX eventRootY
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
    22
		displayName eventTrace dispatchingExpose rgbVisual virtualRootId
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
    23
		rootId eventBuffer altModifierMask metaModifierMask
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
    24
		multiClickTime deviceIOTimeoutErrorSignal activateOnClick
3321
3d0e6754dcd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
    25
		rawKeySymTranslation'
3d0e6754dcd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
    26
	classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength'
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    27
	poolDictionaries:''
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    28
	category:'Interface-Graphics'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
    29
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    30
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
    31
!XWorkstation primitiveDefinitions!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    32
%{
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    33
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    34
#ifdef LINUX
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    35
# define SHM
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    36
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    37
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    38
#define COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    39
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    40
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    41
static int __cnt_color = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    42
static int __cnt_bitmap = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    43
static int __cnt_view = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    44
static int __cnt_gc = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    45
static int __cnt_cursor = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    46
static int __cnt_font = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    47
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    48
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    49
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    50
/*
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    51
 * x does a typedef Time - I need Object Time ...
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    52
 */
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    53
#undef Time
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    54
#define Time XTime
48194c26a46c Initial revision
claus
parents:
diff changeset
    55
391
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    56
/*
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    57
 * x does a #define True / False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    58
 * 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
    59
 */
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    60
#undef True
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    61
#undef False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    62
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    63
#ifdef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    64
# undef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    65
#endif
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    66
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
    67
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    68
#include <stdio.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    69
#include <X11/Xlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    70
#include <X11/Xutil.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    71
#include <X11/Xatom.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    72
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    73
#define XK_MISCELLANY
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    74
#include <X11/keysymdef.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    75
277
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    76
#include <X11/cursorfont.h>
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    77
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    78
#ifdef LINUX
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    79
# include <sys/socket.h>
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    80
#endif
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    81
2422
6bffcb4c8360 changes for egcs (__new in stdio)
Claus Gittinger <cg@exept.de>
parents: 2386
diff changeset
    82
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
    83
/*
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    84
 * this define suppresses XAllocColor/XFreeColor on
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    85
 * 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
    86
 * 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
    87
 */
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    88
#define QUICK_TRUE_COLORS
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    89
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    90
/*
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    91
 * shape support works; enabled by -DSHAPE in makefile
48194c26a46c Initial revision
claus
parents:
diff changeset
    92
 * see RoundClock and RoundGlobe examples
48194c26a46c Initial revision
claus
parents:
diff changeset
    93
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
    94
#ifdef SHAPE
48194c26a46c Initial revision
claus
parents:
diff changeset
    95
# include <X11/extensions/shape.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    96
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
    97
48194c26a46c Initial revision
claus
parents:
diff changeset
    98
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    99
 * shared memory extension access is currently not supported
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   100
 * (only query is implemented)
48194c26a46c Initial revision
claus
parents:
diff changeset
   101
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   102
#ifdef SHM
48194c26a46c Initial revision
claus
parents:
diff changeset
   103
# include <X11/extensions/XShm.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   104
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   105
48194c26a46c Initial revision
claus
parents:
diff changeset
   106
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   107
 * multiBuffer extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   108
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   109
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   110
#ifdef MBUF
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   111
# include <X11/extensions/multibuf.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   112
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   113
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   114
/*
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   115
 * XVideo extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   116
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   117
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   118
#ifdef XVIDEO
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   119
# include <X11/extensions/Xv.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   120
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   121
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   122
/*
186
claus
parents: 180
diff changeset
   123
 * PEX extension - if available
claus
parents: 180
diff changeset
   124
 */
claus
parents: 180
diff changeset
   125
#ifdef PEX5
claus
parents: 180
diff changeset
   126
# include <PEX5/PEX.h>
claus
parents: 180
diff changeset
   127
#endif
claus
parents: 180
diff changeset
   128
claus
parents: 180
diff changeset
   129
/*
claus
parents: 180
diff changeset
   130
 * XImage extension - if available
claus
parents: 180
diff changeset
   131
 */
claus
parents: 180
diff changeset
   132
#ifdef XIE
claus
parents: 180
diff changeset
   133
# include <X11/extensions/XIE.h>
claus
parents: 180
diff changeset
   134
#endif
claus
parents: 180
diff changeset
   135
claus
parents: 180
diff changeset
   136
/*
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   137
 * when I have more time to check it out, I will support display-PS
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   138
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   139
#ifdef DPS
48194c26a46c Initial revision
claus
parents:
diff changeset
   140
# ifdef sgi
48194c26a46c Initial revision
claus
parents:
diff changeset
   141
#  include <X11/extensions/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   142
#  include <X11/extensions/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   143
#  include <X11/extensions/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   144
# else
48194c26a46c Initial revision
claus
parents:
diff changeset
   145
#  include <DPS/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   146
#  include <DPS/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   147
#  include <DPS/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   148
# endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   149
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   150
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   151
#if defined(someMachine)
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   152
/*
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   153
 * if nformats cannot be found in the Display structure ...
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   154
 */
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   155
# define NO_PRIVATE_DISPLAY_ACCESS
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   156
#endif
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   157
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   158
#if defined(IRIX5) || defined(__VMS) || (XlibSpecificationRelease == 6)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   159
  /*
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   160
   * accessing private data in Display ... sorry
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   161
   */
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   162
# define DISPLAYACCESS(d) ((_XPrivDisplay)d)
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   163
#else
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   164
# define DISPLAYACCESS(d) d
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   165
#endif
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   166
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   167
/*
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   168
 * some defines - tired of typing ...
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   169
 */
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   170
#define __DisplayVal(o)      (Display *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   171
#define __DrawableVal(o)     (Drawable)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   172
#define __WindowVal(o)       (Window)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   173
#define __PixmapVal(o)       (Pixmap)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   174
#define __GCVal(o)           (GC)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   175
#define __CursorVal(o)       (Cursor)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   176
#define __FontVal(o)         (XFontStruct *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   177
#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
   178
211
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   179
#define __MKATOMOBJ(a)       __MKSMALLINT(a)
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   180
#define __AtomVal(o)         __intVal(o)
211
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   181
#define __isAtomID(o)        __isSmallInteger(o)
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   182
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   183
#define myDpy                __DisplayVal(__INST(displayId))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   184
#define ISCONNECTED          (__INST(displayId) != nil)
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   185
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   186
#ifdef __VMS__
1899
de1eb2a3318e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1898
diff changeset
   187
# include "vms_Xnames.h"
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   188
#endif
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   189
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   190
void __XTimeoutErrorHandler();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   191
int __XErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   192
int __XIOErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   193
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   194
#define DEFAULT_XLIB_TIMEOUT   600     /* in 50ms ticks (30 seconds) */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   195
  static __xlibTimeout__ = DEFAULT_XLIB_TIMEOUT;
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
   196
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   197
#define ENTER_XLIB()   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   198
    { \
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   199
	__blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   200
	__blockingPrimitiveTimeoutArg__ = (INT)self; \
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   201
	__blockingPrimitiveTimeout__ = __xlibTimeout__; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   202
    } {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   203
#define LEAVE_XLIB()   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   204
    { \
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   205
	__blockingPrimitiveTimeout__ = 0; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   206
    } }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   207
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   208
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   209
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   210
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   211
!XWorkstation primitiveVariables!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   212
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   213
/*
146
claus
parents: 145
diff changeset
   214
 * remembered info from private error handler
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   215
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   216
static char lastErrorMsg[128] = "";
1888
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   217
static unsigned INT lastRequestCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   218
static unsigned INT lastMinorCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   219
static unsigned INT lastResource = 0;
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   220
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   221
static int __debug__ = 0;
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   222
#define DPRINTF(x)      if (__debug__) { printf x; }
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   223
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   224
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   225
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   226
!XWorkstation primitiveFunctions!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   227
%{
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   228
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   229
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   230
 * 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
   231
 * to include that stuff. Should be #ifdef'd ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   232
 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   233
#ifndef ELF
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   234
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   235
# ifdef __GNUC__
1081
f7d19178fb2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   236
VOLATILE 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   237
# endif
1081
f7d19178fb2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   238
static
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   239
dummyToForceLoading() {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   240
	XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   241
	XCloseDisplay(0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   242
	XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   243
	XSetWindowColormap(0, 0, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   244
	XQueryColors(0,0,0,0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   245
# ifdef SHM
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   246
	XShmAttach(0, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   247
	XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   248
	XShmDetach(0, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   249
	XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   250
	shmctl(0,0,0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   251
	fgetc(0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   252
# endif
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   253
}
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   254
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   255
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   256
/*
144
claus
parents: 143
diff changeset
   257
 * catch X-errors and forward as errorInterrupt:#DisplayError,
claus
parents: 143
diff changeset
   258
 * (which itself invokes my handler and optionally raises an exceptionSignal)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   259
 * the implementation below is somewhat wrong: it will
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   260
 * report all errors for Display, even though there could be
162
claus
parents: 160
diff changeset
   261
 * more than one display connection. (being fixed, new errorInterrupt mechanism
claus
parents: 160
diff changeset
   262
 * allows passing an additional argument, which is the displayID ...)
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   263
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   264
int
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
   265
__XErrorHandler__(dpy, event)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   266
    Display *dpy;
48194c26a46c Initial revision
claus
parents:
diff changeset
   267
    XErrorEvent *event;
48194c26a46c Initial revision
claus
parents:
diff changeset
   268
{
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   269
    XGetErrorText(dpy, event->error_code, lastErrorMsg, 127);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   270
    lastErrorMsg[127] = '\0';
1060
bc581886fe8f dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents: 1056
diff changeset
   271
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   272
    if (lastErrorMsg[0] == '\0') {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   273
	sprintf(lastErrorMsg, "code: %d", event->error_code);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   274
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   275
    lastRequestCode = event->request_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   276
    lastMinorCode = event->minor_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   277
    lastResource = event->resourceid;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   278
    if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   279
	/* 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   280
	 * this is a BadWindow error for X_DestroyWindow.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   281
	 * ignore it here, since it results from the GC freeing windows
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   282
	 * in non bottom-up window order.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   283
	 */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   284
	return 0;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   285
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   286
254
d6f12ecd7767 ErrorPrinting variable now correctly detected by stc
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   287
    if (@global(ErrorPrinting) == true) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   288
	fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%x\n",
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   289
			event->request_code, event->request_code, 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   290
			event->minor_code, event->minor_code, event->resourceid);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   291
	fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n", 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   292
			event->error_code, lastErrorMsg);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   293
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   294
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   295
    __errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   296
    return 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
   297
}
48194c26a46c Initial revision
claus
parents:
diff changeset
   298
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   299
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   300
 * much like the above, but for IO Errors;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   301
 * forwarded as errorInterrupt:#DisplayIOError,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   302
 * In single display apps, handling those here does not
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   303
 * really make sense (except, for a controlled cleanup).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   304
 * However, in multiDisplay apps, a single broken
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   305
 * connection should not affect the other users.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   306
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   307
int
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   308
__XIOErrorHandler__(dpy)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   309
    Display *dpy;
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
    if (@global(ErrorPrinting) == true) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   312
	fprintf(stderr, "XWorkstation [error]: I/O error\n");
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   313
    }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   314
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError),
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   315
						  __MKEXTERNALADDRESS(dpy));
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   316
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   317
#if 0
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   318
    /*
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   319
     * don't do this.
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   320
     * 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
   321
     */
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   322
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   323
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   324
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   325
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   326
     */
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   327
    __internalError("unhandled display I/O error");
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   328
    __terminateProcess(0);      /* soft terminate */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   329
    __terminateProcess(1);      /* hard terminate */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   330
    /* never reached */
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   331
#endif
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   332
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   333
    return 0;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   334
}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   335
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   336
/*
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   337
 * timeout error in case of Xlib request timeout.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   338
 * forwarded as errorInterrupt:#DisplayIOTimeoutError,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   339
 * This is generated synthetically by the VM if the
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   340
 * timeoutHandler has been set.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   341
 */
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   342
void
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   343
__XTimeoutErrorHandler(displayDeviceInst)
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   344
    OBJ displayDeviceInst;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   345
{
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   346
    if (@global(ErrorPrinting) == true) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   347
	fprintf(stderr, "XWorkstation [error]: I/O request timeout dpy=%x\n", displayDeviceInst);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   348
    }
2057
ff2964f2bd9d increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents: 2021
diff changeset
   349
    if (displayDeviceInst == @global(MainDisplay)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   350
	fprintf(stderr, "XWorkstation [error]: keep display connection for master display (no shutdown)\n");
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   351
	return;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   352
    }
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   353
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   354
#if 0
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   355
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   356
This is litter: 
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   357
    1. How should I ever close the display without a displayId?
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   358
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   359
    2. This may loop for ever, if there is some data in the socket, but #eventPending returns
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   360
       false because displayId is nil.
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   361
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   362
    3. The problem is not the EventListener, which is reading (and waiting in #eventPending),
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   363
       but maybe other processes writing to the Display and blocking the system again (for 30 Seconds).
2057
ff2964f2bd9d increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents: 2021
diff changeset
   364
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   365
    /*
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   366
     * must immediately flush that displays deviceID - otherwise,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   367
     * the scheduler may try to ask for pending events without a watchdog
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   368
     * timer ...
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   369
     */
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   370
    __OINST(displayDeviceInst, displayId) = nil;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   371
#endif
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   372
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst);
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   373
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   374
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   375
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   376
     */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
diff changeset
   377
    if (__OINST(displayDeviceInst, displayId) != nil) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   378
	__internalError("unhandled display Timeout error");
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   379
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   380
	__terminateProcess(0);      /* soft terminate */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   381
	__terminateProcess(1);      /* hard terminate */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
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
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   385
#ifdef VIRTUAL_ROOT
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   386
/*
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   387
 * added since RootWindow-macro is not sufficient
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   388
 * when virtual root-windows are involved (i.e. tvtwm)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   389
 */
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   390
static Window
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   391
getRootWindow(dpy, screen)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   392
    Display *dpy;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   393
{
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   394
    Window root;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   395
    Atom vRootAtom = None;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   396
    int i;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   397
    Window rootReturn, parentReturn;
1050
b2c03e24d56c another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents: 1049
diff changeset
   398
    Window* children = (Window *)0;
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   399
    unsigned int numChildren;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   400
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   401
    root = RootWindow(dpy, screen);
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   402
    /*
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   403
     * on IRIS, this creates a badwindow error - why ?
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   404
     * children contains a funny window (000034)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   405
     */
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   406
# if !defined(IRIS) || defined(IRIX5)
1887
98bb2fb45fda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1883
diff changeset
   407
    if (root) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   408
	if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   409
	    vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   410
	    if (vRootAtom != None) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   411
		for (i=0; i < numChildren; i++) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   412
		    Atom actual_type;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   413
		    int actual_format;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   414
		    unsigned long nitems, bytesafter;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   415
		    Window* newRoot = (Window*) 0;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   416
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   417
		    if (children[i]) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   418
			if (XGetWindowProperty(dpy, children[i], vRootAtom,
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   419
					       0L, 1L, False, XA_WINDOW,
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   420
					       &actual_type, &actual_format, &nitems, &bytesafter,
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   421
					       (unsigned char**) &newRoot) == Success && newRoot) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   422
			    root = *newRoot;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   423
			    XFree(newRoot); /* XXX */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   424
			    break;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   425
			}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   426
		    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   427
		}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   428
	    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   429
	    if (children) XFree( children );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   430
	}
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   431
    }
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   432
# endif
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   433
    return root;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   434
}
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   435
#endif
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   436
%}
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   437
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   438
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   439
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   440
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   441
copyright
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   442
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   443
COPYRIGHT (c) 1989 by Claus Gittinger
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   444
	      All Rights Reserved
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   445
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   446
 This software is furnished under a license and may be used
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   447
 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
   448
 inclusion of the above copyright notice.   This software may not
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   449
 be provided or otherwise made available to, or used by, any
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   450
 other person.  No title to or ownership of the software is
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   451
 hereby transferred.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   452
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   453
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   454
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   455
documentation
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   456
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   457
    this class provides the interface to X11. It redefines all required methods
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   458
    from DeviceWorkstation. Notice, that in Smalltalk/X you are not technically
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   459
    limited to one display - in theory, you can create Views on many displays
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   460
    simultanously. However, the default setup is for one display only.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   461
    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
   462
    process for the other display(s) and create the other views with a slightly
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   463
    different protocol. However, 'normal' applications do not have to care for
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   464
    all of this ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   465
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   466
    See more documentation in my superclass, DeviceWorkstation.
613
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   467
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   468
    [author:]
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   469
	Claus Gittinger
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   470
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   471
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   472
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   473
!XWorkstation class methodsFor:'initialization'!
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   474
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   475
initialize
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   476
    |d|
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   477
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   478
    super initialize.
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   479
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   480
    ConservativeSync := OperatingSystem platformName == #win32.
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   481
3267
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   482
    "/ some XServers crash, when given too long strings in XDrawString/XDrawInageString.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   483
    "/ the following is an adjustable soft-limit.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   484
    MaxStringLength := 4096.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   485
3321
3d0e6754dcd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   486
    RawKeySymTranslation isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   487
	"/ the following table maps X-keyevents to ST/X
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   488
	"/ device independed events. 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   489
	"/ It is NOT meant as a keyboardMap replacement.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   490
3321
3d0e6754dcd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   491
	RawKeySymTranslation := d := Dictionary new.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   492
	d at:'Delete_line' put:#DeleteLine.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   493
	d at:'Delete_word' put:#DeleteWord.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   494
	d at:'Down' put:#CursorDown.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   495
	d at:'Up' put:#CursorUp.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   496
	d at:'Left' put:#CursorLeft.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   497
	d at:'Right' put:#CursorRight.
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   498
    ]
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   499
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   500
    "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
   501
! !
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   502
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   503
!XWorkstation class methodsFor:'error handling'!
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   504
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   505
debug:aBoolean
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   506
%{  /* NOCONTEXT */
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   507
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   508
    __debug__ = (aBoolean == true) ? 1 : 0;
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   509
%}
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   510
!
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   511
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   512
debugResources
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   513
%{
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   514
#ifdef COUNT_RESOURCES
1404
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   515
    printf("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
   516
	    __cnt_color, __cnt_bitmap,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   517
	    __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
   518
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   519
%}
1404
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   520
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   521
    "
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   522
     XWorkstation debugResources
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   523
    "
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   524
!
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   525
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   526
errorStringOfLastError
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   527
%{
1065
fdc5b9059d82 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1062
diff changeset
   528
    RETURN ( __MKSTRING(lastErrorMsg) );
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   529
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   530
!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   531
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   532
getConnectionTimeOut
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   533
%{
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   534
    RETURN (__MKSMALLINT(__xlibTimeout__ / 50));
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   535
%}
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   536
!
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   537
135
claus
parents: 133
diff changeset
   538
lastErrorString
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   539
    "return the last X-error string - 
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   540
     when buffering is on, this may be
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   541
     an error for a long-ago operation"
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   542
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   543
    |string requestCode s match line|
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   544
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   545
    string := self errorStringOfLastError.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   546
    requestCode := self requestCodeOfLastError.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   547
    "
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   548
     X specific: search the requestCode in '/usr/lib/X11/XErrorDB',
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   549
     and append the name of the corresponding X-request
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   550
    "
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   551
    s := '/usr/lib/X11/XErrorDB' asFilename readStream.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   552
    s notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   553
	match := 'XRequest.' , requestCode printString.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   554
	line := s peekForLineStartingWith:match.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   555
	line notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   556
	    string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   557
	].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   558
	s close.
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   559
    ].
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   560
    ^ string
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   561
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   562
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   563
minorCodeOfLastError
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   564
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   565
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   566
    RETURN ( __MKSMALLINT(lastMinorCode) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   567
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   568
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   569
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   570
requestCodeOfLastError
152
claus
parents: 150
diff changeset
   571
%{  /* NOCONTEXT */
claus
parents: 150
diff changeset
   572
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   573
    RETURN ( __MKSMALLINT(lastRequestCode) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   574
%}
135
claus
parents: 133
diff changeset
   575
!
claus
parents: 133
diff changeset
   576
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   577
resourceIdOfLastError
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   578
%{  /* NOCONTEXT */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   579
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   580
    RETURN ( __MKEXTERNALADDRESS(lastResource) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   581
%}
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   582
!
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   583
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   584
setConnectionTimeOut:seconds
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   585
%{
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   586
    __xlibTimeout__ = __intVal(seconds) * 50;
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   587
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   588
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   589
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   590
!XWorkstation class methodsFor:'queries'!
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   591
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   592
platformName
133
claus
parents: 132
diff changeset
   593
    "ST-80 compatibility.
2777
60ba83db1fab comment
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   594
     Return a string describing the display systems platform.
60ba83db1fab comment
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   595
     WinWorkstation always returns 'X11'."
133
claus
parents: 132
diff changeset
   596
715
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   597
    ^ 'X11'  "I don't know what ST-80 returns for X ..."
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   598
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   599
    "Modified: 26.5.1996 / 15:32:46 / cg"
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   600
! !
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   601
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   602
!XWorkstation methodsFor:'Signal constants'!
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   603
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   604
deviceIOTimeoutErrorSignal
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   605
    "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
   606
     IO error (i.e. broken connection) occurs."
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   607
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   608
    ^ deviceIOTimeoutErrorSignal
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   609
! !
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   610
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   611
!XWorkstation methodsFor:'accessing & queries'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   612
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   613
activateOnClick:aBoolean
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   614
    "set/clear the activateOnClick behavior.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   615
     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
   616
     the (top) window.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   617
     Windows users typically enable this;
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   618
     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
   619
     it disabled.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   620
     Returns the previous setting."
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   621
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   622
    |prev|
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   623
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   624
    prev := activateOnClick ? false.
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   625
    aBoolean notNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   626
	activateOnClick := aBoolean.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   627
    ].
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   628
    ^ prev
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   629
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   630
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   631
     Display class activateOnClick:true
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   632
     Display class activateOnClick:false
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   633
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   634
!
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   635
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   636
anyButtonMotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   637
    "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
   638
     This is the devices mask."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   639
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   640
%{  /* NOCONTEXT */
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   641
    RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask));
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   642
%}.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   643
    ^ nil
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   644
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   645
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   646
blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   647
    "return the colornumber of black"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   648
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   649
    ^ blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   650
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   651
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   652
button1MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   653
    "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
   654
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   655
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   656
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   657
    RETURN (__MKSMALLINT(Button1MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   658
%}
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   659
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   660
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   661
     Display button1MotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   662
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   663
!
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
button2MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   666
    "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
   667
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   668
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   669
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   670
    RETURN (__MKSMALLINT(Button2MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   671
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   672
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   673
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   674
button3MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   675
    "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
   676
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   677
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   678
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   679
    RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   680
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   681
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   682
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   683
buttonMotionMask:aButton
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   684
    "return the state-mask for button1 in motion events state-field.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   685
     This is the devices mask."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   686
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   687
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   688
    if (aButton == __MKSMALLINT(1)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   689
	RETURN (__MKSMALLINT(Button1MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   690
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   691
    if (aButton == __MKSMALLINT(2)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   692
	RETURN (__MKSMALLINT(Button2MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   693
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   694
    if (aButton == __MKSMALLINT(3)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   695
	RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   696
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   697
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   698
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   699
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   700
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   701
controlMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   702
    "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
   703
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   704
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   705
    ^ self ctrlModifierMask
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   706
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   707
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   708
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   709
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   710
displayFileDescriptor
48194c26a46c Initial revision
claus
parents:
diff changeset
   711
    "return the displays fileNumber - for select"
48194c26a46c Initial revision
claus
parents:
diff changeset
   712
48194c26a46c Initial revision
claus
parents:
diff changeset
   713
%{  /* NOCONTEXT */
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   714
#ifndef WIN32
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   715
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   716
	RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) );
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   717
    }
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   718
#endif
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   719
    RETURN (nil);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   720
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
   721
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   722
133
claus
parents: 132
diff changeset
   723
displayName
claus
parents: 132
diff changeset
   724
    "return the X-connections display name.
claus
parents: 132
diff changeset
   725
     This is (currently) nil for the default display, 
claus
parents: 132
diff changeset
   726
     something like foo:0 for any other remote display.
claus
parents: 132
diff changeset
   727
     Future versions may return non-nil strings for the default display as well."
claus
parents: 132
diff changeset
   728
claus
parents: 132
diff changeset
   729
    ^ displayName
claus
parents: 132
diff changeset
   730
!
claus
parents: 132
diff changeset
   731
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   732
protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   733
    "return the X-servers protocol version - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   734
     any interest"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   735
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   736
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   737
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   738
	RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   739
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   740
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   741
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   742
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   743
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   744
     Display protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   745
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   746
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   747
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   748
serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   749
    "return the X-server vendor string - this should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   750
     any interest, but can be for special cases
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   751
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   752
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   753
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   754
	RETURN ( __MKSTRING(XServerVendor(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   755
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   756
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   757
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   758
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   759
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   760
     Display serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   761
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   762
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   763
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   764
shiftMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   765
    "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
   766
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   767
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   768
    ^ self shiftModifierMask
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   769
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   770
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   771
translatePoint:aPoint from:windowId1 to:windowId2
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   772
    "given a point in window1, return the coordinate in window2.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   773
     This expects a device coordinate (relative to the first views origin)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   774
     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
   775
     - use to xlate points from a window to rootwindow"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   776
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   777
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   778
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   779
    |x1 y1 x2 y2|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   780
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   781
    x1 := x2 := aPoint x truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   782
    y1 := y2 := aPoint y truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   783
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   784
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   785
    Window w1, w2, child_ret;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   786
    int screen = __intVal(__INST(screen));
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   787
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   788
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   789
     && __isExternalAddress(windowId1)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   790
     && __isExternalAddress(windowId2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   791
     && __bothSmallInteger(x1, y1)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   792
	Display *dpy = myDpy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   793
	Window rootWin;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   794
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   795
	w1 = __WindowVal(windowId1);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   796
	w2 = __WindowVal(windowId2);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   797
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   798
#ifdef VIRTUAL_ROOT
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   799
	rootWin = RootWindow(dpy, screen);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   800
	if ((w1 == rootWin) || (w2 == rootWin)) {
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   801
	    if (w1 == rootWin) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   802
		w1 = getRootWindow(dpy, screen);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   803
	    }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   804
	    if (w2 == rootWin) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   805
		w2 = getRootWindow(dpy, screen);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   806
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   807
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   808
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   809
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   810
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   811
	XTranslateCoordinates(dpy, w1, w2,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   812
			      __intVal(x1), __intVal(y1), 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   813
			      &xpos, &ypos, &child_ret);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   814
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   815
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   816
	x2 = __MKSMALLINT(xpos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   817
	y2 = __MKSMALLINT(ypos);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   818
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   819
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   820
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   821
    ^ (x2 @ y2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   822
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   823
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   824
vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   825
    "return the X-servers vendor release - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   826
     any interest, but can be for special cases.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   827
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   828
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   829
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   830
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   831
	RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   832
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   833
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   834
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   835
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   836
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   837
     Display vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   838
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   839
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   840
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   841
viewIdFromPoint:aPoint in:windowId
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   842
    "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
   843
     hit by this coordinate. Return nil if no view was hit.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   844
     The returned id may be the id of a non ST view.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   845
     - 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
   846
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   847
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   848
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   849
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   850
    int screen = __intVal(__INST(screen));
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   851
    OBJ xp, yp;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   852
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   853
    Window child_ret;
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   854
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   855
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   856
     && __isExternalAddress(windowId)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   857
     && __isPoint(aPoint)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   858
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   859
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   860
	xp = _point_X(aPoint);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   861
	yp = _point_Y(aPoint);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   862
	if (__bothSmallInteger(xp, yp)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   863
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   864
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   865
	    XTranslateCoordinates(dpy,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   866
				  RootWindow(dpy, screen),
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   867
				  __WindowVal(windowId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   868
				  __intVal(xp), __intVal(yp), 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   869
				  &xpos, &ypos, &child_ret);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   870
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   871
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   872
	    if (child_ret) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   873
		RETURN ( __MKEXTERNALADDRESS(child_ret) );
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   874
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   875
	    RETURN ( nil );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   876
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   877
    }
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
    windowId notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   880
	aPoint isPoint ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   881
	    ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   882
	]
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   883
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   884
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   885
    ^ nil
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   886
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   887
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   888
virtualExtent
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   889
    "return the virtual extent of the display (in pixels).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   890
     On most systems, this is the same as the physical width;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   891
     except, if a window manager with a virtual desktop like olvwm
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   892
     (simulating a bigger screen) is running."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   893
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   894
%{
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   895
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   896
     && (__INST(rootId) != __INST(virtualRootId)) 
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   897
     && __isExternalAddress(__INST(virtualRootId))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   898
	Window vRootWin;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   899
	Window root;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   900
	int x, y;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   901
	unsigned int width, height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   902
	unsigned int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   903
	int ret;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   904
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   905
	vRootWin = __WindowVal(__INST(virtualRootId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   906
	ENTER_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   907
	ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   908
					  &dummy, &dummy);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   909
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   910
	if (ret) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   911
	    RETURN ( __MKPOINT_INT(width, height) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   912
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   913
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   914
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   915
    ^ width @ height
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   916
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   917
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   918
whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   919
    "return the colornumber of white"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   920
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   921
    ^ whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   922
! !
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   923
3263
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 3250
diff changeset
   924
!XWorkstation methodsFor:'accessing-display capabilities'!
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   925
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   926
hasDPS
186
claus
parents: 180
diff changeset
   927
    "return true, if this workstation supports display postscript.
claus
parents: 180
diff changeset
   928
     Both the server must support it, and the feature must have been
claus
parents: 180
diff changeset
   929
     enabled in the smalltalk system, for true to be returned."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   930
48194c26a46c Initial revision
claus
parents:
diff changeset
   931
    ^ hasDPSExtension
186
claus
parents: 180
diff changeset
   932
claus
parents: 180
diff changeset
   933
    "
claus
parents: 180
diff changeset
   934
     Display hasDPS 
claus
parents: 180
diff changeset
   935
    "
claus
parents: 180
diff changeset
   936
!
claus
parents: 180
diff changeset
   937
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   938
hasExtension:extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   939
    "query for an X extension. The argument, extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   940
     should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc).
186
claus
parents: 180
diff changeset
   941
     Return true, if that extension is available in the server.
claus
parents: 180
diff changeset
   942
     (which does not imply, that there is support in smalltalk for it."
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   943
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   944
    <context: #return>
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   945
%{
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   946
    int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   947
    OBJ rslt = false;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   948
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   949
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   950
     && __isNonNilObject(extensionString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   951
     && (__qIsString(extensionString) || __qIsSymbol(extensionString))) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   952
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   953
	if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   954
	    rslt = true;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   955
	}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   956
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   957
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   958
    RETURN (rslt);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   959
%}
186
claus
parents: 180
diff changeset
   960
claus
parents: 180
diff changeset
   961
    "
claus
parents: 180
diff changeset
   962
     Display hasExtension:'XVideo' 
claus
parents: 180
diff changeset
   963
     Display hasExtension:'Input' 
claus
parents: 180
diff changeset
   964
     Display hasExtension:'GLX' 
claus
parents: 180
diff changeset
   965
     Display hasExtension:'X3D-PEX' 
claus
parents: 180
diff changeset
   966
     Display hasExtension:'XInputExtension' 
claus
parents: 180
diff changeset
   967
     Display hasExtension:'SHAPE' 
claus
parents: 180
diff changeset
   968
     Display hasExtension:'MIT-SHM' 
claus
parents: 180
diff changeset
   969
     Display hasExtension:'SGIFullScreenStereo' 
claus
parents: 180
diff changeset
   970
    "
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   971
!
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   972
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   973
hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   974
    "return true, if this workstation supports the X image extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   975
     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
   976
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   977
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   978
    ^ hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   979
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   980
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   981
     Display hasImageExtension 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   982
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   983
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   984
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   985
hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   986
    "return true, if this workstation supports the X input extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   987
     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
   988
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   989
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   990
    ^ hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   991
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   992
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   993
     Display hasInputExtension 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   994
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   995
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   996
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   997
hasMultibuffer
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   998
    "return true, if this workstation supports the multibuffer extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   999
     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
  1000
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1001
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1002
    ^ hasMbufExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1003
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1004
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1005
     Display hasMultibuffer 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1006
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1007
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1008
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1009
hasPEX
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1010
    "return true, if this workstation supports PEX 3D graphics.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1011
     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
  1012
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1013
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1014
    ^ hasPEXExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1015
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1016
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1017
     Display hasPEX 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1018
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1019
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1020
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1021
hasShm
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1022
    "return true, if this workstation supports the shared pixmap extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1023
     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
  1024
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1025
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1026
    ^ hasShmExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1027
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1028
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1029
     Display hasShm 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1030
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1031
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1032
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1033
hasXVideo
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1034
    "return true, if this workstation supports the XVideo extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1035
     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
  1036
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1037
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1038
    ^ hasXVideoExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1039
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1040
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1041
     Display hasXVideo 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1042
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1043
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1044
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1045
iconSizes
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1046
    "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
  1047
     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
  1048
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1049
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1050
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1051
    |xIconSizes count ret|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1052
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1053
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1054
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1055
    XIconSize *sizeList;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1056
    int cnt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1057
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1058
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1059
	Display *dpy = myDpy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1060
	int status;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1061
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1062
	ENTER_XLIB();
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  1063
	status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1064
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1065
	if (status > 0) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1066
	   xIconSizes = __MKEXTERNALBYTES(sizeList);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1067
	   count = __MKSMALLINT(cnt);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1068
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1069
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1070
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1071
    xIconSizes isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1072
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1073
    ret := OrderedCollection new:count.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1074
    1 to:count do:[ :i |
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1075
	|minWidth minHeight maxWidth maxHeight widthStep heightStep d|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1076
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1077
%{
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1078
	XIconSize *slp;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1079
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1080
	slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1];
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1081
	minWidth = __MKSMALLINT(slp->min_width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1082
	minHeight = __MKSMALLINT(slp->min_height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1083
	maxWidth = __MKSMALLINT(slp->max_width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1084
	maxHeight = __MKSMALLINT(slp->max_height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1085
	widthStep = __MKSMALLINT(slp->width_inc);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1086
	heightStep = __MKSMALLINT(slp->height_inc);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1087
%}.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1088
	d := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1089
	d at:#minWidth put:minWidth.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1090
	d at:#maxWidth put:maxWidth.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1091
	d at:#widthStep put:widthStep.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1092
	d at:#minHeight put:minHeight.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1093
	d at:#maxHeight put:maxHeight.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1094
	d at:#heightStep put:heightStep.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1095
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1096
	ret add:d
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1097
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1098
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1099
    xIconSizes free.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1100
    ^ ret
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1101
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1102
    "
819
88aaa6ff1ca3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 818
diff changeset
  1103
     Display iconSizes
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1104
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1105
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1106
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1107
ignoreBackingStore:aBoolean
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1108
    "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
  1109
     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
  1110
     very slow or is broken (can be put into display-rc-file)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1111
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1112
    ignoreBackingStore := aBoolean
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1113
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1114
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1115
preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1116
    "return the displays preferred size for icons.
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1117
     Redefined to return a special value on SGI servers."
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1118
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1119
    self serverVendor = 'Silicon Graphics' ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1120
	^ 86@68
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1121
    ].
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1122
    ^ super preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1123
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1124
    "Created: 10.6.1996 / 21:06:48 / cg"
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1125
!
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1126
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1127
queryBlackPixel
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1128
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1129
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1130
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1131
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1132
	int scr;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1133
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1134
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1135
	scr = DefaultScreen(dpy);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1136
	RETURN ( __MKSMALLINT(BlackPixel(dpy, scr)));
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1137
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1138
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1139
    ^ nil
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1140
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1141
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1142
     Display queryBlackPixel
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1143
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1144
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1145
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1146
queryCells
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1147
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1148
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1149
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1150
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1151
	int scr;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1152
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1153
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1154
	scr = DefaultScreen(dpy);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1155
	RETURN ( __MKSMALLINT(DisplayCells(dpy, scr)));
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1156
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1157
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1158
    ^ nil
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1159
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1160
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1161
     Display queryCells 
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1162
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1163
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1164
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1165
queryDPSExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1166
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1167
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1168
#ifdef DPS
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1169
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1170
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1171
	int dummy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1172
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1173
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1174
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1175
	if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1176
	    RETURN ( true );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1177
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1178
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1179
#endif
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1180
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1181
    ^ false
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1182
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1183
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1184
     Display queryDPSExtension  
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1185
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1186
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1187
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1188
queryDefaultScreen
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1189
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1190
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1191
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1192
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1193
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1194
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1195
	RETURN ( __MKSMALLINT(DefaultScreen(dpy)));
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1196
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1197
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1198
    ^ nil
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1199
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1200
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1201
     Display queryDefaultScreen  
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1202
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1203
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1204
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1205
queryDefaultVisualType
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1206
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1207
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1208
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1209
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1210
	Visual *visual;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1211
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1212
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1213
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1214
	switch (visual->class) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1215
	    case StaticGray:
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1216
		RETURN ( @symbol(StaticGray) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1217
	    case GrayScale:
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1218
		RETURN ( @symbol(GrayScale) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1219
	    case StaticColor:
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1220
		RETURN ( @symbol(StaticColor) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1221
	    case PseudoColor:
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1222
		RETURN ( @symbol(PseudoColor) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1223
	    case TrueColor:
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1224
		RETURN ( @symbol(TrueColor) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1225
	    case DirectColor:
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1226
		RETURN ( @symbol(DirectColor) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1227
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1228
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1229
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1230
    ^ nil
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1231
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1232
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1233
     Display queryDefaultVisualType
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1234
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1235
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1236
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1237
queryDepth
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1238
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1239
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1240
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1241
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1242
	int scr;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1243
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1244
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1245
	scr = DefaultScreen(dpy);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1246
	RETURN ( __MKSMALLINT(DisplayPlanes(dpy, scr)));
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1247
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1248
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1249
    ^ nil
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1250
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1251
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1252
     Display queryDepth  
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1253
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1254
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1255
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1256
queryHeight
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1257
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1258
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1259
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1260
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1261
	int scr;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1262
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1263
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1264
	scr = DefaultScreen(dpy);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1265
	RETURN ( __MKSMALLINT(DisplayHeight(dpy, scr)));
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1266
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1267
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1268
    ^ nil
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1269
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1270
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1271
     Display queryHeight      
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1272
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1273
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1274
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1275
queryHeightMM
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1276
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1277
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1278
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1279
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1280
	int scr;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1281
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1282
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1283
	scr = DefaultScreen(dpy);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1284
	RETURN ( __MKSMALLINT(DisplayHeightMM(dpy, scr)));
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1285
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1286
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1287
    ^ nil
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1288
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1289
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1290
     Display queryHeightMM      
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1291
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1292
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1293
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1294
queryMBUFExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1295
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1296
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1297
#ifdef MBUF
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1298
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1299
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1300
	int dummy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1301
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1302
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1303
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1304
	if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1305
	    RETURN ( true );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1306
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1307
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1308
#endif
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1309
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1310
    ^ false
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1311
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1312
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1313
     Display queryMBUFExtension  
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1314
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1315
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1316
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1317
queryPEXExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1318
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1319
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1320
#ifdef PEX5
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1321
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1322
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1323
	int dummy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1324
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1325
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1326
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1327
	if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1328
	    RETURN ( true );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1329
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1330
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1331
#endif
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1332
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1333
    ^ false
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1334
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1335
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1336
     Display queryPEXExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1337
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1338
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1339
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1340
queryRGBMasks
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1341
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1342
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1343
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1344
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1345
	Visual *visual;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1346
	OBJ redMask, greenMask, blueMask, bprgb;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1347
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1348
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1349
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1350
	redMask   = __MKSMALLINT(visual->red_mask);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1351
	greenMask = __MKSMALLINT(visual->green_mask);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1352
	blueMask  = __MKSMALLINT(visual->blue_mask);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1353
	bprgb  = __MKSMALLINT(visual->bits_per_rgb);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1354
	RETURN ( __ARRAY_WITH4(redMask, greenMask, blueMask, bprgb) );
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1355
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1356
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1357
    ^ nil
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1358
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1359
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1360
     Display queryRGBMasks
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1361
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1362
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1363
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1364
querySHMExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1365
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1366
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1367
#ifdef xxSHM
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1368
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1369
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1370
	int dummy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1371
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1372
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1373
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1374
	if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1375
	    RETURN ( true );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1376
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1377
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1378
#endif
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1379
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1380
    ^ false
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1381
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1382
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1383
     Display querySHMExtension  
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1384
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1385
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1386
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1387
queryShapeExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1388
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1389
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1390
#ifdef SHAPE
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1391
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1392
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1393
	int dummy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1394
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1395
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1396
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1397
	if (XShapeQueryExtension(dpy, &dummy, &dummy)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1398
	    RETURN ( true );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1399
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1400
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1401
#endif
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1402
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1403
    ^ false
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1404
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1405
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1406
     Display queryShapeExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1407
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1408
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1409
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1410
queryWhitePixel
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1411
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1412
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1413
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1414
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1415
	int scr;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1416
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1417
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1418
	scr = DefaultScreen(dpy);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1419
	RETURN ( __MKSMALLINT(WhitePixel(dpy, scr)));
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1420
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1421
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1422
    ^ nil
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1423
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1424
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1425
     Display queryWhitePixel    
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1426
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1427
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1428
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1429
queryWidth
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1430
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1431
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1432
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1433
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1434
	int scr;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1435
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1436
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1437
	scr = DefaultScreen(dpy);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1438
	RETURN ( __MKSMALLINT(DisplayWidth(dpy, scr)));
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1439
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1440
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1441
    ^ nil
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1442
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1443
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1444
     Display queryWidth 
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1445
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1446
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1447
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1448
queryWidthMM
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1449
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1450
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1451
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1452
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1453
	int scr;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1454
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1455
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1456
	scr = DefaultScreen(dpy);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1457
	RETURN ( __MKSMALLINT(DisplayWidthMM(dpy, scr)));
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1458
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1459
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1460
    ^ nil
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1461
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1462
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1463
     Display queryWidthMM 
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1464
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1465
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1466
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1467
queryXIEExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1468
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1469
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1470
#ifdef XIE
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1471
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1472
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1473
	int dummy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1474
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1475
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1476
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1477
	if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1478
	    RETURN ( true );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1479
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1480
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1481
#endif
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1482
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1483
    ^ false
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1484
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1485
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1486
     Display queryXIEExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1487
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1488
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1489
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1490
queryXIExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1491
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1492
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1493
#ifdef XI
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1494
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1495
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1496
	int dummy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1497
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1498
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1499
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1500
	if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1501
	    RETURN ( true );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1502
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1503
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1504
#endif
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1505
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1506
    ^ false
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1507
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1508
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1509
     Display queryXIExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1510
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1511
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1512
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1513
queryXVideoExtension
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1514
%{  /* NOCONTEXT */
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1515
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1516
#ifdef XVIDEO
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1517
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1518
	Display *dpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1519
	int dummy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1520
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1521
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1522
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1523
	if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1524
	    RETURN ( true );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  1525
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1526
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1527
#endif
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1528
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1529
    ^ false
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1530
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1531
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1532
     Display queryXVideoExtension  
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1533
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1534
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1535
1025
40dde7d8f538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  1536
scrollsAsynchronous
1008
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1537
    "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
  1538
     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
  1539
     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
  1540
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1541
    ^ true
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1542
!
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1543
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1544
supportedImageFormats
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1545
    "return an array with supported image formats; 
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1546
     each array entry is an attribute dictionary, consisting of 
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1547
     depth, bitsPerPixel and padding values."
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1548
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1549
    |nFormats "{ Class: SmallInteger }"
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1550
     formatArray|
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1551
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1552
    Display *dpy;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1553
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1554
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1555
	RETURN (nil);
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1556
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1557
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1558
    dpy = myDpy;
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1559
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1560
    nFormats = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1561
#else
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1562
    nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1563
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1564
%}.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1565
    formatArray := Array new:nFormats.
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1566
    1 to:nFormats do:[:index |
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1567
	|info bitsPerPixelInfo depthInfo paddingInfo i|
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1568
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1569
	i := index.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1570
%{
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1571
	ScreenFormat *format;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1572
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1573
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1574
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1575
	depthInfo = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1576
	bitsPerPixelInfo = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1577
	paddingInfo = __MKSMALLINT(8);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1578
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1579
	format = DISPLAYACCESS(dpy)->pixmap_format;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1580
	format += (__intVal(i)-1);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1581
	bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1582
	depthInfo = __MKSMALLINT(format->depth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1583
	paddingInfo = __MKSMALLINT(format->scanline_pad);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1584
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1585
%}.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1586
	info := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1587
	info at:#depth put:depthInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1588
	info at:#bitsPerPixel put:bitsPerPixelInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1589
	info at:#padding put:paddingInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1590
	formatArray at:index put:info.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1591
    ].
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1592
    ^ formatArray
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1593
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1594
    "
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1595
     Display supportedImageFormats 
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1596
    "
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1597
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1598
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1599
supportsAnyViewBackgroundPixmaps
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1600
    "return true, if the device allows pixmaps as
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1601
     viewBackground."
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1602
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1603
    ^ true
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1604
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1605
    "Created: / 4.5.1999 / 18:41:07 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1606
!
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1607
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1608
supportsArbitraryShapedViews
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1609
    "return true, if this workstation supports arbitrary shaped windows.
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1610
     Both the server must support it (the shape-extension), 
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1611
     and the feature must have been enabled in the smalltalk system, 
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1612
     for true to be returned."
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1613
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1614
    ^ hasShapeExtension
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1615
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1616
    "
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1617
     Display supportsArbitraryShapedViews   
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1618
    "
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1619
!
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1620
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1621
supportsIconViews
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1622
    "return true, if this device supports views as icons.
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1623
     Only Xservers (currently) support this."
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1624
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1625
    ^ true
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1626
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1627
    "
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1628
     Display supportsIconViews 
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1629
    "
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1630
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1631
    "Modified: 10.6.1996 / 20:11:48 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1632
    "Created: 10.6.1996 / 21:08:18 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1633
!
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1634
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1635
supportsMaskedDrawingWith:aForm
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1636
    "return true, if the device allows the given form pixmap
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1637
     to be used as paint color. 
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1638
     True returned here - X has no trouble with any mask."
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1639
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1640
    ^ true
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1641
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1642
    "Created: / 4.5.1999 / 12:16:43 / cg"
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1643
!
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1644
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1645
supportsViewBackgroundPixmap:aForm
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1646
    "return true, if the device allows the given pixmap as
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1647
     viewBackground. 
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1648
     True returned here - X support any size."
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1649
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1650
    ^ true
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1651
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1652
    "Created: / 4.5.1999 / 18:40:42 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1653
    "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
  1654
!
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1655
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1656
supportsViewGravity
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1657
    "return true, if this device supports gravity attributes.
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
  1658
     We do not depend on it being implemented, but some resizing operations
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1659
     are faster, it is is."
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1660
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1661
    ^ true
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1662
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1663
48194c26a46c Initial revision
claus
parents:
diff changeset
  1664
!XWorkstation methodsFor:'bitmap/window creation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1665
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1666
createBitmapFromArray:anArray width:w height:h
2896
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1667
    "create a monochrome, depth1 bitmap from a given (byte-)array.
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1668
     The rows are aligned to a multiple of 8"
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1669
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1670
    |bitmapId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1671
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1672
    bitmapId := self primCreateBitmapFromArray:anArray width:w height:h.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1673
    bitmapId isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1674
	self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1675
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1676
    ^ bitmapId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1677
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1678
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1679
createBitmapFromFile:aString for:aForm
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1680
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1681
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1682
    |id w h|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1683
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1684
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1685
    int screen = __intVal(__INST(screen));
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1686
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1687
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1688
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1689
     && (__qIsString(aString) || __qIsSymbol(aString))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1690
	Display *dpy = myDpy;
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1691
	char *filename;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1692
	int status;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1693
	Pixmap newBitmap;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1694
	unsigned b_width, b_height;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1695
	int b_x_hot, b_y_hot;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1696
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1697
	filename = (char *) __stringVal(aString);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1698
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1699
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1700
	ENTER_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1701
	status = XReadBitmapFile(dpy, RootWindow(dpy, screen),
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1702
				 filename, &b_width, &b_height, &newBitmap,
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1703
				 &b_x_hot, &b_y_hot);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1704
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1705
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1706
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1707
	if ((status == BitmapSuccess)  && newBitmap) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1708
#ifdef COUNT_RESOURCES
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1709
	    __cnt_bitmap++;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1710
#endif
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1711
	    w = __MKSMALLINT(b_width);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1712
	    h = __MKSMALLINT(b_height);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1713
	    id = __MKEXTERNALADDRESS(newBitmap);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1714
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1715
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1716
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1717
    id notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1718
	aForm setWidth:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1719
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1720
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1721
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1722
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1723
createBitmapWidth:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1724
    "allocate a bitmap on the Xserver, the contents is undefined
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1725
     (i.e. random). Return a bitmap id or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1726
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1727
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1728
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1729
%{  
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1730
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1731
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1732
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1733
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1734
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1735
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1736
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1737
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1738
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1739
				       __intVal(w), __intVal(h), 1);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1740
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1741
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1742
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1743
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1744
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1745
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1746
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1747
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1748
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1749
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1750
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1751
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1752
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1753
createPixmapWidth:w height:h depth:d
48194c26a46c Initial revision
claus
parents:
diff changeset
  1754
    "allocate a pixmap on the Xserver, the contents is undefined
48194c26a46c Initial revision
claus
parents:
diff changeset
  1755
     (i.e. random). Return a bitmap id or nil"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1756
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1757
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1758
%{  
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1759
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1760
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1761
    Pixmap newBitmap;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1762
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1763
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1764
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1765
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1766
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1767
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1768
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1769
				       __intVal(w), __intVal(h), __intVal(d));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1770
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1771
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1772
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1773
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1774
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1775
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1776
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1777
    }
1424
29fb970f157f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
  1778
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1779
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1780
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1781
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1782
1468
9832c4017a70 added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1783
createWindowFor:aView type:typeSymbol
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1784
		 origin:origin
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1785
		 extent:extent
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1786
		 minExtent:minExt 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1787
		 maxExtent:maxExt
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1788
		 borderWidth:bWidth
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1789
		 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
  1790
		 style:wStyle
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1791
		 inputOnly:winputOnly
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1792
		 label:wlabel
1960
aa9ef6e21f15 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1916
diff changeset
  1793
		 owner:wowner
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1794
		 icon:wicon iconMask:wiconMask
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1795
		 iconView:wiconView
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1796
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1797
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1798
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1799
    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight 
1960
aa9ef6e21f15 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1916
diff changeset
  1800
     bColorId wsuperViewId wiconId wiconMaskId windowId
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1801
     weventMask wiconViewId bitGravity viewGravity vBgColor
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1802
     vBgForm deepForm preferredVisual preferredDepth|
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1803
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1804
    displayId isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1805
	self primitiveFailedOrClosedConnection.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1806
	^ nil
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1807
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1808
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1809
    origin notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1810
	xpos := origin x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1811
	ypos := origin y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1812
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1813
	xpos := ypos := 0.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1814
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1815
    extent notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1816
	wwidth := extent x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1817
	wheight := extent y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1818
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1819
	wwidth := wheight := 100.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1820
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1821
    minExt notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1822
	minWidth := minExt x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1823
	minHeight := minExt y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1824
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1825
    maxExt notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1826
	maxWidth := maxExt x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1827
	maxHeight := maxExt y
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1828
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1829
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1830
    wsuperView notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1831
	wsuperViewId := wsuperView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1832
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1833
48194c26a46c Initial revision
claus
parents:
diff changeset
  1834
    wicon notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1835
	wiconId := wicon id.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1836
	wiconMask notNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1837
	    wiconMaskId := wiconMask id
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1838
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1839
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1840
    wiconView notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1841
	wiconViewId := wiconView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1842
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1843
    weventMask := aView eventMask.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1844
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1845
    preferredVisual := aView preferredVisual.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1846
    preferredDepth := aView preferredDepth.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1847
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1848
%{  /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1849
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1850
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1851
    Visual visual;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1852
    XGCValues xgcv;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1853
    XSetWindowAttributes xswa;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1854
    XSizeHints sizehints;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1855
    XWMHints wmhints;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1856
    int bw, bd, bg;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1857
    Window newWindow, parentWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1858
    char *windowName;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1859
    XFontStruct *f;
1537
16265a27165d icon masks
Claus Gittinger <cg@exept.de>
parents: 1535
diff changeset
  1860
    Pixmap backPixmap = (Pixmap)0, 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1861
	   iconBitmap = (Pixmap)0,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1862
	   iconMask = (Pixmap)0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1863
    int flags = 0, depth, ioClass;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1864
    Window iconWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1865
    Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1866
    Atom WmQuitAppAtom;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1867
    Atom atoms[3];
48194c26a46c Initial revision
claus
parents:
diff changeset
  1868
    int atomCount = 0, isTopWindow = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1869
48194c26a46c Initial revision
claus
parents:
diff changeset
  1870
    sizehints.flags = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1871
    sizehints.width = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1872
    sizehints.height = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1873
    sizehints.x = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1874
    sizehints.y = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1875
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1876
    if (__bothSmallInteger(wwidth, wheight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1877
	sizehints.flags |= PSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1878
	sizehints.width = __intVal(wwidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1879
	sizehints.height = __intVal(wheight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1880
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1881
    if (__bothSmallInteger(xpos, ypos)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1882
	sizehints.flags |= PPosition;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1883
	sizehints.x = __intVal(xpos);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1884
	sizehints.y = __intVal(ypos);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1885
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1886
    if (__bothSmallInteger(minWidth, minHeight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1887
	sizehints.flags |= PMinSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1888
	sizehints.min_width = __intVal(minWidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1889
	sizehints.min_height = __intVal(minHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1890
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1891
    if (__bothSmallInteger(maxWidth, maxHeight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1892
	sizehints.flags |= PMaxSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1893
	sizehints.max_width = __intVal(maxWidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1894
	sizehints.max_height = __intVal(maxHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1895
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1896
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
  1897
    bg = WhitePixel(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1898
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1899
    if (__isSmallInteger(bWidth)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1900
	bw = __intVal(bWidth);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1901
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1902
	bw = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1903
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1904
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  1905
    bd = BlackPixel(dpy, screen);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1906
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1907
    if (__isExternalAddress(wsuperViewId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1908
	parentWindow = __WindowVal(wsuperViewId);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1909
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1910
	parentWindow = RootWindow(dpy, screen);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1911
	isTopWindow = 1;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1912
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1913
1695
46d9101e4bee replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
  1914
    if (wStyle == @symbol(popUp))
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1915
	xswa.override_redirect = 1;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1916
    else 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1917
	xswa.override_redirect = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1918
48194c26a46c Initial revision
claus
parents:
diff changeset
  1919
    if (winputOnly == true) 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1920
	ioClass = InputOnly;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1921
    else 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1922
	ioClass = InputOutput;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1923
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1924
    if (__isSmallInteger(weventMask)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1925
	xswa.event_mask = __intVal(weventMask);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1926
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1927
	xswa.event_mask = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1928
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1929
48194c26a46c Initial revision
claus
parents:
diff changeset
  1930
    if (ioClass == InputOnly) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1931
	bw = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1932
	depth = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1933
	flags |= CWEventMask;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1934
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1935
	depth = DefaultDepth(dpy,screen);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1936
	flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1937
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1938
	if (backPixmap != (Pixmap)0) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1939
	    xswa.background_pixmap = backPixmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1940
	    flags |= CWBackPixmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1941
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1942
	    xswa.background_pixel = bg;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1943
	    flags |= CWBackPixel;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1944
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1945
	xswa.border_pixel = bd;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1946
    }
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1947
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1948
    visual.visualid = CopyFromParent;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1949
    if (__isSmallInteger(preferredDepth)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1950
	depth = __intVal(preferredDepth);
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1951
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1952
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1953
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1954
    if (preferredVisual != nil) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1955
	XVisualInfo vi;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1956
	int cls;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1957
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1958
	if (preferredVisual == @symbol(StaticGray))
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1959
	    cls = StaticGray;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1960
	else if (preferredVisual == @symbol(GrayScale)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1961
	    cls = GrayScale;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1962
	else if (preferredVisual == @symbol(StaticColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1963
	    cls = StaticColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1964
	else if (preferredVisual == @symbol(PseudoColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1965
	    cls = PseudoColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1966
	else if (preferredVisual == @symbol(TrueColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1967
	    cls = TrueColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1968
	else if (preferredVisual == @symbol(DirectColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1969
	    cls = DirectColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1970
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1971
	    cls = PseudoColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1972
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1973
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1974
	if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1975
	    visual.visualid = vi.visualid;
163
claus
parents: 162
diff changeset
  1976
/*
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1977
	    printf("visualId=%x\n", vi.visualid);
163
claus
parents: 162
diff changeset
  1978
*/
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1979
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1980
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1981
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1982
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1983
    ENTER_XLIB();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1984
    newWindow = XCreateWindow(dpy, parentWindow,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1985
			   sizehints.x, sizehints.y,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1986
			   sizehints.width, sizehints.height,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1987
			   bw, depth, ioClass, &visual,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1988
			   flags, &xswa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1989
    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1990
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1991
48194c26a46c Initial revision
claus
parents:
diff changeset
  1992
    if (! newWindow) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1993
	RETURN ( nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1994
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1995
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1996
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1997
    __cnt_view++;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1998
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1999
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2000
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2001
48194c26a46c Initial revision
claus
parents:
diff changeset
  2002
    /*
48194c26a46c Initial revision
claus
parents:
diff changeset
  2003
     * define its icon and name
48194c26a46c Initial revision
claus
parents:
diff changeset
  2004
     * (only makes sense for topWindows)
48194c26a46c Initial revision
claus
parents:
diff changeset
  2005
     */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2006
    if (isTopWindow) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2007
	if (__isExternalAddress(wiconId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2008
	    iconBitmap = __PixmapVal(wiconId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2009
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2010
	    iconBitmap = (Pixmap)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2011
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2012
	if (__isExternalAddress(wiconMaskId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2013
	    iconMask = __PixmapVal(wiconMaskId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2014
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2015
	    iconMask = (Pixmap)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2016
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2017
	if (__isExternalAddress(wiconViewId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2018
	    iconWindow = __WindowVal(wiconViewId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2019
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2020
	    iconWindow = (Window)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2021
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2022
	if (__isString(wlabel) || __isSymbol(wlabel))
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2023
	    windowName = (char *) __stringVal(wlabel);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2024
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2025
	    windowName = "";
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2026
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2027
	if (iconBitmap || windowName) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2028
	    ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2029
	    XSetStandardProperties(dpy, newWindow,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2030
					windowName, windowName,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2031
					iconBitmap,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2032
					0, 0, &sizehints);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2033
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2034
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2035
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2036
	wmhints.flags = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2037
	if (iconBitmap) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2038
	    wmhints.flags |= IconPixmapHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2039
	    wmhints.icon_pixmap = iconBitmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2040
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2041
	if (iconMask) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2042
	    wmhints.flags |= IconMaskHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2043
	    wmhints.icon_mask = iconMask;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2044
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2045
	if (iconWindow) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2046
	    wmhints.flags |= IconWindowHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2047
	    wmhints.icon_window = iconWindow;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2048
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2049
/*
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2050
	wmhints.flags |= InputHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2051
	wmhints.input = True;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2052
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2053
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2054
	XSetWMHints(dpy, newWindow, &wmhints);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2055
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2056
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2057
	/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2058
	 * tell window manager to not kill us but send an event instead
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2059
	 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2060
	/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2061
	 * get atoms first (if not already known)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2062
	 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2063
	if (__INST(protocolsAtom) == nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2064
	    ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2065
	    WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2066
	    __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2067
#ifdef USE_SAVEYOURSELF_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2068
	    WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2069
	    __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2070
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  2071
#ifdef USE_QUIT_APP_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2072
	    WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2073
	    __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2074
#endif
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2075
	    WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2076
	    __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2077
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2078
	} else {
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2079
#ifdef USE_QUIT_APP_ATOM
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2080
	    WmQuitAppAtom = __AtomVal(__INST(quitAppAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2081
#else
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2082
	    WmQuitAppAtom = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2083
#endif
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2084
	    WmProtocolsAtom = __AtomVal(__INST(protocolsAtom));
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2085
	    WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2086
#ifdef USE_SAVEYOURSELF_ATOM
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2087
	    WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2088
#else
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2089
	    WmSaveYourselfAtom = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2090
#endif
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2091
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2092
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2093
	atoms[0] = WmDeleteWindowAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2094
#ifdef USE_SAVEYOURSELF_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2095
	atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2096
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  2097
#ifdef USE_QUIT_APP_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2098
	atoms[atomCount] = WmQuitAppAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2099
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2100
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2101
	XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2102
			32, PropModeReplace, (unsigned char *)atoms, atomCount);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2103
	LEAVE_XLIB();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2104
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2105
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2106
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2107
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2108
    windowId = __MKEXTERNALADDRESS(newWindow);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2109
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2110
    self addKnownView:aView withId:windowId.
48194c26a46c Initial revision
claus
parents:
diff changeset
  2111
    ^ windowId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2112
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2113
48194c26a46c Initial revision
claus
parents:
diff changeset
  2114
destroyGC:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2115
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2116
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2117
%{ 
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2118
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2119
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2120
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2121
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2122
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2123
    if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2124
	GC gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2125
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2126
	if (gc) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2127
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2128
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2129
	    XFreeGC(myDpy, gc);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2130
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2131
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2132
	    __cnt_gc--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2133
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2134
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2135
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2136
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2137
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2138
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2139
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2140
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2141
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2142
destroyPixmap:aDrawableId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2143
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2144
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2145
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2146
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2147
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2148
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2149
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2150
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2151
    if (__isExternalAddress(aDrawableId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2152
	Pixmap pix = __PixmapVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2153
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2154
	if (pix) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2155
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2156
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2157
	    XFreePixmap(myDpy, pix);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2158
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2159
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2160
	    __cnt_bitmap--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2161
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2162
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2163
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2164
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2165
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2166
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2167
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2168
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2169
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2170
destroyView:aView withId:aWindowId
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2171
    self primDestroyView:aView withId:aWindowId.
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2172
    self removeKnownView:aView withId:aWindowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2173
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2174
48194c26a46c Initial revision
claus
parents:
diff changeset
  2175
dpsContextFor:aDrawableId and:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2176
48194c26a46c Initial revision
claus
parents:
diff changeset
  2177
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2178
#ifdef XXDPS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2179
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2180
    DPSContext dps;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2181
    int height;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2182
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2183
    if (__isExternalAddress(aDrawableId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2184
     && __isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2185
     && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2186
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2187
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2188
	dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId),
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2189
				       __GCVal(aGCId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2190
				       0, height, 0, colormap, NULL, 0,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2191
				       XDPSDefaultTextBackstop,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2192
				       XDPSDefaultErrorProc,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2193
				       NULL);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2194
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2195
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2196
	RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2197
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2198
#endif
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2199
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2200
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2201
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2202
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2203
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2204
gcFor:aDrawableId
132
claus
parents: 129
diff changeset
  2205
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2206
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2207
%{  
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2208
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2209
    GC gc;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2210
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2211
    if (__isExternalAddress(aDrawableId) && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2212
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2213
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2214
	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
  2215
	LEAVE_XLIB();
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2216
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2217
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2218
	if (gc)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2219
	    __cnt_gc++;
1089
dd14759d8370 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2220
#endif
dd14759d8370 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2221
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2222
	RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil );
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2223
    }
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2224
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2225
    self primitiveFailedOrClosedConnection.
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2226
    ^ nil
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2227
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2228
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2229
gcForBitmap:aDrawableId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2230
    "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
  2231
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2232
    ^ self gcFor:aDrawableId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2233
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2234
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2235
primCreateBitmapFromArray:anArray width:w height:h
154
claus
parents: 153
diff changeset
  2236
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2237
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2238
154
claus
parents: 153
diff changeset
  2239
%{  /* UNLIMITEDSTACK */
claus
parents: 153
diff changeset
  2240
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2241
    Display *dpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2242
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2243
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2244
    unsigned int b_width, b_height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2245
    REGISTER unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2246
    REGISTER unsigned char *pBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2247
    unsigned char *b_bits, *allocatedBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2248
    int index, row;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2249
    REGISTER int col;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2250
    unsigned bits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2251
    static char reverseBitTable[256];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2252
    static firstCall = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2253
    int nBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2254
    unsigned char fastBits[10000];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2255
    OBJ num, *op;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2256
    int bytesPerRow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2257
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2258
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2259
	RETURN (nil);
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2260
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2261
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2262
    dpy = myDpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2263
    if (firstCall) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2264
	for (index=0; index < 256; index++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2265
	    reverseBitTable[index] = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2266
	    if (index & 128) reverseBitTable[index] |=   1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2267
	    if (index &  64) reverseBitTable[index] |=   2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2268
	    if (index &  32) reverseBitTable[index] |=   4;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2269
	    if (index &  16) reverseBitTable[index] |=   8;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2270
	    if (index &   8) reverseBitTable[index] |=  16;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2271
	    if (index &   4) reverseBitTable[index] |=  32;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2272
	    if (index &   2) reverseBitTable[index] |=  64;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2273
	    if (index &   1) reverseBitTable[index] |= 128;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2274
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2275
	firstCall = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2276
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2277
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2278
    if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2279
	newBitmap = (Pixmap)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2280
	b_width = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2281
	b_height = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2282
	bytesPerRow = (b_width + 7) / 8;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2283
	nBytes = b_height * bytesPerRow;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2284
	if (nBytes < sizeof(fastBits)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2285
	    cp = b_bits = fastBits;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2286
	    allocatedBits = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2287
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2288
	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2289
	    if (! cp) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2290
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2291
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2292
	if (__qClass(anArray) == @global(Array)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2293
	    index = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2294
	    op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2295
	    for (row = b_height; row; row--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2296
		for (col = bytesPerRow; col; col--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2297
		    num = *op++;
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2298
		    if (__isSmallInteger(num)) {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2299
			bits = __intVal(num);
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2300
		    } else {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2301
			bits = __longIntVal(num);
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2302
			if (bits == 0) {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2303
			    goto fail;
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2304
			}
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2305
		    }
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2306
		    *cp++ = reverseBitTable[bits & 0xFF];
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2307
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2308
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2309
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2310
	    if (__qClass(anArray) == @global(ByteArray)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2311
		pBits = __ByteArrayInstPtr(anArray)->ba_element;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2312
		for (col = b_height*bytesPerRow; col; col--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2313
		    *cp++ = reverseBitTable[*pBits++];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2314
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2315
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2316
		goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2317
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2318
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2319
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2320
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2321
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2322
	newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2323
					       (char *)b_bits, 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2324
					       b_width, b_height);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2325
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2326
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2327
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2328
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2329
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2330
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2331
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2332
fail: ;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2333
	if (allocatedBits)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2334
	    free(allocatedBits);
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2335
	RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2336
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2337
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2338
    self primitiveFailedOrClosedConnection.
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2339
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2340
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2341
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2342
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
  2343
    "for rel5 only"
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2344
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2345
    ^ self primitiveFailedOrClosedConnection
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2346
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2347
!
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2348
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2349
primDestroyView:aView withId:aWindowId
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2350
    <context: #return>
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2351
%{
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2352
    if (! ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2353
	RETURN ( self );
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2354
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2355
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2356
    if (__isExternalAddress(aWindowId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2357
	Window win = __WindowVal(aWindowId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2358
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2359
	if (win) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2360
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2361
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2362
	    XDestroyWindow(myDpy, win);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2363
	    LEAVE_XLIB();
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2364
#ifdef COUNT_RESOURCES
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2365
	    __cnt_view--;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2366
#endif
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2367
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2368
	}
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2369
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2370
%}
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2371
!
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2372
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2373
realRootWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2374
    "return the id of the real root window.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2375
     This may not be the window you see as background,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2376
     since some window managers install a virtual root window on top
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2377
     of it. Except for very special cases, use #rootWindowId, which takes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2378
     care of any virtual root."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2379
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  2380
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2381
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2382
    Window root;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2383
    OBJ id;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2384
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2385
    if (__INST(rootId) != nil) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2386
	RETURN (__INST(rootId));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2387
    }
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2388
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2389
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2390
	root = RootWindow(myDpy, screen);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2391
	if (! root) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2392
	    id = nil;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2393
	} else {
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2394
	    __INST(rootId) = id = __MKEXTERNALADDRESS(root); __STORE(self, id);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2395
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2396
	RETURN (id);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2397
    }
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2398
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2399
    self primitiveFailedOrClosedConnection.
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2400
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2401
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2402
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2403
rootWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2404
    "return the id of the root window.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2405
     This is the window you see as background, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2406
     however, it may or may not be the real physical root window,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2407
     since some window managers install a virtual root window on top
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2408
     of the real one. If this is the case, that views id is returned here."
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2409
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  2410
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2411
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2412
    Window rootWin, vRootWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2413
    OBJ id;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2414
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2415
    if (__INST(virtualRootId) != nil) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2416
	RETURN (__INST(virtualRootId));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2417
    }
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2418
169
claus
parents: 168
diff changeset
  2419
    if (ISCONNECTED) {
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  2420
	Display *dpy = myDpy;
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2421
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2422
	vRootWin = rootWin = RootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2423
#ifndef IRIS
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2424
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2425
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2426
	 * on IRIS, this creates a badwindow error - why ?
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2427
	 * children contains a funny window (000034)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2428
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2429
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2430
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2431
	 * care for virtual root windows (tvtwm & friends)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2432
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2433
	{
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2434
	    Atom vRootAtom = None;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2435
	    int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2436
	    Window rootReturn, parentReturn;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2437
	    Window* children = (Window *)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2438
	    unsigned int numChildren;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2439
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2440
	    if (XQueryTree(dpy, rootWin, 
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2441
			   &rootReturn, &parentReturn, 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2442
			   &children, &numChildren)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2443
		vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True );
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2444
		if (vRootAtom != None) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2445
		    for (i=0; i < numChildren; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2446
			Atom actual_type;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2447
			int actual_format;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2448
			unsigned long nitems, bytesafter;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2449
			Window* newRoot = (Window*) 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2450
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2451
			if (children[i]) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2452
			    if (XGetWindowProperty(dpy, children[i], vRootAtom, 
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2453
						   0L, 1L, False, XA_WINDOW,
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2454
						   &actual_type, &actual_format, 
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2455
						   &nitems, &bytesafter,
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2456
						   (unsigned char**) &newRoot
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2457
						  ) == Success && newRoot) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2458
				vRootWin = *newRoot;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2459
				XFree(newRoot); /* XXX */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2460
				break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2461
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2462
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2463
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2464
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2465
		if (children) XFree( children );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2466
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2467
	}
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2468
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2469
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2470
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2471
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2472
    /* cannot happen */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2473
    if (! vRootWin) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2474
	vRootWin = rootWin;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2475
	if (! rootWin) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2476
	    RETURN ( nil );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2477
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2478
    }
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2479
    __INST(rootId) = id = __MKEXTERNALADDRESS(rootWin); __STORE(self, id);
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2480
    __INST(virtualRootId) = id = __MKEXTERNALADDRESS(vRootWin); __STORE(self, id);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2481
    RETURN ( id );
63
b9d17e2b6c92 keyRelease and more event masks
claus
parents: 55
diff changeset
  2482
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2483
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2484
48194c26a46c Initial revision
claus
parents:
diff changeset
  2485
!XWorkstation methodsFor:'color stuff'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2486
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2487
colorCell
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2488
    "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
  2489
     This method will return nil for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2490
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2491
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2492
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2493
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2494
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2495
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2496
    unsigned long dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2497
    Status ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2498
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2499
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2500
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2501
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2502
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2503
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2504
	ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2505
				   &dummy, 0, &color.pixel, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2506
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2507
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2508
	if (ok) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2509
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2510
	    __cnt_color++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2511
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2512
	    RETURN ( __MKSMALLINT(color.pixel) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2513
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2514
    }
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2515
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2516
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2517
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2518
48194c26a46c Initial revision
claus
parents:
diff changeset
  2519
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
  2520
    "allocate a color with color name - return the color index (i.e. colorID).
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2521
     Dont use this method, colornames are mostly X specific"
48194c26a46c Initial revision
claus
parents:
diff changeset
  2522
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2523
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2524
%{  
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2525
48194c26a46c Initial revision
claus
parents:
diff changeset
  2526
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2527
    XColor scolor, ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2528
    int screen = __intVal(__INST(screen));
850
Claus Gittinger <cg@exept.de>
parents: 847
diff changeset
  2529
    int id;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2530
    Status ok;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2531
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2532
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2533
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2534
     && (__qIsString(aString) || __qIsSymbol(aString))) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2535
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2536
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2537
	colorname = (char *) __stringVal(aString);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2538
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2539
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2540
	ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2541
	ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2542
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2543
	if (ok) {
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  2544
#ifdef QUICK_TRUE_COLORS
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2545
	    if (__INST(visualType) == @symbol(TrueColor)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2546
		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
  2547
		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
  2548
		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
  2549
		RETURN ( __MKSMALLINT(id) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2550
	    }
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2551
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2552
	    ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2553
	    ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2554
	    LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2555
	}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2556
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2557
	if (! ok) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2558
	    RETURN ( nil );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2559
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2560
#ifdef COUNT_RESOURCES
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2561
	__cnt_color++;
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2562
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2563
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2564
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2565
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2566
    ^ 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
  2567
!
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2568
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2569
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
  2570
    "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
  2571
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2572
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2573
%{
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2574
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2575
    XColor ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2576
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2577
    Status ok;
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2578
    int id;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2579
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2580
    if (__bothSmallInteger(r, g) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2581
     && __isSmallInteger(b)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2582
     && ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2583
	ecolor.red = __intVal(r);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2584
	ecolor.green= __intVal(g);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2585
	ecolor.blue = __intVal(b);
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2586
#ifdef QUICK_TRUE_COLORS
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2587
	if (__INST(visualType) == @symbol(TrueColor)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2588
	    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
  2589
	    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
  2590
	    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
  2591
	    RETURN ( __MKSMALLINT(id) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2592
	}
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2593
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2594
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2595
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2596
	ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2597
	ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2598
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2599
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2600
	if (! ok) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2601
	    RETURN ( nil );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2602
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2603
#ifdef COUNT_RESOURCES
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2604
	__cnt_color++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2605
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2606
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2607
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2608
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2609
    ^ super colorScaledRed:r scaledGreen:g scaledBlue:b
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2610
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2611
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2612
deviceColorValueToPercent:aDeviceValue
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2613
    "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
  2614
     x-component value (0..100)"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2615
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2616
    ^ (100.0 * aDeviceValue / 16rFFFF)
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2617
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2618
    "
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2619
     Display deviceColorValueToPercent:0      
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2620
     Display deviceColorValueToPercent:16r8000      
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2621
     Display deviceColorValueToPercent:16rFFFF
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2622
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2623
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2624
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2625
freeColor:colorIndex
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2626
    "free a display color when its no longer needed"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2627
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2628
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2629
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2630
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2631
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2632
    unsigned long color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2633
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2634
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2635
#ifdef QUICK_TRUE_COLORS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2636
    if (__INST(visualType) == @symbol(TrueColor)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2637
	/* no need to do anything on TrueColor displays ... */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2638
	RETURN (self);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2639
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2640
#endif
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2641
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2642
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2643
	RETURN (self);
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2644
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2645
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2646
    if (__isSmallInteger(colorIndex)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2647
	dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2648
	color = (long) __intVal(colorIndex);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2649
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2650
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2651
	XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2652
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2653
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2654
	__cnt_color--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2655
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2656
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2657
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2658
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2659
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2660
    self primitiveFailedOrClosedConnection
295
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
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2663
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
  2664
    "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
  2665
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2666
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2667
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2668
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2669
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2670
    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
  2671
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2672
    int bits, scale, shift;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2673
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2674
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2675
     && __isSmallInteger(index)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2676
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2677
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2678
	color.pixel = __intVal(index);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2679
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2680
	ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2681
	XQueryColor(dpy, DefaultColormap(dpy, screen), &color);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2682
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2683
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2684
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2685
	/* 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2686
	 * 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
  2687
	 * 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
  2688
	 * (for example, color white on a 4bitsPerRGB server will Return
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2689
	 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2690
	 */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2691
	bits = __intVal(__INST(bitsPerRGB));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2692
	scale = (1<<bits) - 1;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2693
	shift = 16 - bits;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2694
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2695
	sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2696
	sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2697
	sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2698
	RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2699
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2700
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2701
    ^ super getScaledRGBFrom:index
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2702
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2703
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2704
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
  2705
    "get rgb components (0..16rFFFF) of color named colorName,
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2706
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2707
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2708
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2709
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2710
    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
  2711
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2712
    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
  2713
    int bits, scale, shift;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2714
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2715
    if (ISCONNECTED
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2716
     && __isNonNilObject(colorName)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2717
     && (__qIsString(colorName) || __qIsSymbol(colorName))) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2718
	Display *dpy = myDpy;
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2719
        
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2720
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2721
	if (XParseColor(dpy, DefaultColormap(dpy, screen), 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2722
			     (char *) __stringVal(colorName), &color)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2723
	    /* 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2724
	     * 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
  2725
	     * 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
  2726
	     * (for example, color white on a 4bitsPerRGB server will Return
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2727
	     * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2728
	     */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2729
	    bits = __intVal(__INST(bitsPerRGB));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2730
	    scale = (1<<bits) - 1;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2731
	    shift = 16 - bits;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2732
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2733
	    sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2734
	    sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2735
	    sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2736
	    RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2737
	}
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2738
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2739
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2740
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2741
    ^ super getScaledRGBFromName:colorName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2742
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2743
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2744
listOfAvailableColors
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2745
    "return a list of all available colornames.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2746
     This should not be used, since colornames are very
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2747
     display-specific (here X-specific)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2748
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2749
    |aStream list line index colorName|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2750
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2751
    aStream := FileStream readonlyFileNamed:'/usr/lib/X11/rgb.txt'.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2752
    aStream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2753
    list := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2754
    [aStream atEnd] whileFalse:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2755
	line := aStream nextLine.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2756
	line notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2757
	    "skip the r/g/b numbers"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2758
	    index := 1.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2759
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2760
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2761
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2762
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2763
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2764
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2765
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2766
	    colorName := line copyFrom:index.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2767
	    ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2768
		list add:colorName
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2769
	    ]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2770
	]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2771
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2772
    aStream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2773
    ^ list sort
1047
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2774
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2775
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2776
     Screen current listOfAvailableColors
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2777
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2778
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2779
    "Modified: 11.9.1996 / 15:26:28 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2780
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2781
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2782
percentToDeviceColorValue:aPercentage
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2783
    "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
  2784
     x-component value (0..65k) as an integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2785
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2786
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2787
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2788
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2789
    if (__isSmallInteger(aPercentage)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2790
	RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2791
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2792
    if (__isFloat(aPercentage)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2793
	RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2794
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2795
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2796
    ^ (16rFFFF * aPercentage / 100) rounded
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2797
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2798
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2799
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
  2800
    "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
  2801
     This method is a noop for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2802
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2803
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2804
%{ 
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2805
48194c26a46c Initial revision
claus
parents:
diff changeset
  2806
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2807
    XColor color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2808
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2809
    int r, g, b;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2810
    int ok = 1;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2811
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2812
    if (__isSmallInteger(sred))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2813
	r = __intVal(sred);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2814
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2815
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2816
    if (__isSmallInteger(sgreen))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2817
	g = __intVal(sgreen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2818
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2819
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2820
    if (__isSmallInteger(sblue))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2821
	b = __intVal(sblue);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2822
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2823
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2824
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2825
     && __isSmallInteger(index) && ok) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2826
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2827
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2828
	color.pixel = __intVal(index);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2829
	color.red = r;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2830
	color.green = g;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2831
	color.blue = b;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2832
	color.flags = DoRed | DoGreen | DoBlue;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2833
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2834
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2835
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2836
	XStoreColor(dpy, DefaultColormap(dpy, screen), &color);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2837
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2838
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2839
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2840
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2841
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2842
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2843
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2844
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2845
!XWorkstation methodsFor:'cursor stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2846
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2847
builtInCursorShapes
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2848
    "return a collection of standard cursor names.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2849
     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
  2850
     user cursors.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2851
     (actually, there are more than those below ...)"
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2852
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2853
    "/ 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
  2854
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2855
    ^ #(
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2856
	#upLeftArrow            "/ XC_top_left_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2857
	#upRightHand            "/ XC_hand1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2858
	#upDownArrow            "/ XC_sb_v_double_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2859
	#leftRightArrow         "/ XC_sb_h_double_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2860
	#upLimitArrow           "/ XC_top_side         
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2861
	#downLimitArrow         "/ XC_bottom_side   
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2862
	#leftLimitArrow         "/ XC_left_side
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2863
	#rightLimitArrow        "/ XC_right_side
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2864
	#text                   "/ XC_xterm     
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2865
	#upRightArrow           "/ XC_draft_large
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2866
	#leftHand               "/ XC_hand2   
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2867
	#questionMark           "/ XC_question_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2868
	#cross                  "/ XC_X_cursor    
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2869
	#wait                   "/ XC_watch   
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2870
	#crossHair              "/ XC_tcross  
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2871
	#origin                 "/ XC_ul_angle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2872
	#topLeft                "/ XC_ul_angle    
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2873
	#corner                 "/ XC_lr_angle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2874
	#bottomRight            "/ XC_lr_angle      
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2875
	#topRight               "/ XC_ur_angle    
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2876
	#bottomLeft             "/ XC_ll_angle      
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2877
	#square                 "/ XC_dotbox     
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2878
	#fourWay                "/ XC_fleur     
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2879
	#crossCursor            "/ XC_X_cursor 
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2880
      )
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2881
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2882
    "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
  2883
    "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
  2884
!
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2885
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2886
colorCursor:aCursorId foreground:fgColor background:bgColor
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2887
    "change a cursors colors"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2888
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2889
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2890
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2891
    |fgR fgG fgB bgR bgG bgB|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2892
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2893
    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
  2894
    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
  2895
    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
  2896
    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
  2897
    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
  2898
    bgB := bgColor scaledBlue.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2899
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2900
    XColor fgcolor, bgcolor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2901
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2902
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2903
     && __isExternalAddress(aCursorId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2904
     && __bothSmallInteger(fgG, fgB)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2905
     && __bothSmallInteger(bgR, bgG) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2906
     && __bothSmallInteger(bgB, fgR)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2907
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2908
	fgcolor.red = __intVal(fgR);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2909
	fgcolor.green= __intVal(fgG);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2910
	fgcolor.blue = __intVal(fgB);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2911
	bgcolor.red = __intVal(bgR);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2912
	bgcolor.green= __intVal(bgG);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2913
	bgcolor.blue = __intVal(bgB);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2914
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2915
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2916
	XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2917
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2918
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2919
	RETURN ( self );
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2920
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2921
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2922
    self primitiveFailedOrClosedConnection
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2923
!
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2924
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2925
createCursorShape:aShape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2926
    "create a cursor given a shape-symbol. This only works
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2927
     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
  2928
     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
  2929
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2930
    |shapeNumber|
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2931
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2932
    shapeNumber := self shapeNumberFromSymbol:aShape.
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2933
    shapeNumber isNil ifTrue:[^ nil].
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2934
    ^ self primCreateCursorShapeNumber:shapeNumber
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2935
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2936
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2937
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
  2938
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2939
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2940
    ^ self
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2941
	primCreateCursorSourceFormId:sourceForm id 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2942
	maskFormId:maskForm id
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2943
	hotX:hx hotY:hy 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2944
	width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2945
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2946
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2947
destroyCursor:aCursorId
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2948
    "release a cursor - frees any device resources"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2949
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2950
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2951
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2952
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2953
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2954
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2955
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2956
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2957
    if (__isExternalAddress(aCursorId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2958
	Cursor curs = __CursorVal(aCursorId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2959
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2960
	if (curs) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2961
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2962
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2963
	    XFreeCursor(myDpy, curs);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2964
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2965
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2966
	    __cnt_cursor--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2967
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2968
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2969
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2970
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2971
    }
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2972
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2973
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2974
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2975
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2976
needDeviceFormsForCursor
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2977
    ^ true
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2978
!
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2979
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2980
primCreateCursorShapeNumber:aShapeNumber
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2981
    "create a cursor given a shape-number."
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2982
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2983
    <context: #return>
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2984
%{
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2985
    Cursor newCursor;
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2986
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2987
    if (ISCONNECTED
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2988
     && __isSmallInteger(aShapeNumber)) {
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2989
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2990
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2991
	newCursor = XCreateFontCursor(myDpy, __intVal(aShapeNumber));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2992
	LEAVE_XLIB();
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2993
#ifdef COUNT_RESOURCES
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2994
	if (newCursor)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2995
	    __cnt_cursor++;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2996
#endif
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2997
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2998
	if (newCursor != (Cursor)0) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2999
	    RETURN (__MKEXTERNALADDRESS(newCursor));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3000
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3001
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3002
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3003
    self primitiveFailedOrClosedConnection.
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3004
    ^ nil
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3005
!
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3006
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3007
primCreateCursorSourceFormId:sourceId maskFormId:maskId hotX:hx hotY:hy width:w height:h
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3008
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3009
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3010
    <context: #return>
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3011
%{
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3012
    Cursor newCursor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3013
    XColor fgColor, bgColor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3014
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3015
    if (ISCONNECTED
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3016
     && __isExternalAddress(sourceId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3017
     && __isExternalAddress(maskId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3018
     && __bothSmallInteger(hx, hy)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3019
	fgColor.red = 0;        /* fg is black */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3020
	fgColor.green = 0;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3021
	fgColor.blue = 0;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3022
	bgColor.red = 0xFFFF;   /* bg is white */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3023
	bgColor.green = 0xFFFF;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3024
	bgColor.blue = 0xFFFF;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3025
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3026
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3027
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3028
	newCursor = XCreatePixmapCursor(myDpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3029
				__PixmapVal(sourceId),
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3030
				__PixmapVal(maskId),
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3031
				&fgColor, &bgColor, __intVal(hx), __intVal(hy));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3032
	LEAVE_XLIB();
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3033
#ifdef COUNT_RESOURCES
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3034
	if (newCursor)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3035
	    __cnt_cursor++;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3036
#endif
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3037
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3038
	if (newCursor != (Cursor)0) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3039
	    RETURN (__MKEXTERNALADDRESS(newCursor));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3040
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3041
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3042
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3043
    self primitiveFailedOrClosedConnection.
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3044
    ^ nil
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3045
!
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3046
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3047
shapeNumberFromSymbol:shape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3048
    "given a shape-symbol, return the corresponding cursor-number,
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3049
     or nil if no such standard cursor exists."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3050
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3051
    "/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
  3052
    "/ 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
  3053
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3054
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3055
    (shape == #upLeftArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow)    %} "132" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3056
    (shape == #upRightHand)     ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1)             %} "58" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3057
    (shape == #upDownArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3058
    (shape == #leftRightArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3059
    (shape == #upLimitArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side)          %} "138" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3060
    (shape == #downLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side)       %} "16" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3061
    (shape == #leftLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side)         %} "70" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3062
    (shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side)        %} "96" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3063
    (shape == #text)            ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm)             %} "152" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3064
    (shape == #upRightArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large)       %} "44" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3065
    (shape == #leftHand)        ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2)             %} "60" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3066
    (shape == #questionMark)    ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow)    %} "92" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3067
    (shape == #cross)           ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3068
    (shape == #wait)            ifTrue:[ ^ %{ __MKSMALLINT(XC_watch)             %} "150" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3069
    (shape == #crossHair)       ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross)            %} "130" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3070
    ((shape == #origin)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3071
    or:[shape == #topLeft])     ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle)          %} "144" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3072
    ((shape == #corner)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3073
    or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle)          %} "78" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3074
    (shape == #topRight)        ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle)          %} "148" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3075
    (shape == #bottomLeft)      ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle)          %} "76" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3076
    (shape == #square)          ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox)            %} "40" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3077
    (shape == #fourWay)         ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur)             %} "52" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3078
    (shape == #crossCursor)     ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  3079
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  3080
"/    ('XWorkstation [info]: invalid cursorShape:' , shape printString) infoPrintNL.
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3081
    ^  nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3082
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  3083
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3084
!XWorkstation methodsFor:'drag & drop'!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3085
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3086
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3087
    "drop something in some alien view, using the DND protocol.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3088
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3089
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3090
    |msgType dropColl dropCollSize anyFile anyDir anyText anyOther
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3091
     dropType dropTypeCode strings sz idx val|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3092
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3093
    (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3094
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3095
	"/ 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
  3096
	"/ check for this.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3097
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3098
	dropObjects isCollection ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3099
	    dropColl := Array with:dropObjects
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3100
	] ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3101
	    dropColl := dropObjects
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3102
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3103
	anyFile := anyDir := anyText := anyOther := false.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3104
	dropColl do:[:aDropObject |
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3105
	    aDropObject isFileObject ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3106
		aDropObject theObject isDirectory ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3107
		    anyDir := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3108
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3109
		    anyFile := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3110
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3111
	    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3112
		aDropObject isTextObject ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3113
		    anyText := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3114
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3115
		    anyOther := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3116
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3117
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3118
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3119
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3120
	anyOther ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3121
	    "/ DND does not support this ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3122
	    '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
  3123
	    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3124
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3125
	anyText ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3126
	    (anyFile or:[anyDir]) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3127
		"/ DND does not support mixed types
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3128
		'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
  3129
		^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3130
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3131
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3132
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3133
	dropCollSize := dropColl size.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3134
	anyFile ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3135
	    dropType := #DndFiles.
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3136
	    dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3137
		dropType := #DndFile
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3138
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3139
	] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3140
	    anyDir ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3141
		dropType := #DndFiles.
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3142
		dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3143
		    dropType := #DndDir
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3144
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3145
	    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3146
		anyText ifTrue:[
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3147
		    dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3148
			dropType := #DndText
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3149
		    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3150
			"/ can only drop a single text object
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3151
			'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
  3152
			^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3153
		    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3154
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3155
		    "/ mhmh ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3156
		    'XWorkstation [info]: DND cannot drop this' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3157
		    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3158
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3159
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3160
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3161
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3162
	dropTypeCode := self dndDropTypes indexOf:dropType.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3163
	dropTypeCode == 0 ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3164
	    'XWorkstation [info]: DND cannot drop this' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3165
	    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3166
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3167
	dropTypeCode := dropTypeCode - 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3168
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3169
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3170
	"/ place the selection inTo the DndSelection property
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3171
	"/ of the rootView ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3172
	"/ ... need a single string, with 0-terminated parts.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3173
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3174
	strings := OrderedCollection new.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3175
	sz := 0.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3176
	dropColl do:[:anObject |
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3177
	    |s o|
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3178
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3179
	    o := anObject theObject.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3180
	    anObject isFileObject ifTrue:[
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3181
		o := o pathName
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3182
	    ].
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3183
	    s := o asString.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3184
	    strings add:s.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3185
	    sz := sz + (s size) + 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3186
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3187
	val := String new:sz.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3188
	idx := 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3189
	strings do:[:aString |
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3190
	    |sz|
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3191
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3192
	    sz := aString size.
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3193
	    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
  3194
	    idx := idx + sz.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3195
	    val at:idx put:(Character value:0).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3196
	    idx := idx + 1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3197
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3198
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3199
	self
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3200
	    setProperty:(self atomIDOf:#DndSelection)
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3201
	    type:(self atomIDOf:#STRING) 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3202
	    value:val 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3203
	    for:rootId.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3204
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3205
	^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3206
	    sendClientEvent:msgType 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3207
	    format:32 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3208
	    to:destinationId 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3209
	    data1:dropTypeCode
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3210
	    data2:0
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3211
	    data3:destinationId
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3212
	    data4:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3213
	    data5:nil.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3214
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3215
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3216
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3217
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3218
    "Created: 6.4.1997 / 13:39:37 / cg"
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  3219
    "Modified: 6.4.1997 / 14:30:43 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3220
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3221
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3222
dndDropTypes
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3223
    "return the dropTypes as supported by DND"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3224
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3225
    ^ #( 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3226
	    DndUnknown      "/ 0
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3227
	    DndRawData      "/ 1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3228
	    DndFile         "/ 2
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3229
	    DndFiles        "/ 3
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3230
	    DndText         "/ 4
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3231
	    DndDir          "/ 5
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3232
	    DndLink         "/ 6
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3233
	    DndExe          "/ 7
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3234
       )
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3235
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3236
    "Created: 6.4.1997 / 12:57:56 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3237
    "Modified: 6.4.1997 / 13:38:52 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3238
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3239
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3240
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3241
    "drop something in some alien view.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3242
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3243
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3244
    "/
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3245
    "/ see, if the display supports the DND protocol ...
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3246
    "/
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3247
    (self atomIDOf:#DndProtocol) notNil ifTrue:[
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  3248
	^ self
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  3249
	    dndDrop:aCollectionOfDropObjects 
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  3250
	    inWindowID:destinationId 
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  3251
	    position:destinationPoint 
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  3252
	    rootPosition:rootPoint        
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3253
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3254
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3255
    "/ add more drag&drop protocols here.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3256
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3257
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3258
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3259
    "Modified: 11.4.1997 / 12:44:50 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3260
! !
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3261
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3262
!XWorkstation methodsFor:'drawing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3263
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3264
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
  3265
    "do a bit-blt; copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3266
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3267
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3268
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3269
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3270
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3271
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3272
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3273
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3274
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3275
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3276
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3277
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3278
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3279
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3280
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3281
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3282
     && __bothSmallInteger(dstX, dstY)) {
1848
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3283
	int _sX, _sY, _w, _h, _dX, _dY;
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3284
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3285
	_sX = __intVal(srcX);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3286
	_sY = __intVal(srcY);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3287
	_w = __intVal(w);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3288
	_h = __intVal(h);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3289
	_dX = __intVal(dstX);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3290
	_dY = __intVal(dstY);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3291
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3292
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3293
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3294
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3295
	ENTER_XLIB();
1848
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  3296
	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
  3297
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3298
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3299
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3300
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3301
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3302
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3303
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3304
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3305
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3306
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3307
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
  3308
    "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
  3309
     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
  3310
     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
  3311
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3312
     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
  3313
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3314
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3315
%{  
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3316
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3317
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3318
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3319
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3320
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3321
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3322
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3323
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3324
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3325
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3326
     && __bothSmallInteger(dstX, dstY)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3327
	Display *dpy = myDpy;
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3328
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3329
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3330
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3331
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3332
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3333
	XSetGraphicsExposures(dpy, gc, 0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3334
	XCopyArea(dpy, source, dest, gc,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3335
				__intVal(srcX), __intVal(srcY),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3336
				__intVal(w), __intVal(h),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3337
				__intVal(dstX), __intVal(dstY));
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3338
	XSetGraphicsExposures(dpy, gc, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3339
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3340
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3341
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3342
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3343
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3344
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3345
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3346
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3347
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3348
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3349
copyPlaneFromId: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
  3350
    "do a bit-blt, but only copy the low-bit plane; 
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3351
     copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3352
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3353
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3354
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3355
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3356
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3357
%{  
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3358
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3359
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3360
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3361
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3362
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3363
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3364
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3365
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3366
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3367
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3368
     && __bothSmallInteger(dstX, dstY)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3369
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3370
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3371
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3372
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3373
	XCopyPlane(myDpy, source, dest, gc,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3374
				 __intVal(srcX), __intVal(srcY),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3375
				 __intVal(w), __intVal(h),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3376
				 __intVal(dstX), __intVal(dstY), 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3377
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3378
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3379
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3380
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3381
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3382
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3383
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3384
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3385
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3386
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3387
copyPlaneFromPixmapId: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
  3388
    "do a bit-blt from a pix- or bitmap, but only copy the low-bit plane; 
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3389
     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
  3390
     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
  3391
     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
  3392
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3393
     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
  3394
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3395
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3396
%{  
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3397
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3398
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3399
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3400
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3401
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3402
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3403
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3404
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3405
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3406
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3407
     && __bothSmallInteger(dstX, dstY)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3408
	Display *dpy = myDpy;
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3409
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3410
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3411
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3412
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3413
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3414
	XSetGraphicsExposures(dpy, gc, 0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3415
	XCopyPlane(dpy, source, dest, gc,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3416
				 __intVal(srcX), __intVal(srcY),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3417
				 __intVal(w), __intVal(h),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3418
				 __intVal(dstX), __intVal(dstY), 1);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3419
	XSetGraphicsExposures(dpy, gc, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3420
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3421
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3422
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3423
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3424
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3425
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3426
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3427
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3428
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3429
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  3430
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
  3431
    "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
  3432
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3433
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3434
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3435
%{  
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3436
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3437
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3438
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3439
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3440
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3441
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3442
    if (__isSmallInteger(startAngle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3443
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3444
    else if (__isFloat(startAngle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3445
	f = __floatVal(startAngle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3446
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3447
    } else if (__isShortFloat(startAngle)) {
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3448
	f = __shortFloatVal(startAngle);
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3449
	angle1 = f * 64;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3450
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3451
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3452
    if (__isSmallInteger(angle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3453
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3454
    else if (__isFloat(angle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3455
	f = __floatVal(angle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3456
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3457
    } else if (__isShortFloat(angle)) {
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3458
	f = __shortFloatVal(angle);
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3459
	angle2 = f * 64;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3460
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3461
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3462
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3463
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3464
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3465
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3466
     && __bothSmallInteger(width, height)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3467
	win = __WindowVal(aDrawableId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3468
	gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3469
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3470
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3471
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3472
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3473
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3474
	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
  3475
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3476
	    XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3477
				   w, h, angle1, angle2);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3478
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3479
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3480
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3481
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3482
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3483
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3484
    "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
  3485
     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
  3486
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3487
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3488
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3489
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3490
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3491
    "draw a line. If the coordinates are not integers, an error is triggered." 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3492
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3493
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3494
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3495
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3496
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3497
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3498
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3499
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3500
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3501
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3502
     && __bothSmallInteger(x0, y0)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3503
     && __bothSmallInteger(x1, y1)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3504
	Display *dpy = myDpy;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3505
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3506
	win = __WindowVal(aDrawableId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3507
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3508
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3509
	if ((x0 == x1) && (y0 == y1)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3510
	    XDrawPoint(dpy, win, gc, __intVal(x0), __intVal(y0));
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3511
	} else {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3512
	    XDrawLine(dpy, win, gc, __intVal(x0), __intVal(y0),
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3513
				    __intVal(x1), __intVal(y1));
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3514
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3515
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3516
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3517
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3518
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3519
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3520
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3521
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3522
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3523
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
  3524
    "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
  3525
     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
  3526
    "
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3527
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3528
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3529
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3530
    |noY|
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3531
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3532
    (noY := yValues size) < 2 ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3533
	^ self
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3534
    ].
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3535
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3536
%{
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3537
    OBJ      yA, t;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3538
    int      i, num;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3539
    float    y, x, sY, tY, step;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3540
    GC       gc;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3541
    XPoint * points;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3542
    XPoint   qPoints[200];
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3543
    int      mustFree = 0;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3544
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3545
    Window win;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3546
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3547
    if (ISCONNECTED
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3548
     && __isExternalAddress(aGCId)
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3549
     && __isExternalAddress(aDrawableId) ) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3550
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3551
	win = __WindowVal(aDrawableId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3552
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3553
	if( __isSmallInteger(scaleY) ) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3554
	    sY = (float) __intVal( scaleY );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3555
	else if (__isFloat(scaleY)) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3556
	    sY = __floatVal( scaleY );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3557
	else if (__isShortFloat(scaleY)) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3558
	    sY = __shortFloatVal( scaleY );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3559
	else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3560
	    t = __SSEND0(scaleY, @symbol(asFloat), 0);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3561
	    if (! __isFloat(t)) goto fail;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3562
	    sY = __floatVal( t );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3563
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3564
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3565
	if( __isSmallInteger(transY) ) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3566
	    tY = (float) __intVal( transY );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3567
	else if (__isFloat(transY)) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3568
	    tY = __floatVal( transY );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3569
	else if (__isShortFloat(transY)) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3570
	    tY = __shortFloatVal( transY );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3571
	else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3572
	    t = __SSEND0(transY, @symbol(asFloat), 0);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3573
	    if (! __isFloat(t)) goto fail;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3574
	    tY = __floatVal( t );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3575
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3576
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3577
	if( __isSmallInteger(startX) ) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3578
	    x = (float) __intVal( startX );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3579
	else if (__isFloat(startX)) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3580
	    x = __floatVal( startX );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3581
	else if (__isShortFloat(startX)) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3582
	    x = __shortFloatVal( startX );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3583
	else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3584
	    t = __SSEND0(startX, @symbol(asFloat), 0);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3585
	    if (! __isFloat(t)) goto fail;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3586
	    x = __floatVal( t );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3587
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3588
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3589
	if( __isSmallInteger(stepX) ) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3590
	    step = (float) __intVal( stepX );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3591
	else if (__isFloat(stepX)) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3592
	    step = __floatVal( stepX );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3593
	else if (__isShortFloat(stepX)) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3594
	    step = __shortFloatVal( stepX );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3595
	else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3596
	    t = __SSEND0(stepX, @symbol(asFloat), 0);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3597
	    if (! __isFloat(t)) goto fail;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3598
	    step = __floatVal( t );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3599
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3600
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3601
	num = __intVal( noY );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3602
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3603
	if( num > 200 ) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3604
	    if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3605
		goto fail;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3606
	    mustFree = 1;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3607
	} else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3608
	    points = qPoints;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3609
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3610
	for( i = 0; i < num; ++i ) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3611
	    yA  = __AT_(yValues, __MKSMALLINT(i+1) );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3612
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3613
	    if( __isFloat(yA) )
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3614
		y = __floatVal( yA );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3615
	    else if( __isSmallInteger(yA) )
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3616
		y = (float) __intVal( yA );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3617
	    else if( __isShortFloat( yA) )
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3618
		y = __shortFloatVal( yA );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3619
	    else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3620
		t = __SSEND0(yA, @symbol(asFloat), 0);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3621
		if (! __isFloat(t)) goto fail;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3622
		y = __floatVal( t );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3623
	    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3624
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3625
	    points[i].x = (int) (x + 0.5);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3626
	    points[i].y = (int) ((y * sY) + tY + 0.5);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3627
	    x = x + step;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3628
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3629
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3630
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3631
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3632
	LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3633
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3634
	if( mustFree ) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3635
	    free( points );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3636
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3637
	RETURN ( self );
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3638
    }
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3639
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3640
fail:
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3641
    if( mustFree )
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3642
	free( points );
3229
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3643
%}.
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3644
    ^ 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
  3645
2146
1c13fdc62a9f displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  3646
    "Modified: / 13.6.1998 / 13:51:39 / cg"
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3647
!
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3648
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3649
displayPointX:x y:y in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3650
    "draw a point. If x/y are not integers, an error is triggered." 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3651
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3652
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3653
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3654
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3655
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3656
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3657
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3658
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3659
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3660
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3661
     && __bothSmallInteger(x, y)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3662
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3663
	win = __WindowVal(aDrawableId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3664
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3665
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3666
	XDrawPoint(myDpy, win, gc, __intVal(x), __intVal(y));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3667
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3668
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3669
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3670
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3671
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3672
    "badGC, badDrawable or x/y not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3673
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3674
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3675
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3676
displayPolygon:aPolygon in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3677
    "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
  3678
     define the polygon.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3679
     If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3680
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3681
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3682
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3683
    |numberOfPoints newPoints|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3684
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3685
    numberOfPoints := aPolygon size.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3686
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3687
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3688
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3689
    OBJ point, x, y;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3690
    int i, num;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3691
    XPoint *points;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3692
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3693
    int mustFree = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3694
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3695
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3696
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3697
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3698
     && __isSmallInteger(numberOfPoints)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3699
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3700
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3701
	num = __intVal(numberOfPoints);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3702
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3703
	 * avoid a (slow) malloc, if the number of points is small
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3704
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3705
	if (num > 100) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3706
	    points = (XPoint *)malloc(sizeof(XPoint) * num);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3707
	    if (! points) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3708
	    mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3709
	} else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3710
	    points = qPoints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3711
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3712
	for (i=0; i<num; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3713
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3714
	    if (! __isPoint(point)) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3715
	    x = _point_X(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3716
	    y = _point_Y(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3717
	    if (! __bothSmallInteger(x, y))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3718
		goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3719
	    points[i].x = __intVal(x);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3720
	    points[i].y = __intVal(y);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3721
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3722
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3723
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3724
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3725
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3726
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3727
	if (mustFree)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3728
	    free(points);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3729
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3730
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3731
fail: ;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3732
    if (mustFree)
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3733
	free(points);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3734
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3735
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3736
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3737
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3738
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3739
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3740
    "draw a rectangle. If the coordinates are not integers, an error is triggered." 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3741
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3742
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3743
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3744
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3745
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3746
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3747
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3748
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3749
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3750
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3751
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3752
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3753
     && __bothSmallInteger(width, height)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3754
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3755
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3756
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3757
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3758
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3759
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3760
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3761
	if ((w >= 0) && (h >= 0)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3762
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3763
	    XDrawRectangle(myDpy, win, gc, __intVal(x), __intVal(y), w, h);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3764
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3765
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3766
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3767
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3768
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3769
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3770
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3771
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3772
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3773
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3774
    "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
  3775
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3776
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3777
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3778
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3779
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3780
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3781
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3782
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3783
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3784
    OBJ cls;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3785
    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
  3786
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3787
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3788
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3789
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3790
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3791
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3792
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3793
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3794
     && __bothSmallInteger(index1, index2)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3795
     && __bothSmallInteger(x, y)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3796
	int lMax = __intVal(@global(XWorkstation:MaxStringLength));
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3797
	Display *dpy = myDpy;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3798
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3799
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3800
	cls = __qClass(aString);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3801
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3802
	i1 = __intVal(index1) - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3803
	if (i1 >= 0) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3804
	    i2 = __intVal(index2) - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3805
	    if (i2 < i1) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3806
		RETURN (self);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3807
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3808
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3809
	    cp = (char *) __stringVal(aString);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3810
	    l = i2 - i1 + 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3811
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3812
	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
2011
47e72d42226b eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
  3813
		n = __stringSize(aString);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3814
		if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3815
		    cp += i1;
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3816
		    if (l > lMax) l = lMax;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3817
		    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3818
		    if (opaque == true)
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3819
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3820
		    else
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3821
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3822
		    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3823
		    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3824
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3825
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3826
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3827
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3828
	    cp += nInstBytes;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3829
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3830
	    if (__isBytes(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3831
		n = __byteArraySize(aString) - nInstBytes - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3832
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3833
		if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3834
		    cp += i1;
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3835
		    if (l > lMax) l = lMax;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3836
		    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3837
		    if (opaque == true)
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3838
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3839
		    else
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3840
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3841
		    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3842
		    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3843
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3844
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3845
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3846
	    /* TWOBYTESTRINGS */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3847
	    if (__isWords(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3848
		n = (__byteArraySize(aString) - nInstBytes) / 2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3849
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3850
		if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3851
		    union {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3852
			char b[2];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3853
			unsigned short s;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3854
		    } u;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3855
		    int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3856
		    XChar2b *cp2 = (XChar2b *)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3857
		    int mustFree = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3858
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3859
		    cp += (i1 * 2);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3860
		    if (l > lMax) l = lMax;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3861
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3862
		    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3863
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3864
		     * X expects them MSB first
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3865
		     * convert as required
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3866
		     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3867
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3868
		    u.s = 0x1234;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3869
		    if (u.b[0] != 0x12) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3870
			if (l <= NLOCALBUFFER) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3871
			    cp2 = xlatebuffer;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3872
			} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3873
			    cp2 = (XChar2b *)(malloc(l * 2));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3874
			    mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3875
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3876
			for (i=0; i<l; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3877
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3878
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3879
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3880
			cp = (char *) cp2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3881
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3882
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3883
		    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3884
		    if (opaque == true)
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3885
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3886
		    else
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3887
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3888
		    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3889
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3890
		    if (mustFree) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3891
			free(cp2);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3892
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3893
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3894
		    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3895
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3896
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3897
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3898
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3899
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3900
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3901
    "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
  3902
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3903
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3904
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3905
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3906
    "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
  3907
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3908
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3909
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3910
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3911
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3912
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3913
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3914
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3915
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3916
    int n;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3917
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3918
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3919
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3920
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3921
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3922
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3923
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3924
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3925
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3926
     && __bothSmallInteger(x, y)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3927
	int lMax = __intVal(@global(XWorkstation:MaxStringLength));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3928
	Display *dpy = myDpy;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3929
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3930
	win = __WindowVal(aDrawableId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3931
	cls = __qClass(aString);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3932
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3933
	cp = (char *) __stringVal(aString);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3934
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3935
	if ((cls == @global(String)) || (cls == @global(Symbol))) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3936
	    n = __stringSize(aString);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3937
	    if (n > lMax) n = lMax;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3938
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3939
	    if (opaque == true)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3940
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3941
	    else
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3942
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3943
	    LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3944
	    RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3945
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3946
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3947
	nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3948
	cp += nInstBytes;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3949
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3950
	if (__isBytes(aString)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3951
	    n = __byteArraySize(aString) - nInstBytes - 1;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3952
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3953
	    if (n > lMax) n = lMax;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3954
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3955
	    if (opaque == true)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3956
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3957
	    else
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3958
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3959
	    LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3960
	    RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3961
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3962
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3963
	/* TWOBYTESTRINGS */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3964
	if (__isWords(aString)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3965
	    union {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3966
		char b[2];
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3967
		unsigned short s;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3968
	    } u;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3969
	    int i;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3970
	    XChar2b *cp2;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3971
	    int mustFree = 0;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3972
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3973
	    n = (__byteArraySize(aString) - nInstBytes) / 2;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3974
	    if (n > lMax) n = lMax;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3975
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3976
	    /*
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3977
	     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3978
	     * X expects them MSB first
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3979
	     * convert as required
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3980
	     */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3981
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3982
	    u.s = 0x1234;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3983
	    if (u.b[0] != 0x12) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3984
		if (n <= NLOCALBUFFER) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3985
		    cp2 = xlatebuffer;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3986
		} else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3987
		    cp2 = (XChar2b *)(malloc(n * 2));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3988
		    mustFree = 1;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3989
		}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3990
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3991
		for (i=0; i<n; i++) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3992
		    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3993
		    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3994
		}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3995
		cp = (char *) cp2;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3996
	    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3997
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3998
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3999
	    if (opaque == true)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4000
		XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4001
	    else
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4002
		XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4003
	    LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4004
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4005
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4006
	    if (mustFree) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4007
		free(cp2);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4008
	    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4009
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4010
	    RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4011
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4012
    }
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4013
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4014
%}.
3229
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4015
    ^ 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
  4016
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4017
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4018
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4019
	width:imageWidth height:imageHeight 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4020
	x:srcx y:srcy
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4021
	into:aDrawableId 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4022
	x:dstx y:dsty 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4023
	width:w height:h 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4024
	with:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4025
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4026
    "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
  4027
     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
  4028
     Individual source pixels have bitsPerPixel bits, allowing to draw
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4029
     depth and pixel-units to be different.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4030
     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
  4031
     depth - otherwise, primitive failure will be signalled.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4032
     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
  4033
     colors are allocated - otherwise the colors may be wrong."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4034
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4035
    |fmt padding bits wantedPadding|
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4036
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4037
    padding := givenPadding.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4038
    bits := givenBits.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4039
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4040
    "/ 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
  4041
    "/ 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
  4042
    "/ 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
  4043
    "/ care for that.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4044
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4045
    ((imageDepth == 4) and:[depth == 4]) ifTrue:[
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4046
	fmt := self supportedImageFormatForDepth:4.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4047
	fmt isNil ifTrue:[
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4048
	    self primitiveFailed. "/ cannot represent this image
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4049
	    ^ nil
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4050
	].
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4051
	wantedPadding := fmt at:#padding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4052
	wantedPadding > givenPadding ifTrue:[
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4053
	    bits := self 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4054
			    repadBits:givenBits 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4055
			    width:imageWidth 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4056
			    height:imageHeight
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4057
			    depth:imageDepth
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4058
			    from:givenPadding
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4059
			    to:wantedPadding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4060
	    padding := wantedPadding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4061
	]
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4062
    ].
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
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
     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
  4066
     an unlimited stack, and thus cannot send primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4067
    "
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  4068
    (self 
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4069
	primDrawBits:bits 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4070
	bitsPerPixel:bitsPerPixel 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4071
	depth:imageDepth 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4072
	padding:padding
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4073
	width:imageWidth height:imageHeight 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4074
	x:srcx y:srcy
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4075
	into:aDrawableId 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4076
	x:dstx y:dsty 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4077
	width:w height:h 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4078
	with:aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4079
    ifFalse:[
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4080
	"
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4081
	 also happens, if a segmentation violation occurs in the 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4082
	 XPutImage ...
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  4083
	"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4084
	self primitiveFailedOrClosedConnection
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
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  4088
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
  4089
	       in:aDrawableId with:aGCId
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  4090
    "fill an arc. If any coordinate is not integer, an error is triggered.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  4091
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4092
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4093
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4094
%{  
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4095
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4096
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4097
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4098
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4099
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4100
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4101
    if (__isSmallInteger(startAngle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4102
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4103
    else if (__isFloat(startAngle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4104
	f = __floatVal(startAngle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4105
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4106
    } else if (__isShortFloat(startAngle)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4107
	f = __shortFloatVal(startAngle);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4108
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4109
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4110
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4111
    if (__isSmallInteger(angle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4112
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4113
    else if (__isFloat(angle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4114
	f = __floatVal(angle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4115
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4116
    } else if (__isShortFloat(angle)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4117
	f = __shortFloatVal(angle);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4118
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4119
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4120
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4121
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4122
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4123
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4124
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4125
     && __bothSmallInteger(width, height)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4126
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4127
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4128
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4129
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4130
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4131
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4132
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4133
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  4134
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4135
	    XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4136
				   w, h, angle1, angle2);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  4137
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4138
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4139
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4140
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4141
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4142
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4143
    "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
  4144
     or non float angle(s)"
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4145
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4146
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4147
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4148
48194c26a46c Initial revision
claus
parents:
diff changeset
  4149
fillPolygon:aPolygon in:aDrawableId with:aGCId
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4150
    "fill a polygon given by its points. 
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4151
     If any coordinate is not integer, an error is triggered."
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4152
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4153
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4154
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4155
    |numberOfPoints|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4156
48194c26a46c Initial revision
claus
parents:
diff changeset
  4157
    numberOfPoints := aPolygon size.
48194c26a46c Initial revision
claus
parents:
diff changeset
  4158
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4159
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4160
    Window win;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4161
    OBJ point, x, y;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4162
    int i, num;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4163
    XPoint *points;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4164
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4165
    int mustFree = 0;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4166
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4167
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4168
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4169
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4170
     && __isSmallInteger(numberOfPoints)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4171
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4172
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4173
	num = __intVal(numberOfPoints);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4174
	if (num < 3) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4175
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4176
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4177
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4178
	 * avoid (slow) malloc, if not many points
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4179
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4180
	if (num > 100) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4181
	    points = (XPoint *) malloc(sizeof(XPoint) * num);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4182
	    if (! points) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4183
	    mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4184
	} else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4185
	    points = qPoints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4186
	for (i=0; i<num; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4187
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4188
	    if (! __isPoint(point)) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4189
	    x = _point_X(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4190
	    y = _point_Y(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4191
	    if (! __bothSmallInteger(x, y))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4192
		goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4193
	    points[i].x = __intVal(x);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4194
	    points[i].y = __intVal(y);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4195
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  4196
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4197
	XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  4198
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4199
	if (mustFree)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4200
	    free(points);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4201
	RETURN ( self );
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4202
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4203
fail: ;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4204
	if (mustFree)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4205
	    free(points);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4206
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4207
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4208
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4209
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4210
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4211
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4212
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
  4213
    "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
  4214
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4215
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4216
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4217
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4218
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4219
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4220
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4221
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4222
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4223
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4224
     && __bothSmallInteger(width, height)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4225
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4226
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4227
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4228
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4229
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4230
	if ((w >= 0) && (h >= 0)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  4231
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4232
	    XFillRectangle(myDpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4233
			   __DrawableVal(aDrawableId), __GCVal(aGCId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4234
			   __intVal(x), __intVal(y), w, h);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  4235
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4236
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4237
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4238
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4239
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4240
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4241
    self primitiveFailedOrClosedConnection
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4242
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4243
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  4244
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:bitPadding
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4245
			      width:imageWidth height:imageHeight 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4246
				  x:srcx y:srcy
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4247
			       into:aDrawableId 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4248
				  x:dstx y:dsty 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4249
			      width:w height:h 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4250
			       with:aGCId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4251
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4252
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4253
132
claus
parents: 129
diff changeset
  4254
    "since XPutImage may allocate huge amount of stack space 
claus
parents: 129
diff changeset
  4255
     (some implementations use alloca), this must run with unlimited stack."
claus
parents: 129
diff changeset
  4256
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4257
%{  /* UNLIMITEDSTACK */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4258
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4259
    /*
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4260
     * need unlimited stack, since some Xlibs do a huge alloca in
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4261
     * XPutImage
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4262
     */
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4263
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4264
    Window win;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4265
    XImage image;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4266
    int imgWdth;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4267
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4268
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4269
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4270
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4271
     && __bothSmallInteger(srcx, srcy)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4272
     && __bothSmallInteger(dstx, dsty)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4273
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4274
     && __bothSmallInteger(imageWidth, imageHeight)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4275
     && __bothSmallInteger(imageDepth, bitsPerPixel)
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  4276
     && __isSmallInteger(bitPadding)
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4277
     && __isByteArray(imageBits)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4278
	Display *dpy = myDpy;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4279
	int pad = __intVal(bitPadding);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4280
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4281
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4282
	win = __WindowVal(aDrawableId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4283
	if (! gc || !win) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4284
	    goto fail;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4285
#ifdef ARGDEBUG
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4286
	printf("args ok\n");
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
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4289
	image.width = imgWdth = __intVal(imageWidth);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4290
	image.height = __intVal(imageHeight);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4291
	image.xoffset = 0;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4292
	image.format = ZPixmap;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4293
	image.byte_order = MSBFirst;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4294
	image.bitmap_unit = 8;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4295
	image.bitmap_bit_order = MSBFirst;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4296
	image.bitmap_pad = pad;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4297
	image.depth = __intVal(imageDepth);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4298
	image.bits_per_pixel = __intVal(bitsPerPixel);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4299
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4300
	/*
2021
67626c0fb1eb fixed image padding bug
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  4301
	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
  4302
	*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4303
	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
  4304
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4305
	switch (image.bits_per_pixel) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4306
	    case 1:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4307
	    case 2:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4308
	    case 4:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4309
	    case 8:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4310
	    case 16:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4311
	    case 24:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4312
	    case 32:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4313
		break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4314
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4315
	    default:
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4316
#ifdef ARGDEBUG
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4317
		printf("bits_per_pixel=%d\n",image.bits_per_pixel);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4318
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4319
		goto fail;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4320
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4321
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4322
	image.red_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4323
	image.green_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4324
	image.blue_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4325
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4326
	/* ENTER_XLIB(); */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4327
	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
  4328
					__intVal(dstx), __intVal(dsty),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4329
					__intVal(w), __intVal(h));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4330
	/* LEAVE_XLIB(); */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4331
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4332
	RETURN ( true );
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4333
    }
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4334
#ifdef ARGDEBUG
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4335
    if (!! __isExternalAddress(aGCId)) printf("GC\n");
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4336
    if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n");
193
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4337
    if (!! __isSmallInteger(srcx)) printf("srcx\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4338
    if (!! __isSmallInteger(srcy)) printf("srcy\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4339
    if (!! __isSmallInteger(dstx)) printf("dstx\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4340
    if (!! __isSmallInteger(dsty)) printf("dsty\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4341
    if (!! __isSmallInteger(w)) printf("w\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4342
    if (!! __isSmallInteger(h)) printf("h\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4343
    if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4344
    if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4345
    if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4346
    if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4347
    if (!! __isByteArray(imageBits)) printf("imageBits\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4348
#endif
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4349
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4350
fail: ;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4351
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  4352
.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4353
    ^ false
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4354
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  4355
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4356
!XWorkstation methodsFor:'event forwarding'!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4357
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4358
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
  4359
    "forward a buttonMotion event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4360
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4361
    self buttonMotion:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4362
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4363
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4364
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
  4365
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4366
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4367
    |logicalButton nextMultiClickTime|
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4368
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4369
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4370
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4371
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4372
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4373
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4374
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4375
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4376
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4377
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4378
    logicalButton := buttonTranslation at:button ifAbsent:button.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  4379
3312
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  4380
    "/ special for HPs mouse-wheel implementation
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  4381
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4382
      self mouseWheelMotion:0 x:x y:y amount:(logicalButton == #wheelFwd ifTrue:[10] ifFalse:[-10]) deltaTime:10 view:view.
3312
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  4383
      ^ self
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  4384
    ].
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  4385
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4386
    buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
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
    multiClickTimeDelta notNil ifTrue:[
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4389
        nextMultiClickTime := time + multiClickTimeDelta.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4390
        multiClickTime notNil ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4391
            time < multiClickTime ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4392
                multiClickTime := nextMultiClickTime.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4393
                self buttonMultiPress:logicalButton x:x y:y view:view.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4394
                ^ self.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4395
            ]
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4396
        ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4397
        multiClickTime := nextMultiClickTime.
3230
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
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4400
    self buttonPress:logicalButton x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4401
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4402
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4403
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
  4404
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4405
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4406
    |logicalButton|
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4407
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4408
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4409
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4410
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4411
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4412
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4413
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4414
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4415
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4416
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4417
    logicalButton := buttonTranslation at:button ifAbsent:button.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4418
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4419
    "/ special for HPs mouse-wheel implementation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4420
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4421
      ^ self
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4422
    ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4423
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4424
    buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4425
    self buttonRelease:logicalButton x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4426
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4427
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4428
circulateNotify:aView place:aSymbol
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  4429
    "sent, when the stacking order changes.
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  4430
     ignored for now."
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  4431
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  4432
!
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  4433
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4434
circulateRequest:aView place:aSymbol
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  4435
    "sent, when the stacking order is about to change.
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  4436
     ignored for now."
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  4437
!
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  4438
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4439
clientMessage:targetView type:typeAtom format:format data:data
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4440
    |sensor|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4441
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4442
    "/ DND drag&drop protocol
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4443
    typeAtom == (self atomIDOf:#DndProtocol) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4444
	format == 32 ifTrue:[
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4445
	    self dndMessage:nil data:data view:targetView.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4446
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4447
	]
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4448
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4449
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4450
    (sensor := targetView sensor) notNil ifTrue:[
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4451
	sensor clientMessage:typeAtom format:format eventData:data view:targetView
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4452
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4453
	"
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4454
	 not posted, if there is no sensor ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4455
	"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4456
    ]
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4457
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4458
    "Created: 4.4.1997 / 17:49:26 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4459
    "Modified: 4.4.1997 / 18:00:18 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4460
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4461
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4462
colorMapNotify:aView state:aBoolean
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4463
    "sent, when another colormap is installed.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4464
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4465
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4466
    aView isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4467
	"/ event arrived, after I destroyed it myself
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4468
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4469
    ].
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4470
    aView colorMapChange
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4471
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4472
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4473
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
  4474
    "forward a size-change event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4475
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4476
    self configureX:x y:y width:w height:h view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4477
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4478
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4479
configureRequest:view x:x y:y width:w height:h above:above detail:detail
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4480
    "ignored for now"
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4481
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4482
    "/ view configureRequest
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4483
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4484
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4485
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4486
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4487
dndMessage:event data:data view:targetView
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4488
    "handle a DND drag&drop protocol message"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4489
1553
279d9566bd83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1552
diff changeset
  4490
    |sensor dropType dropValue names i1 i2 t|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4491
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4492
    dropType := data doubleWordAt:1.
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4493
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4494
    "/ see def's in DragAndDropTypes.h
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  4495
    dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4496
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4497
    self 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4498
	getProperty:(self atomIDOf:#DndSelection)
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4499
	from:rootId
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4500
	into:[:type :value |
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4501
	    t := type.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4502
	    dropValue := value
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4503
	].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4504
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4505
    "/ preconvert into a collection
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4506
    "/ of fileNames, string or byteArray
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4507
    "/ Notice: we do not yet convert into dropObjects
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4508
    "/ here, to allow arbitrary data to be handled by
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4509
    "/ redefined dropMessage methods in applications.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4510
    "/ Conversion is done for some well known types
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4511
    "/ in the default dropMessage handling of SimpleView.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4512
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4513
    dropType == #DndFiles ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4514
	"/ actually, a list of fileNames
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4515
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4516
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4517
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4518
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4519
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4520
	names := OrderedCollection new.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4521
	i1 := 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4522
	[i1 ~~ 0] whileTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4523
	    i2 := dropValue indexOf:(Character value:0) startingAt:i1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4524
	    i2 ~~ 0 ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4525
		names add:(dropValue copyFrom:i1 to:(i2-1)).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4526
		i1 := i2 + 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4527
	    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4528
		i1 := i2
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4529
	    ].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4530
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4531
	dropValue := names.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4532
	dropValue := dropValue collect:[:nm | nm asFilename].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4533
	dropType := #files.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4534
    ] ifFalse:[ (dropType == #DndFile) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4535
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4536
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4537
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4538
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4539
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4540
	dropValue := dropValue asFilename.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4541
	dropType := #file.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4542
    ] ifFalse:[ (dropType == #DndDir) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4543
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4544
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4545
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4546
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4547
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4548
	dropValue := dropValue asFilename.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4549
	dropType := #directory.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4550
    ] ifFalse:[ (dropType == #DndText) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4551
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4552
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4553
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4554
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4555
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4556
	dropValue := dropValue.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4557
	dropType := #text.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4558
    ] ifFalse:[ (dropType == #DndExe) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4559
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4560
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4561
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4562
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4563
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4564
	dropValue := dropValue.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4565
	dropType := #executable.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4566
    ] ifFalse:[ (dropType == #DndLink) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4567
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4568
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4569
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4570
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4571
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4572
	dropValue := dropValue.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4573
	dropType := #link.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4574
    ] ifFalse:[ (dropType == #DndRawData) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4575
	dropValue := dropValue.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4576
	dropType := #rawData.
1552
969fd0309d2a more drop support
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
  4577
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4578
	'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4579
	'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR. 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4580
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4581
	dropValue := dropValue.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4582
	dropType := #unknown.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4583
    ]]]]]]].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4584
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4585
    (sensor := targetView sensor) notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4586
	sensor dropMessage:dropType data:dropValue view:targetView
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4587
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4588
	"
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4589
	 not posted, if there is no sensor ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4590
	"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4591
    ]
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4592
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4593
    "Created: 4.4.1997 / 17:59:37 / cg"
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4594
    "Modified: 6.4.1997 / 14:50:44 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4595
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4596
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4597
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
  4598
    "forward an expose event for some view"
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
    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
  4601
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4602
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4603
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4604
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4605
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4606
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4607
focusIn:view mode:mode detail:detail
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4608
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4609
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4610
    self focusInView:view
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
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4613
focusOut:view mode:mode detail:detail
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4614
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4615
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4616
    self focusOutView:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4617
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4618
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4619
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
  4620
    "forward a graphics-expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4621
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4622
    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
  4623
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
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4626
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4627
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4628
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4629
gravityNotify:aView x:x y:y
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4630
    "ignored for now"
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4631
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4632
    "/ aView gravityNotify
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4633
!
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4634
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4635
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
  4636
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4637
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4638
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4639
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4640
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4641
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4642
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4643
    key isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4644
	"/ happens sometimes on some systems
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4645
	"/ (alt-graph on sun has no keysym) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4646
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4647
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4648
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4649
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4650
    self keyPress:key x:x y:y view:view.
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
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4653
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4654
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4655
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
  4656
    "forward a key-release event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4657
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4658
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4659
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4660
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4661
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4662
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4663
    key isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4664
	"/ happens sometimes on some systems
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4665
	"/ (alt-graph on sun has no keysym) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4666
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4667
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4668
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4669
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4670
    self keyRelease:key x:x y:y view:view.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4671
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4672
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4673
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4674
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4675
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4676
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4677
keymapNotify:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4678
    "ignore for now"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4679
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4680
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4681
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4682
mapRequest:aView
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4683
    "ignored for now"
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4684
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4685
    "/ aView mapRequest
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4686
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4687
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4688
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4689
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4690
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4691
mappingNotify:view request:what event:eB
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4692
    "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4693
     Tell xlib about the fact."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4694
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4695
    (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4696
	self refreshKeyboardMapping:eB.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4697
	"Maybe some of our modifiers have been changed"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4698
	self initializeModifierMappings.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4699
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4700
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4701
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4702
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4703
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
  4704
    "forward a pointer enter event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4705
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4706
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4707
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4708
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4709
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4710
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4711
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4712
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4713
    self pointerEnter:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4714
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4715
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4716
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
  4717
    "forward a pointer leave event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4718
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4719
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4720
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4721
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4722
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4723
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4724
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4725
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4726
    self pointerLeave:state view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4727
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4728
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4729
propertyChange:aView atom:atom state:aSymbol time:time
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4730
    "sent when an X property changes.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4731
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4732
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4733
    aView isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4734
	"/ event arrived, after I destroyed it myself
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4735
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4736
    ].
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4737
    aView propertyChange
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4738
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4739
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4740
reparentedView:aView
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4741
    "ignored for now"
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4742
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4743
    "/ aView reparented
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4744
!
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4745
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4746
resizeRequest:aView width:width height:height
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4747
    "ignored for now"
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4748
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4749
    "/ aView resizeRequest
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4750
!
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4751
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4752
selectionClear:aView atom:selectionID time:time
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4753
    "sent when another X-client has created a selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4754
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4755
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4756
    "/
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4757
    "/ workaround a bug in olvwm: it clears selections
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4758
    "/ on window raise.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4759
    "/ In this case, keep my last own selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4760
    "/
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4761
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4762
    self setLastCopyBuffer:(self getCopyBuffer).
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4763
    self setCopyBuffer:nil
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4764
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4765
    "/ noone is interested in that ...
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4766
    "/ aView selectionClear:selectionID
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4767
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4768
!
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
selectionNotify:aView selection:selectionID  target:targetID property:propertyID requestor:requestorID time:time
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4771
    "sent when the server returns an answer from a request for a selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4772
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4773
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4774
    |s sensor|
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4775
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4776
    propertyID == 0 ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4777
	"invalid olvwm behavior"
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4778
	s := self getLastCopyBuffer
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4779
    ] ifFalse:[
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4780
	targetID == (self atomIDOf:#STRING) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4781
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4782
	     a returned string
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4783
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4784
	    s := self getTextProperty:propertyID from:requestorID.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4785
	    s notNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4786
		(s endsWith:Character cr) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4787
		    s := s asStringCollection copyWith:''
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4788
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4789
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4790
	] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4791
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4792
	     a returned object
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4793
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4794
	    s := self getObjectProperty:propertyID from:requestorID.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4795
	].
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4796
    ].
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4797
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4798
    s notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4799
	(sensor := aView sensor) notNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4800
	    sensor pasteFromClipBoard:s view:aView
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4801
	] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4802
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4803
	     if there is no sensor ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4804
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4805
	    aView pasteFromClipBoard:s
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4806
	]
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4807
    ]
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4808
!
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4809
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4810
selectionRequest:aView requestor:requestorID selection:selectionID target:targetID property:propertyID time:time
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4811
    "sent by some other X-client to ask for the selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4812
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4813
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4814
    |o s stream stringAtom|
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4815
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4816
"/targetID printCR.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4817
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4818
    targetID == (self atomIDOf:#LENGTH) ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4819
	"/
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4820
	"/ the other one wants to know the size of our selection ...
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4821
	"/
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4822
	s := self selectionAsString.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4823
	self
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4824
	    setLengthProperty:propertyID 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4825
	    value:s size 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4826
	    for:requestorID.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4827
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4828
	self
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4829
	    sendSelectionNotifySelection:selectionID
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4830
	    property:propertyID
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4831
	    target:targetID
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4832
	    time:time
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4833
	    from:aView id
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4834
	    to:requestorID.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4835
	^ self
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4836
    ].
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4837
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4838
    stringAtom := self atomIDOf:#STRING.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4839
    (targetID == stringAtom or:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4840
     targetID == (self atomIDOf:#'COMPOUND_TEXT')]) ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4841
	"/
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4842
	"/ the other view wants the selection as string
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4843
	"/
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4844
	s := self selectionAsString.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4845
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4846
	self
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4847
	    sendSelection:s 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4848
	    selection:primaryAtom
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4849
	    property:propertyID 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4850
	    target:stringAtom           "/ targetID, once I can provide compountText as well
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4851
	    time:time
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4852
	    from:requestorID
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4853
	    to:requestorID.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4854
	^ self
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4855
    ].
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4856
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4857
"/    (targetID == (self atomIDOf:#'TARGETS')) ifTrue:[
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4858
"/"/ TODO: implement this to avoid netscape paste-delay.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4859
"/"/
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4860
"/        ^ self
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4861
"/    ].
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4862
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4863
    (targetID == (self atomIDOf:#'ST_OBJECT')) ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4864
	"/
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4865
	"/ send the selection in binaryStore format
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4866
	"/ (assuming, that the other view knows how to handle it)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4867
	"/
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4868
	o := self getCopyBuffer.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4869
	stream := WriteStream on:(ByteArray new:200).
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4870
	o storeBinaryOn:stream.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4871
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4872
	^ self
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4873
	    sendSelection:(stream contents) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4874
	    selection:primaryAtom
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4875
	    property:propertyID 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4876
	    target:targetID 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4877
	    time:time
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4878
	    from:aView id 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4879
	    to:requestorID
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4880
    ].
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4881
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4882
!
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4883
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4884
visibilityNotify:aView state:how
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4885
    aView notNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4886
	aView visibilityChange:how
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4887
    ]
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4888
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4889
! !
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4890
86
032006651226 *** empty log message ***
claus
parents: 83
diff changeset
  4891
!XWorkstation methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4892
3233
b50a5e6ea9e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4893
decomposeEventBuffer:aByteArray into:eventArr
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4894
    "extracet event fields and place them into an array:
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4895
     the fields are:
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4896
	1:      windowID
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4897
	2:      eventType-ID
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4898
	3:      eventTypeSymbol
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4899
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4900
	4..     args
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4901
    "
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4902
%{ 
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4903
#   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4904
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4905
    OBJ eB;
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4906
    XEvent *ev;
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4907
    int ev_x, ev_y;
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4908
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4909
#   define ae ((XAnyEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4910
#   define ee ((XExposeEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4911
#   define ke ((XKeyPressedEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4912
#   define be ((XButtonPressedEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4913
#   define ce ((XConfigureEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4914
#   define cr ((XConfigureRequestEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4915
#   define me ((XMotionEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4916
#   define ele ((XCrossingEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4917
#   define de ((XDestroyWindowEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4918
#   define ve ((XVisibilityEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4919
#   define fe ((XFocusChangeEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4920
#   define cre ((XCreateWindowEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4921
#   define mape ((XMappingEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4922
#   define gre ((XGravityEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4923
#   define rr ((XResizeRequestEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4924
#   define cie ((XCirculateEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4925
#   define pe ((XPropertyEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4926
#   define sce ((XSelectionClearEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4927
#   define cme ((XColormapEvent *)ev)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4928
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4929
    KeySym keySym;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4930
    unsigned char buffer[10];                                               
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4931
    int i, nchars;
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4932
    char *keySymString;
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4933
    char keySymStringBuffer[32];
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4934
    unsigned INT nextMultiClickTime;
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4935
    OBJ arg, sym, t, windowID;
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4936
3233
b50a5e6ea9e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4937
    eB = aByteArray;
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4938
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4939
    if (__isByteArray(eB)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4940
	ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4941
    } else {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4942
	printf("DISPLAY: no eventBuffer\n");
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4943
	RETURN (false);
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4944
    }
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4945
    if (!__isArray(eventArr)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4946
	printf("DISPLAY: bad argument\n");
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4947
	RETURN (false);
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4948
    }
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4949
    if (__arraySize(eventArr) < 11) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4950
	printf("DISPLAY: bad argument\n");
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4951
	RETURN (false);
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4952
    }
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4953
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4954
    if (((t = __INST(lastId)) != nil)
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4955
     && __isExternalAddress(t)
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4956
     && (__WindowVal(t) == ae->window)) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4957
	windowID = t;
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4958
    } else {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4959
	windowID = __MKEXTERNALADDRESS(ae->window);
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4960
    }
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4961
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4962
    __ArrayInstPtr(eventArr)->a_element[0] = windowID; __STORE(eventArr, windowID);
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4963
    __ArrayInstPtr(eventArr)->a_element[1] = __MKSMALLINT(ev->type);
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4964
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4965
    switch (ev->type) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4966
	case KeyRelease:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4967
	    sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4968
	    goto keyPressAndRelease;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4969
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4970
	case KeyPress:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4971
	    sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4972
	    /* FALL INTO */
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4973
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4974
	keyPressAndRelease:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4975
	    arg = nil;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4976
	    nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4977
	    if (nchars 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4978
	     && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4979
		 || (buffer[0] >= 0x80))) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4980
		arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4981
		keySymString = NULL;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4982
	    } else {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4983
		keySymString = XKeysymToString(keySym);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4984
		if (keySymString) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4985
		    arg = __MKSTRING(keySymString);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4986
		}
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4987
	    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4988
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4989
	    if (arg == nil) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4990
		/* happens sometimes (alt-graph on sun has no keysym) */
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4991
		RETURN (false);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4992
	    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4993
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4994
	    __ArrayInstPtr(eventArr)->a_element[2] = sym;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4995
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4996
	    __ArrayInstPtr(eventArr)->a_element[3] = arg; __STORE(eventArr, arg);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4997
	    __ArrayInstPtr(eventArr)->a_element[4] = t = __MKUINT(ke->keycode); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4998
	    __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ke->state);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4999
	    __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ke->x);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5000
	    __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(ke->y);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5001
	    __ArrayInstPtr(eventArr)->a_element[8] = __mkSmallInteger(ke->x_root);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5002
	    __ArrayInstPtr(eventArr)->a_element[9] = __mkSmallInteger(ke->y_root);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5003
	    __ArrayInstPtr(eventArr)->a_element[10] = t = __MKUINT(ke->time); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5004
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5005
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5006
	case ButtonPress:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5007
	    sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5008
	    goto buttonPressAndRelease;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5009
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5010
	case ButtonRelease:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5011
	    sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5012
	    /* fall into */
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5013
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5014
	buttonPressAndRelease:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5015
	    __ArrayInstPtr(eventArr)->a_element[2] = sym;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5016
	    __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(be->button);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5017
	    __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ke->state);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5018
	    __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(be->x);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5019
	    __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(be->y);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5020
	    __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(be->x_root);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5021
	    __ArrayInstPtr(eventArr)->a_element[8] = __mkSmallInteger(be->y_root);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5022
	    __ArrayInstPtr(eventArr)->a_element[9] = t = __MKUINT(be->time); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5023
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5024
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5025
	case MotionNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5026
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(buttonMotion:state:x:y:rootX:rootY:time:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5027
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5028
	    __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(me->state);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5029
	    __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(me->x);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5030
	    __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(me->y);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5031
	    __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(me->x_root);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5032
	    __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(me->y_root);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5033
	    __ArrayInstPtr(eventArr)->a_element[8] = t = __MKUINT(me->time); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5034
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5035
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5036
	case FocusIn:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5037
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(focusIn:mode:detail:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5038
	    goto focusInOut;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5039
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5040
	case FocusOut:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5041
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(focusOut:mode:detail:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5042
	    /* fall into */
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5043
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5044
	focusInOut:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5045
	    __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(fe->mode);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5046
	    __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(fe->detail);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5047
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5048
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5049
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5050
	case EnterNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5051
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(pointerEnter:x:y:rootX:rootY:state:mode:detail:time:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5052
	    goto enterLeave;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5053
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5054
	case LeaveNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5055
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(pointerLeave:x:y:rootX:rootY:state:mode:detail:time:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5056
	    /* fall into */
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5057
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5058
	enterLeave:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5059
	    __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(ele->x);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5060
	    __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ele->y);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5061
	    __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ele->x_root);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5062
	    __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ele->y_root);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5063
	    __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(ele->state);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5064
	    __ArrayInstPtr(eventArr)->a_element[8] = __mkSmallInteger(ele->mode);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5065
	    __ArrayInstPtr(eventArr)->a_element[9] = __mkSmallInteger(ele->detail);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5066
	    __ArrayInstPtr(eventArr)->a_element[10] = t = __MKUINT(ele->time); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5067
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5068
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5069
	case Expose:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5070
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(expose:x:y:width:height:count:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5071
	    goto expose;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5072
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5073
	case GraphicsExpose:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5074
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(graphicsExpose:x:y:width:height:count:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5075
	    /* fall into */
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5076
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5077
	expose:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5078
	    __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(ee->x);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5079
	    __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ee->y);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5080
	    __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ee->width);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5081
	    __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ee->height);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5082
	    __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(ee->count);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5083
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5084
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5085
	case NoExpose:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5086
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(noExposeView:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5087
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5088
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5089
	case VisibilityNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5090
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(visibilityNotify:state:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5091
	    switch (ve->state) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5092
		case VisibilityUnobscured:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5093
		    __ArrayInstPtr(eventArr)->a_element[3] = @symbol(unobscured);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5094
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5095
		case VisibilityPartiallyObscured:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5096
		    __ArrayInstPtr(eventArr)->a_element[3] = @symbol(partiallyObscured);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5097
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5098
		case VisibilityFullyObscured:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5099
		    __ArrayInstPtr(eventArr)->a_element[3] = @symbol(fullyObscured);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5100
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5101
		default:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5102
		    __ArrayInstPtr(eventArr)->a_element[3] = __MKSMALLINT(ve->state);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5103
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5104
	    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5105
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5106
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5107
	case CreateNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5108
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(createWindow:x:y:width:height:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5109
	    __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(cre->x);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5110
	    __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(cre->y);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5111
	    __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(cre->width);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5112
	    __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(cre->height);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5113
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5114
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5115
	case DestroyNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5116
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(destroyedView:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5117
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5118
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5119
	case UnmapNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5120
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(unmappedView:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5121
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5122
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5123
	case MapNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5124
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(mappedView:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5125
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5126
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5127
	case ConfigureNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5128
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(configure:x:y:width:height:above:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5129
	    __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(ce->x);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5130
	    __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ce->y);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5131
	    __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ce->width);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5132
	    __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ce->height);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5133
	    __ArrayInstPtr(eventArr)->a_element[7] = nil;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5134
	    if (ce->above != None) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5135
		__ArrayInstPtr(eventArr)->a_element[7] = t = __MKEXTERNALADDRESS(ce->above); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5136
	    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5137
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5138
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5139
	case GravityNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5140
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(gravityNotify:x:y:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5141
	    __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(gre->x);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5142
	    __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(gre->y);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5143
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5144
	    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5145
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5146
	case ResizeRequest:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5147
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(resizeRequest:width:height:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5148
	    __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(rr->width);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5149
	    __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(rr->height);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5150
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5151
	    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5152
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5153
	case ConfigureRequest:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5154
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(configureRequest:x:y:width:height:above:detail:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5155
	    __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(cr->x);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5156
	    __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(cr->y);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5157
	    __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(cr->width);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5158
	    __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(cr->height);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5159
	    __ArrayInstPtr(eventArr)->a_element[7] = nil;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5160
	    if (cr->above != None) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5161
		__ArrayInstPtr(eventArr)->a_element[7] = t = __MKEXTERNALADDRESS(cr->above); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5162
	    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5163
	    switch (cr->detail) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5164
		case Above:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5165
		    __ArrayInstPtr(eventArr)->a_element[8] = @symbol(above);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5166
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5167
		case Below:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5168
		    __ArrayInstPtr(eventArr)->a_element[8] = @symbol(below);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5169
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5170
		case TopIf:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5171
		    __ArrayInstPtr(eventArr)->a_element[8] = @symbol(topIf);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5172
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5173
		case BottomIf:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5174
		    __ArrayInstPtr(eventArr)->a_element[8] = @symbol(bottomIf);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5175
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5176
		case Opposite:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5177
		    __ArrayInstPtr(eventArr)->a_element[8] = @symbol(opposite);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5178
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5179
		default:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5180
		    __ArrayInstPtr(eventArr)->a_element[8] = __MKSMALLINT(cr->detail);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5181
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5182
	    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5183
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5184
	    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5185
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5186
	case CirculateNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5187
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(circulateNotify:place:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5188
	    goto circulate;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5189
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5190
	case CirculateRequest:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5191
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(circulateRequest:place:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5192
	    /* fall into */
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5193
	circulate:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5194
	    switch (cie->place) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5195
		case PlaceOnTop:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5196
		    __ArrayInstPtr(eventArr)->a_element[3] = @symbol(placeOnTop);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5197
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5198
		case PlaceOnBottom:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5199
		    __ArrayInstPtr(eventArr)->a_element[3] = @symbol(placeOnBottom);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5200
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5201
		default:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5202
		    __ArrayInstPtr(eventArr)->a_element[3] = __MKSMALLINT(cie->place);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5203
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5204
	    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5205
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5206
	    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5207
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5208
	case PropertyNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5209
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(propertyChange:atom:state:time:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5210
	    __ArrayInstPtr(eventArr)->a_element[3] = t = __MKATOMOBJ(pe->atom); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5211
	    switch (pe->state) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5212
		case PropertyNewValue:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5213
		    __ArrayInstPtr(eventArr)->a_element[4] = @symbol(newValue);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5214
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5215
		case PropertyDelete:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5216
		    __ArrayInstPtr(eventArr)->a_element[4] = @symbol(deleted);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5217
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5218
		default:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5219
		    __ArrayInstPtr(eventArr)->a_element[4] = __MKSMALLINT(pe->state);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5220
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5221
	    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5222
	    __ArrayInstPtr(eventArr)->a_element[5] = t = __MKUINT(pe->time); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5223
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5224
	    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5225
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5226
	case SelectionClear:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5227
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(selectionClear:atom:time:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5228
	    __ArrayInstPtr(eventArr)->a_element[3] = t = __MKATOMOBJ(sce->selection); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5229
	    __ArrayInstPtr(eventArr)->a_element[4] = t = __MKUINT(sce->time);         __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5230
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5231
	    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5232
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5233
	case SelectionRequest:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5234
	    /*
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5235
	     * someone wants the selection
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5236
	     */
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5237
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5238
	    __ArrayInstPtr(eventArr)->a_element[3] = t = __MKEXTERNALADDRESS(ev->xselectionrequest.requestor); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5239
	    __ArrayInstPtr(eventArr)->a_element[4] = t = __MKATOMOBJ(ev->xselectionrequest.selection); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5240
	    __ArrayInstPtr(eventArr)->a_element[5] = t = __MKATOMOBJ(ev->xselectionrequest.target);    __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5241
	    __ArrayInstPtr(eventArr)->a_element[6] = t = __MKATOMOBJ(ev->xselectionrequest.property);  __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5242
	    __ArrayInstPtr(eventArr)->a_element[7] = t = __MKUINT(ev->xselectionrequest.time);         __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5243
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5244
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5245
	case SelectionNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5246
	    /*
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5247
	     * returned selection value (answer from SelectionRequest)
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5248
	     */
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5249
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5250
	    __ArrayInstPtr(eventArr)->a_element[3] = t = __MKATOMOBJ(ev->xselection.selection); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5251
	    __ArrayInstPtr(eventArr)->a_element[4] = t = __MKATOMOBJ(ev->xselection.target);    __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5252
	    __ArrayInstPtr(eventArr)->a_element[5] = t = __MKATOMOBJ(ev->xselection.property);  __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5253
	    __ArrayInstPtr(eventArr)->a_element[6] = t = __MKEXTERNALADDRESS(ev->xselection.requestor); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5254
	    __ArrayInstPtr(eventArr)->a_element[7] = t = __MKUINT(ev->xselection.time); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5255
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5256
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5257
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5258
	case ColormapNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5259
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(colormapNotify:state:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5260
	    __ArrayInstPtr(eventArr)->a_element[3] = cme->state == ColormapInstalled ? true : false;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5261
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5262
	    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5263
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5264
	case ClientMessage:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5265
	    if (ev->xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5266
		if ((ev->xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom)))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5267
		 || (ev->xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5268
		    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(terminateView:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5269
		    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5270
		}
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5271
		if (ev->xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5272
		    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(saveAndTerminateView:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5273
		    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5274
		}
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5275
	    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5276
	    /*
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5277
	     * any other client message
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5278
	     */
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5279
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(clientMessage:type:format:data:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5280
	    __ArrayInstPtr(eventArr)->a_element[3] = __MKATOMOBJ(ev->xclient.message_type);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5281
	    __ArrayInstPtr(eventArr)->a_element[4] = __MKSMALLINT(ev->xclient.format);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5282
	    __ArrayInstPtr(eventArr)->a_element[5] = t = __MKBYTEARRAY(ev->xclient.data, sizeof(ev->xclient.data)); __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5283
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5284
	    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5285
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5286
	case MappingNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5287
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(mappingNotify:request:event:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5288
	    switch(mape->request) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5289
		case MappingModifier:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5290
		    arg = @symbol(mappingModifier);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5291
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5292
		case MappingKeyboard:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5293
		    arg = @symbol(mappingKeyboard);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5294
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5295
		case MappingPointer:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5296
		    arg = @symbol(mappingPointer);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5297
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5298
		default:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5299
		    arg = __MKSMALLINT(mape->request);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5300
		    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5301
	    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5302
	    __ArrayInstPtr(eventArr)->a_element[3] = arg;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5303
	    __ArrayInstPtr(eventArr)->a_element[4] = t = __MKBYTEARRAY(ev, sizeof(*mape));
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5304
	    __STORE(eventArr, t);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5305
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5306
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5307
	case KeymapNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5308
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(keymapNotify:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5309
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5310
	    break;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5311
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5312
	case MapRequest:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5313
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(mapRequest:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5314
	    RETURN (true);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5315
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5316
	case ReparentNotify:
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5317
	    __ArrayInstPtr(eventArr)->a_element[2] = @symbol(reparentedView:);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5318
	    break;
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5319
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5320
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5321
    }
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5322
#undef ae
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5323
#undef ee
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5324
#undef ke
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5325
#undef be
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5326
#undef ce
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5327
#undef cr
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5328
#undef cre
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5329
#undef cle
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5330
#undef gre
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5331
#undef me
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5332
#undef ewe
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5333
#undef ele
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5334
#undef lwe
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5335
#undef de
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5336
#undef mape
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5337
#undef ve
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5338
#undef fe
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5339
#undef rr
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5340
#undef pe
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5341
#undef sce
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5342
#undef cme
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5343
%}.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5344
    ^ true
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5345
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5346
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5347
defaultEventMask
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5348
    "return a mask to enable some events by default."
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5349
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5350
%{  /* NOCONTEXT */
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5351
    RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask |
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  5352
			 KeyPressMask | KeyReleaseMask |
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  5353
			 PointerMotionMask |
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  5354
			 EnterWindowMask | LeaveWindowMask |
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  5355
			 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask ));
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5356
%}
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5357
!
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5358
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5359
dispatchEventFor:aViewIdOrNil withMask:eventMask
48194c26a46c Initial revision
claus
parents:
diff changeset
  5360
    "central event handling method:
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  5361
     get next event and send appropriate message to the sensor or view.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5362
     If the argument aViewIdOrNil is nil, events for any view are processed,
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5363
     otherwise only events for the view with given id are processed.
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5364
     If the argument aMask is nonNil, only events for this eventMask are
1871
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  5365
     handled.
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  5366
     WARNING: this may block to wait for an event - you better check for a 
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5367
	      pending event before calling this."
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5368
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  5369
    (self getEventFor:aViewIdOrNil withMask:eventMask) ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5370
	AbortSignal handle:[:ex |
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5371
	    ex return
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5372
	] do:[
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5373
	    self newDispatchLastEvent.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5374
	]
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  5375
    ].
1489
f264f7852a8d avoid creation of a block for every event when a
Claus Gittinger <cg@exept.de>
parents: 1486
diff changeset
  5376
1871
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  5377
    "Modified: 19.8.1997 / 17:10:42 / cg"
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5378
!
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5379
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5380
dispatchExposeEventFor:aViewIdOrNil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5381
    "get next expose event and send appropriate message to the sensor or view.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5382
     If the argument aViewIdOrNil is nil, events for any view are processed,
1871
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  5383
     otherwise only events for the view with given id are processed.
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  5384
     WARNING: this may block to wait for an event - you better check for a 
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5385
	      pending event before calling this."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5386
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5387
    self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
1871
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  5388
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  5389
    "Modified: 19.8.1997 / 17:10:26 / cg"
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5390
!
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5391
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5392
dispatchLastEvent:evArray
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5393
    |viewId view evType arguments|
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5394
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5395
    evArray size < 3 ifTrue:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5396
'********** bad event:' errorPrintCR.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5397
evArray errorPrintCR.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5398
'********** see newDispatchLastEvent' errorPrintCR.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5399
	^ self.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5400
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5401
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5402
    viewId := evArray at:1.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5403
    viewId notNil ifTrue:[
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5404
	viewId = lastId ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5405
	    view := lastView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5406
	] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5407
	    view := self viewFromId:viewId
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5408
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5409
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5410
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5411
    evType := evArray at:3.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5412
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5413
    (self respondsTo:evType) ifTrue:[
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5414
	arguments := evArray copyFrom:3 to:(3 + evType numArgs - 1).
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5415
	arguments at:1 put:view.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5416
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5417
	self perform:evType withArguments:arguments.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5418
	^ true.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5419
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5420
'********** unhandled event:' errorPrintCR.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5421
evType errorPrintCR.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5422
'********** see newDispatchLastEvent' errorPrintCR.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5423
    ^ false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5424
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5425
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5426
dispatchPendingEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5427
    "central event handling method for modal operation.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5428
     (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
  5429
     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
  5430
     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
  5431
     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
  5432
     we only handle exposes until the graphicsExpose arrives.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5433
     Other systems may not need such a kludge"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5434
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5435
    "interested in exposes only ?"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5436
    dispatchingExpose notNil ifTrue:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5437
	[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5438
	    self dispatchExposeEventFor:dispatchingExpose
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5439
	].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5440
	^ self
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5441
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5442
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5443
    [self eventPendingWithSync:false] whileTrue:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5444
	(self getEventFor:nil withMask:nil) ifTrue:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5445
	    AbortSignal handle:[:ex |
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5446
		ex return
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5447
	    ] do:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5448
		self newDispatchLastEvent
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5449
	    ]
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5450
	].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5451
    ]
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5452
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5453
    "Modified: 19.8.1997 / 17:11:18 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5454
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5455
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5456
disposeEventsWithMask:aMask for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5457
    "dispose (throw away) specific events. If aWindowId is nil,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5458
     events matching the mask are thrown away regardless of which
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5459
     view they are for. Otherwise, only matching events for that 
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5460
     view are flushed."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5461
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5462
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5463
%{
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5464
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5465
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5466
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5467
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5468
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5469
     && __isSmallInteger(aMask)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5470
	Display *dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5471
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5472
	ENTER_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5473
	if (__isExternalAddress(aWindowIdOrNil)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5474
	    win = __WindowVal(aWindowIdOrNil);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5475
	    while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5476
	} else {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5477
	    while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5478
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5479
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5480
	RETURN ( self );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5481
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5482
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5483
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5484
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5485
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5486
eventMaskFor:anEventSymbol
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5487
    "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
  5488
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5489
%{  /* NOCONTEXT */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5490
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5491
    int m = 0;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5492
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5493
    if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5494
    else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5495
    else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5496
    else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5497
    else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5498
    else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5499
    else if (anEventSymbol == @symbol(expose)) m = ExposureMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5500
    else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5501
    else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5502
    else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5503
    else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5504
    else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5505
    else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5506
    else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5507
    else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5508
    else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5509
    RETURN (__MKSMALLINT(m));
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5510
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5511
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5512
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5513
eventPending
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5514
    "return true, if any event is pending. 
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5515
     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
  5516
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5517
    "/ ConservativeSync is required for some Xlib implementation,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5518
    "/ 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
  5519
    "/ (especially Win32 & Xlib)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5520
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5521
    ConservativeSync == true ifTrue:[self sync].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5522
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5523
    dispatchingExpose notNil ifTrue:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5524
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5525
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5526
    ^ self eventPendingWithSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5527
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5528
    "Modified: / 28.4.1999 / 11:08:12 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5529
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5530
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5531
eventPending:anEventSymbol for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5532
    "return true, if a specific event is pending"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5533
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5534
    ^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5535
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5536
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5537
eventPending:anEventMask for:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5538
    "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
  5539
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5540
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5541
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5542
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5543
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5544
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5545
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5546
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5547
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5548
    if (ISCONNECTED && __isSmallInteger(anEventMask)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5549
	Display *dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5550
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5551
	ENTER_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5552
	if (doSync == true) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5553
	    XSync(dpy, 0);      /* make certain everything is flushed */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5554
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5555
	if (__isExternalAddress(aWindowIdOrNil)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5556
	    win = __WindowVal(aWindowIdOrNil);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5557
	    thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5558
	} else {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5559
	    thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5560
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5561
	if (thereIsOne) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5562
	    XPutBackEvent(dpy, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5563
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5564
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5565
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5566
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5567
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5568
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5569
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5570
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5571
eventPendingWithSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5572
    "return true, if any event is pending. 
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5573
     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
  5574
     before checking."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5575
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5576
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5577
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5578
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5579
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5580
    if (ISCONNECTED) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5581
	Display *dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5582
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5583
	if (XEventsQueued(dpy, QueuedAlready)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5584
	    RETURN (true);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5585
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5586
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5587
	ENTER_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5588
	if (doSync == true) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5589
	    XSync(dpy, 0);      /* make certain everything is flushed */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5590
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5591
	if (XPending(dpy)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5592
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5593
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5594
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5595
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5596
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5597
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5598
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5599
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5600
eventQueued
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5601
    "return true, if any event is queued"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5602
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5603
    dispatchingExpose notNil ifTrue:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5604
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5605
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5606
    ^ self eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5607
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5608
    "Created: 12.12.1995 / 21:43:00 / stefan"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5609
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5610
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5611
eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5612
    "return true, if any event is queued internally.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5613
     (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
  5614
      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
  5615
      the display connection)."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5616
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5617
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5618
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5619
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5620
    if (ISCONNECTED) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5621
	/* ENTER ... LEAVE not needed; XEventsQueued will not block */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5622
	/* ENTER_XLIB(); */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5623
	if (XEventsQueued(myDpy, QueuedAlready)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5624
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5625
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5626
	/* LEAVE_XLIB(); */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5627
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5628
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5629
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5630
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5631
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5632
exposeEventPendingFor:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5633
    "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
  5634
     or any view (if the arg is nil).
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5635
     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
  5636
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5637
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5638
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5639
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5640
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5641
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5642
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5643
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5644
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5645
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5646
    if (ISCONNECTED) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5647
	Display *dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5648
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5649
	ENTER_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5650
	if (doSync == true) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5651
	    XSync(dpy, 0);      /* make certain everything is flushed */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5652
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5653
	if (__isExternalAddress(aWindowIdOrNil)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5654
	    win = __WindowVal(aWindowIdOrNil);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5655
	    thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5656
	} else {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5657
	    thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5658
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5659
	if (thereIsOne) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5660
	    XPutBackEvent(dpy, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5661
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5662
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5663
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5664
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5665
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5666
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5667
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5668
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5669
getEventFor:aViewIdOrNil withMask:eventMask
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5670
    "read next event - put into local eventBuffer. 
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5671
     If aViewIdOrNil is nil, events for any view are fetched; 
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5672
     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
  5673
     Returns true, if there was an event, false otherwise.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5674
     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
  5675
     before calling for it."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5676
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5677
    ^ self getEventFor:aViewIdOrNil withMask:eventMask into:eventBuffer
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
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5680
getEventFor:aViewIdOrNil withMask:eventMask into:anEventBuffer
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5681
    "read next event - put into anEventBuffer. 
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5682
     If aViewIdOrNil is nil, events for any view are fetched; 
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5683
     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
  5684
     Returns true, if there was an event, false otherwise.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5685
     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
  5686
     before calling for it.
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
     Sorry I had to split dispatch into this fetch method and an extra
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5689
     handle method to allow unlimitedstack here.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5690
     (some Xlibs do a big alloca there ...) which cannot be done in 
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5691
     dispatchLastEvent, since it dispatches out into ST-methods.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5692
    "
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5693
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5694
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5695
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5696
    Display *dpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5697
    Window win, wWanted;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5698
    int evMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5699
    XEvent *ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5700
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5701
    if (! ISCONNECTED) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5702
	RETURN (false);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5703
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5704
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5705
    dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5706
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5707
    if (__isByteArray(anEventBuffer)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5708
	ev = (XEvent *)(__ByteArrayInstPtr(anEventBuffer)->ba_element);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5709
    } else {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5710
	printf("DISPLAY: bad eventBuffer\n");
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5711
	RETURN (false);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5712
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5713
    ev->type = 0;
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
    if (__isSmallInteger(eventMask)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5716
	evMask = __intVal(eventMask);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5717
    } else {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5718
	evMask = ~0;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5719
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5720
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5721
    if (__isExternalAddress(aViewIdOrNil)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5722
	wWanted = __WindowVal(aViewIdOrNil);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5723
	if (XCheckWindowEvent(dpy, wWanted, evMask, ev)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5724
	    RETURN ( true );
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
    } else {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5727
	if (evMask == ~0) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5728
	    XNextEvent(dpy, ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5729
	    RETURN (true);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5730
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5731
	if (XCheckMaskEvent(dpy, evMask, ev)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5732
	   RETURN (true);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5733
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5734
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5735
    RETURN (false);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5736
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5737
    ^ self primitiveFailed
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5738
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5739
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5740
handleAllEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5741
    "from now on, handle any kind of event"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5742
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5743
    dispatchingExpose := nil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5744
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5745
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5746
handleExposeOnlyFor:aView
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5747
    "from now on, handle expose events only"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5748
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5749
    dispatchingExpose := aView id
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5750
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5751
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5752
newDispatchLastEvent
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5753
    |arr|
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5754
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5755
    arr := Array new:13.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5756
    self decomposeEventBuffer:eventBuffer into:arr.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5757
    (self dispatchLastEvent:arr) ifFalse:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5758
	self dispatchLastEvent
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5759
    ]
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5760
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5761
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5762
setEventMask:aMask in:aWindowId
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5763
    "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
  5764
     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
  5765
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5766
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5767
%{  
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5768
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5769
    int mask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5770
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5771
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5772
     && __isExternalAddress(aWindowId)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5773
     && __isSmallInteger(aMask)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5774
	mask = __intVal(aMask);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5775
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5776
#ifdef OLD
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5777
	/* these may not be disabled */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5778
	mask |= ExposureMask | StructureNotifyMask |
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5779
		KeyPressMask | KeyReleaseMask |
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5780
		EnterWindowMask | LeaveWindowMask |
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5781
		ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5782
#endif
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5783
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5784
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5785
	XSelectInput(myDpy, __WindowVal(aWindowId), mask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5786
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5787
	RETURN ( self );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5788
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5789
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5790
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5791
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5792
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5793
startDispatch
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5794
    "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
  5795
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5796
    dispatching ifTrue:[^ self].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5797
    dispatchingExpose := nil.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5798
    super startDispatch
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5799
! !
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5800
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5801
!XWorkstation methodsFor:'event handling - old dispatch'!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5802
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5803
buttonPress:button x:x y:y view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5804
    "forward a button-press event for some view"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5805
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5806
    aView isNil ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5807
	"/ event arrived, after I destroyed it myself
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5808
	^ self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5809
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5810
    button == 1 ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5811
	activateOnClick == true ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5812
	    "/ dont raise above an active popup view.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5813
	    (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5814
		aView topView raise.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5815
"/            ] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5816
"/                activeKeyboardGrab printCR.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5817
"/                activePointerGrab printCR.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5818
	    ]
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5819
	].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5820
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5821
    super buttonPress:button x:x y:y view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5822
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5823
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5824
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5825
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5826
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5827
circulateNotifyView:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5828
    "sent, when the stacking order changes.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5829
     ignored for now."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5830
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5831
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5832
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5833
circulateRequestView:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5834
    "sent, when the stacking order is about to change.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5835
     ignored for now."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5836
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5837
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5838
clientMessage:event type:type format:format dataOffset:offs view:targetView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5839
    |sensor data|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5840
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5841
    data := event copyFrom:offs + 1.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5842
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5843
    "/ DND drag&drop protocol
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5844
    type == (self atomIDOf:#DndProtocol) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5845
	format == 32 ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5846
	    self dndMessage:event data:data view:targetView.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5847
	    ^ self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5848
	]
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5849
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5850
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5851
    (sensor := targetView sensor) notNil ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5852
	sensor clientMessage:type format:format eventData:data view:targetView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5853
    ] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5854
	"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5855
	 not posted, if there is no sensor ...
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5856
	"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5857
    ]
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5858
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5859
    "Created: 4.4.1997 / 17:49:26 / cg"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5860
    "Modified: 4.4.1997 / 18:00:18 / cg"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5861
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5862
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5863
colorMapChangeView:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5864
    "sent, when another colormap is installed.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5865
     This is a very X-specific mechanism."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5866
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5867
    aView isNil ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5868
	"/ event arrived, after I destroyed it myself
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5869
	^ self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5870
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5871
    aView colorMapChange
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5872
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5873
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5874
configureRequestView:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5875
    "ignored for now"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5876
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5877
    "/ aView configureRequest
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5878
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5879
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5880
createdView:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5881
    "ignored for now"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5882
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5883
    "/ aView created
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5884
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5885
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5886
dispatchLastEvent
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  5887
    |theView symS arg butt sibling 
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  5888
     windowID siblingID propertyID selectionID targetID requestorID
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  5889
     evTime
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  5890
     eventType|
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5891
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5892
%{  /* STACK: 8000 */
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5893
#   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5894
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5895
    Display *dpy;
135
claus
parents: 133
diff changeset
  5896
    OBJ eB;
claus
parents: 133
diff changeset
  5897
    XEvent *ev;
1521
23aacd62bbac care for GC before reaccessing the eventBuffer
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
  5898
    int ev_x, ev_y;
135
claus
parents: 133
diff changeset
  5899
claus
parents: 133
diff changeset
  5900
#   define ae ((XAnyEvent *)ev)
claus
parents: 133
diff changeset
  5901
#   define ee ((XExposeEvent *)ev)
claus
parents: 133
diff changeset
  5902
#   define ke ((XKeyPressedEvent *)ev)
claus
parents: 133
diff changeset
  5903
#   define be ((XButtonPressedEvent *)ev)
claus
parents: 133
diff changeset
  5904
#   define ce ((XConfigureEvent *)ev)
claus
parents: 133
diff changeset
  5905
#   define me ((XMotionEvent *)ev)
claus
parents: 133
diff changeset
  5906
#   define ewe ((XEnterWindowEvent *)ev)
claus
parents: 133
diff changeset
  5907
#   define lwe ((XLeaveWindowEvent *)ev)
claus
parents: 133
diff changeset
  5908
#   define de ((XDestroyWindowEvent *)ev)
claus
parents: 133
diff changeset
  5909
#   define ve ((XVisibilityEvent *)ev)
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  5910
#   define mape ((XMappingEvent *)ev)
135
claus
parents: 133
diff changeset
  5911
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5912
    KeySym keySym;
48194c26a46c Initial revision
claus
parents:
diff changeset
  5913
    unsigned char buffer[10];
48194c26a46c Initial revision
claus
parents:
diff changeset
  5914
    int i, nchars;
48194c26a46c Initial revision
claus
parents:
diff changeset
  5915
    char *keySymString;
48194c26a46c Initial revision
claus
parents:
diff changeset
  5916
    char keySymStringBuffer[32];
1832
4faf4cd47962 alpha64 change
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5917
    unsigned INT nextMultiClickTime;
1223
09d8118c8031 keep nextMultiClickTime on a per-display basis
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  5918
    OBJ upDown, t;
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  5919
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  5920
    struct inlineCache *ipS;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5921
    static struct inlineCache vid = _ILC1;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5922
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5923
    static struct inlineCache expS = _ILC5;
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  5924
    static struct inlineCache gexpS = _ILC6;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5925
    static struct inlineCache nexpS = _ILC1;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5926
    static struct inlineCache motS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5927
    static struct inlineCache bpS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5928
    static struct inlineCache bmpS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5929
    static struct inlineCache bspS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5930
    static struct inlineCache brS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5931
    static struct inlineCache focInS = _ILC1;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5932
    static struct inlineCache focOutS = _ILC1;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5933
    static struct inlineCache peS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5934
    static struct inlineCache plS = _ILC2;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  5935
    static struct inlineCache termS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  5936
    static struct inlineCache savtermS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  5937
    static struct inlineCache destrS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  5938
    static struct inlineCache unmapS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  5939
    static struct inlineCache mapS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  5940
    static struct inlineCache confS = _ILC5;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  5941
    static struct inlineCache coveredS = _ILC2;
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5942
    static struct inlineCache clientMsg = _ILC5;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5943
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5944
    static struct inlineCache keymap = _ILC0;
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5945
    static struct inlineCache created = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5946
    static struct inlineCache mapReq = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5947
    static struct inlineCache repar = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5948
    static struct inlineCache confReq = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5949
    static struct inlineCache resReq = _ILC1;
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  5950
    static struct inlineCache circReq = _ILC1;
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  5951
    static struct inlineCache circNotify = _ILC1;
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5952
    static struct inlineCache gravNotify = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5953
    static struct inlineCache prop = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5954
    static struct inlineCache selClear = _ILC2;
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  5955
    static struct inlineCache selReq = _ILC6;
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5956
    static struct inlineCache selNotify = _ILC5;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5957
    static struct inlineCache colormap = _ILC1;
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  5958
    static struct inlineCache mapping = _ILC2;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  5959
    static struct inlineCache vis = _ILC1;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5960
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5961
    static struct inlineCache skpS = _ILC4;
63
b9d17e2b6c92 keyRelease and more event masks
claus
parents: 55
diff changeset
  5962
    static struct inlineCache skrS = _ILC4;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5963
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5964
    if (! ISCONNECTED) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5965
	RETURN (false);
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5966
    }
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5967
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5968
    dpy = myDpy;
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5969
1210
Claus Gittinger <cg@exept.de>
parents: 1209
diff changeset
  5970
    eB = __INST(eventBuffer);
Claus Gittinger <cg@exept.de>
parents: 1209
diff changeset
  5971
135
claus
parents: 133
diff changeset
  5972
    if (__isByteArray(eB)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5973
	ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
135
claus
parents: 133
diff changeset
  5974
    } else {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5975
	printf("DISPLAY: no eventBuffer\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5976
	RETURN (false);
135
claus
parents: 133
diff changeset
  5977
    }
claus
parents: 133
diff changeset
  5978
1486
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  5979
    /*
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  5980
     * very often, its another event for the same view ...
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  5981
     * avoid creation & lookup then.
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  5982
     */
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  5983
    if ((t = __INST(lastId)) != nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5984
	if (__isExternalAddress(t)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5985
	    if (__WindowVal(t) == ae->window) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5986
		theView = __INST(lastView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5987
		if (__isNonNilObject(theView)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5988
		    if (__qClass(theView) == nil) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5989
			theView = nil;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5990
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5991
		}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5992
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5993
	}
1486
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  5994
    }
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  5995
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  5996
    if (theView == nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5997
	windowID = __MKEXTERNALADDRESS(ae->window);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5998
	theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5999
	/*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6000
	 * MKEXTERNALADDRESS and/or #viewFromId: could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6001
	 */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6002
	eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6003
	ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
1486
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  6004
    }
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  6005
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  6006
    if ((theView == nil) && (ev->type != MappingNotify)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6007
	RETURN (nil);
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  6008
    }
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  6009
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  6010
    /*
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  6011
     * key, button and pointer events are sent to the sensor,
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  6012
     * or (if there is none) to the delegate.
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  6013
     * or (if there is none) to the view.
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  6014
     *
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  6015
     * expose events are sent to the sensor,
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  6016
     * or (if there is none) to the view
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  6017
     *
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  6018
     * sensor and delegate get view as additional argument
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  6019
     * all of this has been taken out of here to corresponding methods
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  6020
     * in DeviceWorkstation.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  6021
     */
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  6022
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  6023
#ifdef DEBUG
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  6024
    eventType = __MKSMALLINT(ev->type);
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  6025
#endif
135
claus
parents: 133
diff changeset
  6026
    switch (ev->type) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6027
	case KeyRelease:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6028
	    symS = @symbol(keyRelease:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6029
	    ipS = &skrS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6030
	    upDown = false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6031
	    goto keyPressAndRelease;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6032
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6033
	case KeyPress:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6034
	    symS = @symbol(keyPress:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6035
	    ipS = &skpS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6036
	    upDown = true;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6037
	    /* FALL INTO */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6038
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6039
	keyPressAndRelease:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6040
	    __INST(eventRootX) = __MKSMALLINT(ke->x_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6041
	    __INST(eventRootY) = __MKSMALLINT(ke->y_root);
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  6042
#ifdef OLD
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6043
	    __INST(altDown) = (ke->state & Mod2Mask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6044
	    __INST(metaDown) = (ke->state & Mod1Mask) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  6045
#else
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6046
	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6047
	    __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  6048
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6049
	    __INST(shiftDown) = (ke->state & ShiftMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6050
	    __INST(ctrlDown) = (ke->state & ControlMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6051
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6052
	    ev_x = ke->x;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6053
	    ev_y = ke->y;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6054
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6055
	    arg = nil;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6056
	    nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6057
	    if (nchars 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6058
	     && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6059
		 || (buffer[0] >= 0x80))) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6060
		arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6061
		keySymString = NULL;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6062
	    } else {
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  6063
#ifdef OLD
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6064
		switch (keySym) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6065
		    case XK_Control_L:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6066
		    case XK_Control_R:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6067
			__INST(ctrlDown) = upDown;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6068
			break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6069
		    case XK_Shift_L:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6070
		    case XK_Shift_R:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6071
			__INST(shiftDown) = upDown;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6072
			break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6073
		    case XK_Meta_L:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6074
		    case XK_Meta_R:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6075
			__INST(metaDown) = upDown;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6076
			break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6077
		    case XK_Alt_L:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6078
		    case XK_Alt_R:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6079
			__INST(altDown) = upDown;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6080
			break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6081
		}
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  6082
#endif
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  6083
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6084
		keySymString = XKeysymToString(keySym);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6085
		if (keySymString) {
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  6086
#ifdef OLD
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6087
		    if (keySymString[0] == 'D') {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6088
			/*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6089
			 * remove underscore, dont want it in symbols
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6090
			 */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6091
			if (strcmp(keySymString, "Delete_line") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6092
			    keySymString = "DeleteLine";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6093
			} else if (strcmp(keySymString, "Delete_word") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6094
			    keySymString = "DeleteWord";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6095
			}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6096
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6097
		    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6098
		     * make names compatible
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6099
		     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6100
		    if (strcmp(keySymString, "Down") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6101
			keySymString = "CursorDown";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6102
		    } else if (strcmp(keySymString, "Up") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6103
			keySymString = "CursorUp";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6104
		    } else if (strcmp(keySymString, "Left") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6105
			keySymString = "CursorLeft";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6106
		    } else if (strcmp(keySymString, "Right") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6107
			keySymString = "CursorRight";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6108
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6109
		    arg = __MKSYMBOL(keySymString, (OBJ *)0);
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  6110
#else
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6111
		    arg = __MKSTRING(keySymString);
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  6112
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6113
		}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6114
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6115
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6116
	    if (arg == nil) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6117
		/* happens sometimes (alt-graph on sun has no keysym) */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6118
		break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6119
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6120
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6121
	    (*(*ipS).ilc_func)(self, symS, nil, ipS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6122
			       arg, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6123
			       __MKSMALLINT(ev_x), 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6124
			       __MKSMALLINT(ev_y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6125
			       theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6126
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6127
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6128
	case ButtonPress:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6129
	    __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) | (1 << be->button));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6130
	    __INST(eventRootX) = __MKSMALLINT(be->x_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6131
	    __INST(eventRootY) = __MKSMALLINT(be->y_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6132
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6133
	    if (__isSmallInteger(__INST(multiClickTimeDelta)))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6134
		nextMultiClickTime = be->time + __intVal(__INST(multiClickTimeDelta));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6135
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6136
		nextMultiClickTime = 0;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6137
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6138
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6139
	    if ((t = __INST(multiClickTime)) != nil) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6140
		INT _multiClickTime;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6141
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6142
		_multiClickTime = __longIntVal(t);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6143
		if (be->time < _multiClickTime) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6144
		    __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6145
		    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6146
		     * MKUINT could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6147
		     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6148
		    eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6149
		    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6150
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6151
		    ipS = &bmpS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6152
		    symS = @symbol(buttonMultiPress:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6153
		    goto sendButtonEvent;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6154
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6155
		}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6156
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6157
	    __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6158
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6159
	     * MKUINT could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6160
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6161
	    eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6162
	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
1223
09d8118c8031 keep nextMultiClickTime on a per-display basis
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  6163
1010
b8576573e6aa no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents: 1008
diff changeset
  6164
#ifdef NO_LONGER
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6165
	    if (be->state & ShiftMask) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6166
		ipS = &bspS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6167
		symS = @symbol(buttonShiftPress:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6168
		goto sendButtonEvent;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6169
	    }
1010
b8576573e6aa no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents: 1008
diff changeset
  6170
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6171
	    ipS = &bpS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6172
	    symS = @symbol(buttonPress:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6173
	    goto sendButtonEvent;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6174
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6175
	    /* NOT REACHED */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6176
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6177
	case ButtonRelease:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6178
	    __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) & ~(1 << be->button));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6179
	    __INST(eventRootX) = __MKSMALLINT(be->x_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6180
	    __INST(eventRootY) = __MKSMALLINT(be->y_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6181
	    ipS = &brS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6182
	    symS = @symbol(buttonRelease:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6183
	    /* fall into */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6184
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6185
	sendButtonEvent:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6186
	    butt = __MKSMALLINT(be->button);
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  6187
#ifdef NOTDEF
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6188
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6189
	     * this allows operation with single button mouses: meta-click is always Button 2
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6190
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6191
	    if (__INST(metaDown) == true)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6192
		butt = __MKSMALLINT(2);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6193
	    else 
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  6194
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6195
		butt = __AT_(__INST(buttonTranslation), butt);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6196
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6197
	     * #at: could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6198
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6199
	    eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6200
	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6201
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6202
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6203
	    (*(*ipS).ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6204
			       symS, nil, ipS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6205
			       butt, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6206
			       __MKSMALLINT(ke->x), 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6207
			       __MKSMALLINT(ke->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6208
			       theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6209
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6210
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6211
	case MotionNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6212
	    if (__INST(motionEventCompression) != false) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6213
		while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6214
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6215
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6216
	    __INST(eventRootX) = __MKSMALLINT(me->x_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6217
	    __INST(eventRootY) = __MKSMALLINT(me->y_root);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  6218
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  6219
#ifdef OLD
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6220
	    __INST(altDown) = (me->state & Mod2Mask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6221
	    __INST(metaDown) = (me->state & Mod1Mask) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  6222
#else
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6223
	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6224
	    __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  6225
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6226
	    __INST(shiftDown) = (me->state & ShiftMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6227
	    __INST(ctrlDown) = (me->state & ControlMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6228
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6229
	    (*motS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6230
			     @symbol(buttonMotion:x:y:view:), nil, &motS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6231
			     __MKSMALLINT(me->state),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6232
			     __MKSMALLINT(me->x),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6233
			     __MKSMALLINT(me->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6234
			     theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6235
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6236
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6237
	case FocusIn:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6238
	    (*focInS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6239
			       @symbol(focusInView:), nil, &focInS, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6240
			       theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6241
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6242
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6243
	case FocusOut:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6244
	    (*focOutS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6245
				@symbol(focusOutView:), nil, &focOutS, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6246
				theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6247
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6248
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6249
	case EnterNotify:
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  6250
#ifdef OLD
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6251
	    __INST(altDown) = (ewe->state & Mod2Mask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6252
	    __INST(metaDown) = (ewe->state & Mod1Mask) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  6253
#else
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6254
	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6255
	    __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  6256
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6257
	    __INST(shiftDown) = (ewe->state & ShiftMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6258
	    __INST(ctrlDown) = (ewe->state & ControlMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6259
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6260
	    (*peS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6261
			    @symbol(pointerEnter:x:y:view:), nil, &peS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6262
			    __MKSMALLINT(ewe->state),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6263
			    __MKSMALLINT(ewe->x), 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6264
			    __MKSMALLINT(ewe->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6265
			    theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6266
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6267
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6268
	case LeaveNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6269
	    (*plS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6270
			    @symbol(pointerLeave:view:), nil, &plS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6271
			    __MKSMALLINT(lwe->state), 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6272
			    theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6273
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6274
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6275
	case GraphicsExpose:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6276
	    (*gexpS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6277
			      @symbol(graphicsExposeX:y:width:height:final:view:), nil, &gexpS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6278
			      __MKSMALLINT(ee->x),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6279
			      __MKSMALLINT(ee->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6280
			      __MKSMALLINT(ee->width),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6281
			      __MKSMALLINT(ee->height),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6282
			      ee->count == 0 ? true : false,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6283
			      theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6284
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6285
	    if (ee->count != 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6286
		break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6287
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6288
	    /* fall into */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6289
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6290
	case NoExpose:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6291
	    (*nexpS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6292
			      @symbol(noExposeView:), nil, &nexpS, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6293
			      theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6294
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6295
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6296
	case Expose:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6297
	    (*expS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6298
			     @symbol(exposeX:y:width:height:view:), nil, &expS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6299
			     __MKSMALLINT(ee->x),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6300
			     __MKSMALLINT(ee->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6301
			     __MKSMALLINT(ee->width),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6302
			     __MKSMALLINT(ee->height),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6303
			     theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6304
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6306
	case ConfigureNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6307
	    if (ce->above != None) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6308
		siblingID = __MKEXTERNALADDRESS(ce->above);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6309
		sibling = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, siblingID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6310
		/*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6311
		 * MKEXTERNALADDRESS or #viewFromId: could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6312
		 */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6313
		eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6314
		ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6315
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6316
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6317
	    (*confS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6318
			     @symbol(configureX:y:width:height:view:), nil, &confS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6319
			     __MKSMALLINT(ce->x),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6320
			     __MKSMALLINT(ce->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6321
			     __MKSMALLINT(ce->width),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6322
			     __MKSMALLINT(ce->height),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6323
			     theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6324
	    if (sibling != nil) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6325
		(*coveredS.ilc_func)(self,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6326
				    @symbol(coveredBy:view:), nil, &coveredS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6327
				    theView,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6328
				    sibling);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6329
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6330
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6331
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6332
	case ClientMessage:
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6333
	    if (ev->xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6334
		if ((ev->xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom)))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6335
		 || (ev->xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6336
		    (*termS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6337
				      @symbol(terminateView:), nil, &termS, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6338
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6339
		}
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6340
		if (ev->xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6341
		    (*savtermS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6342
					 @symbol(saveAndTerminateView:)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6343
					 , nil, &savtermS, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6344
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6345
		}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6346
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6347
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6348
	     * any other client message
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6349
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6350
	    i = (char *)(&(ev->xclient.data)) - (char *)ev;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6351
	    (*clientMsg.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6352
				 @symbol(clientMessage:type:format:dataOffset:view:)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6353
				 , nil, &clientMsg 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6354
				 , __INST(eventBuffer)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6355
				 ,__MKSMALLINT(ev->xclient.message_type)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6356
				 ,__MKSMALLINT(ev->xclient.format)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6357
				 ,__MKSMALLINT(i), 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6358
				 theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6359
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6360
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6361
	case DestroyNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6362
	    (*destrS.ilc_func)(self, @symbol(destroyedView:)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6363
			       , nil, &destrS, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6364
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6365
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6366
	case UnmapNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6367
	    (*unmapS.ilc_func)(self, @symbol(unmappedView:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6368
			       , nil, &unmapS, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6369
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6370
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6371
	case MapNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6372
	    (*mapS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6373
			     @symbol(mappedView:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6374
			     , nil, &mapS, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6375
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6376
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6377
	case KeymapNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6378
	    (*keymap.ilc_func)(theView, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6379
			       @symbol(keyMapChange) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6380
			       , nil, &keymap);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6381
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6382
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6383
	case VisibilityNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6384
	    switch (ve->state) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6385
		case VisibilityUnobscured:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6386
		    arg = @symbol(unobscured);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6387
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6388
		case VisibilityPartiallyObscured:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6389
		    arg = @symbol(partiallyObscured);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6390
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6391
		case VisibilityFullyObscured:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6392
		    arg = @symbol(fullyObscured);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6393
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6394
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6395
	    (*vis.ilc_func)(theView, @symbol(visibilityChange:), nil, &vis, arg);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6396
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6397
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6398
	case CreateNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6399
	    (*created.ilc_func)(self, @symbol(createdView:), nil, &created, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6400
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6401
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6402
	case MapRequest:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6403
	    (*mapReq.ilc_func)(self, @symbol(mapRequestView:), nil, &mapReq, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6404
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6405
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6406
	case ReparentNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6407
	    (*repar.ilc_func)(self, @symbol(reparentedView:), nil, &repar, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6408
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6409
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6410
	case ConfigureRequest:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6411
	    (*confReq.ilc_func)(self, @symbol(configureRequestView:), nil, &confReq, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6412
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6413
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6414
	case GravityNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6415
	    (*gravNotify.ilc_func)(self, @symbol(gravityNotifyView:), nil, &resReq, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6416
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6417
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6418
	case ResizeRequest:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6419
	    (*resReq.ilc_func)(self, @symbol(resizeRequestView:), nil, &resReq, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6420
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6421
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6422
	case CirculateNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6423
	    (*circNotify.ilc_func)(self, @symbol(circulateNotifyView:), nil, &circNotify, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6424
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6425
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6426
	case CirculateRequest:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6427
	    (*circReq.ilc_func)(self, @symbol(circulateRequestView:), nil, &circReq, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6428
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6429
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6430
	case PropertyNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6431
	    (*prop.ilc_func)(self, 
3146
bf7e27673865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6432
			     @symbol(propertyChangeView:) 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6433
			     , nil, &prop,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6434
			     theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6435
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6436
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6437
	case SelectionClear:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6438
	    selectionID = __MKATOMOBJ(ev->xselectionclear.selection);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6439
	    (*selClear.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6440
				 @symbol(selectionClear:view:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6441
				 , nil, &selClear,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6442
				 selectionID,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6443
				 theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6444
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6445
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6446
	case SelectionNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6447
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6448
	     * returned selection value (answer from SelectionRequest)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6449
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6450
	    DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6451
			ev->xselection.property, ev->xselection.target,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6452
			ev->xselection.selection, ev->xselection.requestor));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6453
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6454
	    {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6455
		INT _property = ev->xselection.property;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6456
		INT _target = ev->xselection.target;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6457
		INT _selection = ev->xselection.selection;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6458
		INT _requestor = ev->xselection.requestor;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6459
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6460
		propertyID = __MKATOMOBJ(_property);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6461
		targetID = __MKATOMOBJ(_target);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6462
		selectionID = __MKATOMOBJ(_selection);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6463
		requestorID = __MKEXTERNALADDRESS(_requestor);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6464
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6465
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6466
	     * MKATOMOBJ/MKEXTERNALADDRESS could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6467
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6468
	    eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6469
	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6470
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6471
	    (*selNotify.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6472
				  @symbol(selectionNotify:target:selection:from:view:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6473
				  , nil, &selNotify,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6474
				  propertyID, targetID, selectionID, requestorID,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6475
				  theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6476
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6477
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6478
	case SelectionRequest:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6479
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6480
	     * someone wants the selection
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6481
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6482
	    DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6483
			ev->xselectionrequest.property,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6484
			ev->xselectionrequest.target,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6485
			ev->xselectionrequest.selection,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6486
			ev->xselectionrequest.requestor));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6487
	    {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6488
		INT _property = ev->xselectionrequest.property;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6489
		INT _target = ev->xselectionrequest.target;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6490
		INT _selection = ev->xselectionrequest.selection;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6491
		INT _requestor = ev->xselectionrequest.requestor;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6492
		INT _t = ev->xselectionrequest.time;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6493
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6494
		propertyID = __MKATOMOBJ(_property);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6495
		targetID = __MKATOMOBJ(_target);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6496
		selectionID = __MKATOMOBJ(_selection);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6497
		requestorID = __MKEXTERNALADDRESS(_requestor);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6498
		evTime = __MKEXTERNALADDRESS(_t);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6499
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6500
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6501
	     * MKATOMOBJ/MKEXTERNALADDR could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6502
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6503
	    eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6504
	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6505
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6506
	    (*selReq.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6507
			       @symbol(selectionRequest:target:selection:time:from:view:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6508
			       , nil, &selReq,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6509
			       propertyID, targetID, selectionID, evTime, requestorID,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6510
			       theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6511
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6512
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6513
	case ColormapNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6514
	    (*colormap.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6515
				 @symbol(colorMapChangeView:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6516
				 , nil, &colormap,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6517
				 theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6518
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6519
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6520
	case MappingNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6521
	    switch(mape->request) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6522
		case MappingModifier:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6523
		    arg = @symbol(mappingModifier);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6524
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6525
		case MappingKeyboard:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6526
		    arg = @symbol(mappingKeyboard);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6527
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6528
		case MappingPointer:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6529
		    arg = @symbol(mappingPointer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6530
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6531
		default:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6532
		    arg = nil;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6533
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6534
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6535
	    (*mapping.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6536
				@symbol(mappingChanged:event:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6537
				, nil, &mapping, arg, eB);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6538
	    break;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  6539
    }
135
claus
parents: 133
diff changeset
  6540
#undef ae
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  6541
#undef ee
48194c26a46c Initial revision
claus
parents:
diff changeset
  6542
#undef ke
48194c26a46c Initial revision
claus
parents:
diff changeset
  6543
#undef be
48194c26a46c Initial revision
claus
parents:
diff changeset
  6544
#undef ce
48194c26a46c Initial revision
claus
parents:
diff changeset
  6545
#undef me
48194c26a46c Initial revision
claus
parents:
diff changeset
  6546
#undef ewe
48194c26a46c Initial revision
claus
parents:
diff changeset
  6547
#undef lwe
48194c26a46c Initial revision
claus
parents:
diff changeset
  6548
#undef de
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  6549
#undef mape
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  6550
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  6551
    ^ true
48194c26a46c Initial revision
claus
parents:
diff changeset
  6552
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  6553
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6554
gravityNotifyView:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6555
    "ignored for now"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6556
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6557
    "/ aView gravityNotify
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6558
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6559
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6560
mapRequestView:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6561
    "ignored for now"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6562
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6563
    "/ aView mapRequest
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6564
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6565
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6566
mappingChanged:what event:eB
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6567
    "OBSOLETE with newDispatchLastEvent!!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6568
     One of Keyboard-, Modifier- or PointerMap has change, probably by xmodmap.
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  6569
     Tell xlib about the fact."
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  6570
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  6571
    (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6572
	self refreshKeyboardMapping:eB.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6573
	"Maybe some of our modifiers have been changed"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6574
	self initializeModifierMappings.
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  6575
    ].
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  6576
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  6577
    "Created: 1.12.1995 / 16:28:23 / stefan"
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6578
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6579
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6580
propertyChangeView:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6581
    "sent when an X property changes.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6582
     This is a very X-specific mechanism."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6583
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6584
    aView isNil ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6585
	"/ event arrived, after I destroyed it myself
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6586
	^ self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6587
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6588
    aView propertyChange
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6589
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6590
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6591
resizeRequestView:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6592
    "ignored for now"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6593
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6594
    "/ aView resizeRequest
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6595
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6596
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6597
selectionClear:selectionID view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6598
    "OBSOLETE - this will vanish"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6599
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6600
    "sent when another X-client has created a selection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6601
     This is a very X-specific mechanism."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6602
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6603
    "/
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6604
    "/ workaround a bug in olvwm: it clears selections
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6605
    "/ on window raise.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6606
    "/ In this case, keep my last own selection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6607
    "/
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6608
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6609
    self setLastCopyBuffer:(self getCopyBuffer).
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6610
    self setCopyBuffer:nil
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6611
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6612
    "/ noone is interested in that ...
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6613
    "/ aView selectionClear:selectionID
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6614
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6615
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6616
selectionNotify:propertyID target:targetID selection:selectionID from:requestorID view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6617
    "sent when the server returns an answer from a request for a selection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6618
     This is a very X-specific mechanism."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6619
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6620
    |s sensor|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6621
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6622
    propertyID == 0 ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6623
	"invalid olvwm behavior"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6624
	s := self getLastCopyBuffer
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6625
    ] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6626
	targetID == (self atomIDOf:#STRING) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6627
	    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6628
	     a returned string
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6629
	    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6630
	    s := self getTextProperty:propertyID from:requestorID.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6631
	    s notNil ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6632
		(s endsWith:Character cr) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6633
		    s := s asStringCollection copyWith:''
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6634
		]
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6635
	    ]
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6636
	] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6637
	    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6638
	     a returned object
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6639
	    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6640
	    s := self getObjectProperty:propertyID from:requestorID.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6641
	].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6642
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6643
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6644
    s notNil ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6645
	(sensor := aView sensor) notNil ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6646
	    sensor pasteFromClipBoard:s view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6647
	] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6648
	    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6649
	     if there is no sensor ...
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6650
	    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6651
	    aView pasteFromClipBoard:s
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6652
	]
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6653
    ]
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6654
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6655
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6656
selectionRequest:propertyID target:targetID selection:selectionID time:t from:windowID view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6657
    "sent by some other X-client to ask for the selection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6658
     This is a very X-specific mechanism."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6659
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6660
    |o s stream stringAtom|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6661
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6662
    targetID == (self atomIDOf:#LENGTH) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6663
	"/
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6664
	"/ the other one wants to know the size of our selection ...
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6665
	"/
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6666
	s := self selectionAsString.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6667
	self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6668
	    setLengthProperty:propertyID 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6669
	    value:s size 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6670
	    for:windowID.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6671
	self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6672
	    sendSelectionNotifySelection:selectionID
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6673
	    property:propertyID
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6674
	    target:targetID
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6675
	    time:t
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6676
	    from:aView id
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6677
	    to:windowID.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6678
	^ self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6679
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6680
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6681
    stringAtom := self atomIDOf:#STRING.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6682
    (targetID == stringAtom or:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6683
     targetID == (self atomIDOf:#'COMPOUND_TEXT')]) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6684
	"/
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6685
	"/ the other view wants the selection as string
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6686
	"/
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6687
	s := self selectionAsString.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6688
	self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6689
	    sendSelection:s 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6690
	    selection:primaryAtom
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6691
	    property:propertyID 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6692
	    target:stringAtom           "/ targetID
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6693
	    time:t
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6694
	    from:windowID
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6695
	    to:windowID.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6696
	^ self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6697
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6698
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6699
"/    (targetID == (self atomIDOf:#'TARGETS')) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6700
"/"/ TODO: implement this to avoid netscape paste-delay.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6701
"/"/
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6702
"/        ^ self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6703
"/    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6704
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6705
    (targetID == (self atomIDOf:#'ST_OBJECT')) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6706
	"/
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6707
	"/ send the selection in binaryStore format
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6708
	"/ (assuming, that the other view knows how to handle it)
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6709
	"/
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6710
	o := self getCopyBuffer.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6711
	stream := WriteStream on:(ByteArray new:200).
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6712
	o storeBinaryOn:stream.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6713
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6714
	^ self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6715
	    sendSelection:(stream contents) 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6716
	    selection:primaryAtom
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6717
	    property:propertyID 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6718
	    target:targetID 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6719
	    time:t
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6720
	    from:windowID 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6721
	    to:windowID
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6722
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6723
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6724
    "Created: / 17.6.1998 / 19:33:10 / cg"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6725
    "Modified: / 17.6.1998 / 20:24:40 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  6726
! !
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6727
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6728
!XWorkstation methodsFor:'event sending'!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6729
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  6730
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
  6731
    "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
  6732
     The client message gets message_type and msgFormat as specified by
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6733
     the arguments. The additional data arguments specify up to
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6734
     5 longWords of user data; each may be an integer or nil.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6735
     It is passed transparently in the events data field.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6736
     See XProtocol specification for more details."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6737
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6738
    "/ Event.xclient.type              = ClientMessage;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6739
    "/ Event.xclient.display           = dpy;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6740
    "/ Event.xclient.message_type      = msgType;
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  6741
    "/ Event.xclient.format            = msgFormat;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6742
    "/ Event.xclient.window            = targetWindowID;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6743
    "/ Event.xclient.data.l[0]         = d1
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6744
    "/ Event.xclient.data.l[1]         = d2
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6745
    "/ Event.xclient.data.l[2]         = d3
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6746
    "/ Event.xclient.data.l[3]         = d4
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6747
    "/ Event.xclient.data.l[4]         = d5
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6748
    "/
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6749
    "/ XSendEvent(dpy,DispatchWindow,True,NoEventMask,&Event);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6750
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6751
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6752
%{  
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6753
    int type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6754
    int state;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6755
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6756
    if (ISCONNECTED
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6757
     && __isInteger(msgType)
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  6758
     && __isInteger(msgFormat)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6759
     && (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6760
	Display *dpy = myDpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6761
	XEvent ev;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6762
	Status result;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6763
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6764
	if (__isInteger(d1)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6765
	    ev.xclient.data.l[0] = __longIntVal(d1);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6766
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6767
	    if (__isExternalAddress(d1)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6768
		ev.xclient.data.l[0] = (int)__externalAddressVal(d1);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6769
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6770
		ev.xclient.data.l[0] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6771
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6772
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6773
	if (__isInteger(d2)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6774
	    ev.xclient.data.l[1] = __longIntVal(d2);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6775
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6776
	    if (__isExternalAddress(d2)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6777
		ev.xclient.data.l[1] = (int)__externalAddressVal(d2);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6778
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6779
		ev.xclient.data.l[1] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6780
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6781
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6782
	if (__isInteger(d3)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6783
	    ev.xclient.data.l[2] = __longIntVal(d3);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6784
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6785
	    if (__isExternalAddress(d3)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6786
		ev.xclient.data.l[2] = (int)__externalAddressVal(d3);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6787
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6788
		ev.xclient.data.l[2] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6789
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6790
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6791
	if (__isInteger(d4)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6792
	    ev.xclient.data.l[3] = __longIntVal(d4);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6793
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6794
	    if (__isExternalAddress(d4)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6795
		ev.xclient.data.l[3] = (int)__externalAddressVal(d4);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6796
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6797
		ev.xclient.data.l[3] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6798
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6799
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6800
	if (__isInteger(d5)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6801
	    ev.xclient.data.l[4] = __longIntVal(d5);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6802
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6803
	    if (__isExternalAddress(d5)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6804
		ev.xclient.data.l[4] = (int)__externalAddressVal(d5);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6805
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6806
		ev.xclient.data.l[4] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6807
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6808
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6809
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6810
	if (__isExternalAddress(targetWindowID)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6811
	    ev.xclient.window = __WindowVal(targetWindowID);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6812
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6813
	    ev.xclient.window = (Window)__longIntVal(targetWindowID);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6814
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6815
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6816
	ev.xclient.type              = ClientMessage;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6817
	ev.xclient.display           = dpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6818
	ev.xclient.message_type      = __longIntVal(msgType);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6819
	ev.xclient.format            = __longIntVal(msgFormat);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6820
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6821
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6822
	result = XSendEvent(dpy, ev.xclient.window, True, NoEventMask , &ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6823
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6824
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6825
	if ((result == BadValue) || (result == BadWindow)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6826
	    DPRINTF(("bad status in sendClientEvent\n"));
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6827
	    RETURN ( false )
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6828
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6829
	RETURN (true)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6830
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6831
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6832
    self primitiveFailedOrClosedConnection.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6833
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6834
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6835
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6836
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
  6837
    "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
  6838
     TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6839
     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
  6840
     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
  6841
     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
  6842
     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
  6843
     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
  6844
     (not very user friendly)"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6845
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6846
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6847
%{ 
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6848
    int type;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6849
    int state;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6850
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6851
    if (__isSmallInteger(stateMask)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6852
	state = __intVal(stateMask);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6853
    } else {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6854
	state = 0;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6855
    }
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6856
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6857
    if (ISCONNECTED
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6858
     && __isSmallInteger(xPos) && __isSmallInteger(yPos)
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6859
     && (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr))
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6860
     && (__isExternalAddress(targetId) || __isInteger(targetId))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6861
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6862
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6863
	XEvent ev;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6864
	Window target;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6865
	Status result;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6866
	KeySym keySym, *syms;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6867
	int screen = __intVal(__INST(screen));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6868
	char s[2];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6869
	int nSyms;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6870
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6871
	if ((typeSymbol == @symbol(keyPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6872
	 || (typeSymbol == @symbol(keyRelease))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6873
	    if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6874
		keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6875
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6876
		if (__isCharacter(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6877
		    s[0] = __intVal(__characterVal(keySymCodeOrButtonNr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6878
		    s[1] = '\0';
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6879
		    keySym = XStringToKeysym(s);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6880
		} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6881
		    keySym = (KeySym) __intVal(keySymCodeOrButtonNr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6882
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6883
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6884
	    ev.xkey.keycode = XKeysymToKeycode(dpy, keySym);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6885
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6886
	    if (stateMask == nil) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6887
		/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6888
		 * get the modifier from the keySym
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6889
		 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6890
		nSyms = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6891
		syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6892
		if (syms) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6893
		    int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6894
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6895
		    for (i=0; i<nSyms; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6896
			if (syms[i] == keySym) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6897
#ifdef MODIFIERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6898
			    printf("modifier-index is %d\n", i);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6899
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6900
			    if (i) state = (1 << (i-1));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6901
			    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6902
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6903
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6904
		    XFree(syms);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6905
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6906
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6907
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6908
	    if ((typeSymbol == @symbol(buttonPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6909
	     || (typeSymbol == @symbol(buttonRelease))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6910
		if (__isSmallInteger(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6911
		    ev.xbutton.button = __intVal(keySymCodeOrButtonNr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6912
		} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6913
		    ev.xbutton.button = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6914
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6915
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6916
		DPRINTF(("invalid sendEvent typeSymbol\n"));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6917
		RETURN (false);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6918
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6919
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6920
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6921
	if (typeSymbol == @symbol(keyPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6922
	    ev.xany.type = KeyPress;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6923
	else if (typeSymbol == @symbol(keyRelease))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6924
	    ev.xany.type = KeyRelease;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6925
	else if (typeSymbol == @symbol(buttonPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6926
	    ev.xany.type = ButtonPress;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6927
	else if (typeSymbol == @symbol(buttonRelease))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6928
	    ev.xany.type = ButtonRelease;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6929
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6930
	if (__isExternalAddress(targetId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6931
	    target = __WindowVal(targetId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6932
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6933
	    target = (Window) __longIntVal(targetId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6934
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6935
	ev.xkey.window = target;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6936
	ev.xkey.same_screen = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6937
	ev.xkey.subwindow = 0;
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  6938
	ev.xkey.root = RootWindow(dpy, screen);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6939
	ev.xkey.x = __intVal(xPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6940
	ev.xkey.y = __intVal(yPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6941
	ev.xkey.state = state;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6942
	ev.xkey.time = CurrentTime;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6943
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6944
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6945
	result = XSendEvent(dpy, target, False, 0 , &ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6946
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6947
	if ((result == BadValue) || (result == BadWindow)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6948
	    DPRINTF(("bad status\n"));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6949
	    RETURN ( false )
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6950
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6951
	RETURN (true)
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6952
    }
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6953
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6954
    self primitiveFailedOrClosedConnection.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6955
    ^ false
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6956
! !
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6957
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6958
!XWorkstation methodsFor:'font stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6959
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6960
createFontFor:aFontName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6961
    "a basic method for X-font allocation; this method allows
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6962
     any font to be aquired (even those not conforming to
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6963
     standard naming conventions, such as cursor, fixed or k14)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6964
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6965
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6966
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6967
%{  /* UNLIMITEDSTACK */
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6968
    /* xxUNLIMITEDSTACK xxSTACK:100000 */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6969
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6970
    XFontStruct *newFont;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6971
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6972
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6973
     && __isNonNilObject(aFontName)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6974
     && (__qIsString(aFontName) || __qIsSymbol(aFontName))) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6975
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6976
	ENTER_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6977
	newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6978
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  6979
#ifdef COUNT_RESOURCES
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6980
	if (newFont)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6981
	    __cnt_font++;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6982
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6983
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6984
	RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6985
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6986
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6987
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6988
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6989
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6990
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6991
decomposeXFontName:aString into:aBlock
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6992
    "extract family, face, style and size from an
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6993
     X-font name 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6994
     (-brand-family-face-style-moreStyle--height-size-res-res-?-??-coding); 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6995
     evaluate aBlock with these"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6996
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6997
    |origin family face style moreStyle skip fheight size
1566
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  6998
     resX resY x1 x2 registry encoding coding start end |
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6999
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7000
    aString isNil ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7001
    (aString startsWith:'-') ifFalse:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7002
	"
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7003
	 take care for ill-named fonts (i.e. pre Rel4 fonts)
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7004
	"
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7005
	('*-*-[0-9]*' match:aString) ifTrue:[
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7006
	    end := aString indexOf:$- startingAt:1.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7007
	    family := aString copyFrom:1 to:(end - 1).
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7008
	    start := end + 1.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7009
	    end := aString indexOf:$- startingAt:start.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7010
	    style := aString copyFrom:start to:(end - 1).
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7011
	    start := end + 1.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7012
	    size := aString copyFrom:start.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7013
	    size := (Number readFromString:size onError:[^false]).
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7014
	    aBlock value:family value:nil value:style value:size value:nil.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7015
	    ^ true.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7016
	].
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7017
	('*-[0-9]*' match:aString) ifTrue:[
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7018
	    "
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7019
	     something like lucidasans-24
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7020
	    "
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7021
	    end := aString indexOf:$- startingAt:1.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7022
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7023
	    family := aString copyFrom:1 to:(end - 1).
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7024
	    start := end + 1.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7025
	    size := aString copyFrom:start.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7026
	    size := (Number readFromString:size onError:[^false]).
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7027
	    aBlock value:family value:nil value:nil value:size value:nil.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7028
	    ^ true.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7029
	].
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7030
	aBlock value:aString value:nil value:nil value:nil value:nil.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7031
	^ true.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7032
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7033
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7034
    end := aString indexOf:$- startingAt:2.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7035
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7036
    origin := aString copyFrom:2 to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7037
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7038
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7039
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7040
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7041
    family := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7042
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7043
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7044
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7045
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7046
    face := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7047
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7048
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7049
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7050
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7051
    style := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7052
    (style = 'o') ifTrue:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7053
	style := 'oblique'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7054
    ] ifFalse:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7055
	(style = 'i') ifTrue:[
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7056
	    style := 'italic'
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7057
	] ifFalse:[
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7058
	    (style = 'r') ifTrue:[
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7059
		style := 'roman'
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7060
	    ]
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7061
	]
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7064
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7065
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7066
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7067
    moreStyle := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7068
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7069
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7070
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7071
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7072
    skip := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7073
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7074
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7075
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7076
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7077
    fheight := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7078
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7079
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7080
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7081
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7082
    size := aString copyFrom:start to:(end - 1).
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
  7083
    size := (Number readFromString:size onError:[^ false]) / 10.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7084
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7085
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7086
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7087
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7088
    resX := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7089
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7090
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7091
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7092
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7093
    resY := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7094
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7095
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7096
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7097
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7098
    x1 := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7099
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7100
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7101
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7102
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7103
    x2 := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7104
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7105
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7106
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7107
    (end == 0) ifTrue:[^ false].
1566
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  7108
    registry := aString copyFrom:start to:(end - 1).
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  7109
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  7110
    encoding := aString copyFrom:end + 1.
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  7111
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  7112
    coding := registry , '-' , encoding.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7113
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7114
    (moreStyle ~= 'normal' and:[moreStyle ~= '']) ifTrue:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7115
	style := style, '-', moreStyle.
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7116
    ].
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7117
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7118
    aBlock value:family value:face value:style value:size value:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7119
    ^ true
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7120
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7121
    "Modified: 4.7.1996 / 11:12:25 / stefan"
1566
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  7122
    "Modified: 10.4.1997 / 09:45:36 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7123
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7124
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7125
encodingInfoOf:aFontId
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7126
    "the fonts encoding - if the font does not provide that info,
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7127
     return nil (and assume #ascii, which is a subset of #iso8859)."
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7128
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7129
    |fullName fontName registry encoding charSetCollections|
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7130
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7131
%{ 
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7132
    XFontStruct *f;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7133
    XFontProp *prop;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7134
    int n;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7135
    char *cp;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7136
    Atom fontAtom, registryAtom, encodingAtom, charSetCollAtom;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7137
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7138
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7139
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7140
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7141
	registryAtom = XInternAtom(dpy, "CHARSET_REGISTRY", True);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7142
	encodingAtom = XInternAtom(dpy, "CHARSET_ENCODING", True);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7143
	charSetCollAtom = XInternAtom(dpy, "CHARSET_COLLECTIONS", True);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7144
	fontAtom = XInternAtom(dpy, "FONT", True);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7145
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7146
	if (__isExternalAddress(aFontId)) {
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7147
        
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7148
	    f = __FontVal(aFontId);
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7149
	    if (f) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7150
		n = f->n_properties;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7151
		prop = f->properties;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7152
		if (prop) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7153
		    while (n--) {
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7154
#ifdef SUPERDEBUG
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7155
			cp = XGetAtomName(dpy, prop->name);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7156
			printf("%s (%d) -> %d\n", cp, prop->name, prop->card32);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7157
			XFree(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7158
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7159
			if (prop->name == XA_FULL_NAME) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7160
			    cp = XGetAtomName(dpy, prop->card32);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7161
			    if (cp) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7162
				fullName = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7163
#ifdef SUPERDEBUG
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7164
				printf("   FULL_NAME -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7165
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7166
				XFree(cp);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7167
			    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7168
			} else if (prop->name == fontAtom) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7169
			    cp = XGetAtomName(dpy, prop->card32);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7170
			    if (cp) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7171
				fontName = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7172
#ifdef SUPERDEBUG
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7173
				printf("   FONT -> %s\n", cp);
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7174
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7175
				XFree(cp);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7176
			    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7177
			} else if (prop->name == encodingAtom) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7178
			    cp = XGetAtomName(dpy, prop->card32);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7179
			    if (cp) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7180
				encoding = __MKSTRING(cp);
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7181
#ifdef SUPERDEBUG
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7182
				printf("   ENCODING -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7183
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7184
				XFree(cp);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7185
			    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7186
			} else if (prop->name == registryAtom) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7187
			    cp = XGetAtomName(dpy, prop->card32);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7188
			    if (cp) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7189
				registry = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7190
#ifdef SUPERDEBUG
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7191
				printf("   REGISTRY -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7192
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7193
				XFree(cp);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7194
			    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7195
			} else if (prop->name == charSetCollAtom) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7196
			    cp = XGetAtomName(dpy, prop->card32);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7197
			    if (cp) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7198
				charSetCollections = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7199
#ifdef SUPERDEBUG
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7200
				printf("   CHARSET_COLLECTIONS -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7201
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7202
				XFree(cp);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7203
			    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7204
			}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7205
			prop++;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7206
		    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7207
		}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7208
	    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7209
	}
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7210
    }
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7211
%}.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7212
    ^ Array with:registry with:encoding with:charSetCollections with:fontName with:fullName
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7213
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7214
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7215
encodingOf:aFontId
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7216
    "the fonts encoding - if the font does not provide that info,
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7217
     return nil (and assume #ascii, which is a subset of #iso8859)."
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7218
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7219
    |info fullName fontName registry encoding charSetCollections|
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7220
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7221
    info := self encodingInfoOf:aFontId.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7222
    registry := info at:1.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7223
    encoding := info at:2.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7224
    charSetCollections := info at:3.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7225
    fontName := info at:4.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7226
    fullName := info at:5.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7227
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7228
    ^ self
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7229
	extractEncodingFromRegistry:registry 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7230
	encoding:encoding 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7231
	charSetCollections:charSetCollections
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7232
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7233
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7234
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7235
    "this is pure magic ..."
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7236
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7237
    |enc charSets|
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7238
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7239
    (registry notNil and:[registry notEmpty]) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7240
	enc := registry asLowercase asSymbol.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7241
    ] ifFalse:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7242
	(encoding notNil and:[encoding notEmpty]) ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7243
	    enc := encoding asLowercase asSymbol
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7244
	] ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7245
	    charSets := charSetCollections.    
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7246
	    (charSets notNil and:[charSets notEmpty]) ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7247
		charSets := charSets asUppercase asCollectionOfWords.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7248
		(charSets includes:'ISO8859-1') ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7249
		    enc := #iso8859
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7250
		] ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7251
		    (charSets includes:'ISO8859') ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7252
			enc := #iso8859
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7253
		    ] ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7254
			(charSets includes:'ASCII') ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7255
			    enc := #ascii
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7256
			] ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7257
			    (charSets includes:'ADOBE-STANDARD') ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7258
				enc := #iso8859
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7259
			    ]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7260
			]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7261
		    ]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7262
		]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7263
	    ] 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7264
	]
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7265
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7266
    ^  enc
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7267
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7268
    "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
  7269
    "Modified: 17.4.1996 / 17:22:35 / cg"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7270
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7271
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7272
flushListOfAvailableFonts
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7273
    "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
  7274
     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
  7275
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7276
    listOfXFonts := nil
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7277
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7278
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7279
     Display flushListOfAvailableFonts.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7280
     Display listOfAvailableFonts
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7281
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7282
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7283
    "Modified: 27.9.1995 / 10:54:47 / stefan"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7284
    "Created: 20.2.1996 / 22:55:52 / cg"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7285
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7286
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7287
fontMetricInfoOf:fontId 
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7288
    "evaluate aBlock, passing a fonts metrics as arguments"
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7289
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7290
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7291
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7292
    |encoding avgAscent avgDescent
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7293
     maxAscent maxDescent minWidth maxWidth avgWidth
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7294
     res resX resY|
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7295
994
7e720b29c838 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  7296
%{
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7297
    XFontStruct *f;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7298
    int len;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7299
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7300
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7301
	if (__isExternalAddress(fontId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7302
	    f = __FontVal(fontId);
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7303
	    if (f) {
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7304
#ifdef NOTDEF
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7305
		char *cp;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7306
		XFontProp *prop;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7307
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7308
		n = f->n_properties;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7309
		prop = f->properties;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7310
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7311
		if (prop) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7312
		    while (n--) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7313
			if (prop->name == RESOLUTION_X) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7314
			    resX = __MKSMALLINT(prop->card32);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7315
			} else if (prop->name == RESOLUTION_Y) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7316
			    resY = __MKSMALLINT(prop->card32);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7317
			} else if (prop->name == RESOLUTION) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7318
			    res = __MKSMALLINT(prop->card32);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7319
			}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7320
			prop++;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7321
		    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7322
		}
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7323
#endif
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7324
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7325
		avgAscent = __MKSMALLINT(f->ascent);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7326
		avgDescent = __MKSMALLINT(f->descent);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7327
		maxAscent = __MKSMALLINT(f->max_bounds.ascent);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7328
		maxDescent = __MKSMALLINT(f->max_bounds.descent);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7329
		minWidth = __MKSMALLINT(f->min_bounds.width);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7330
		maxWidth = __MKSMALLINT(f->max_bounds.width);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7331
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7332
		ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7333
		len = XTextWidth(f, " ", 1);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7334
		LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7335
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7336
		avgWidth = __MKSMALLINT( len );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7337
	    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7338
	}
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7339
    }
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7340
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7341
    avgAscent == nil ifTrue:[
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7342
	self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7343
	^ nil
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7344
    ].
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7345
    ^ Array 
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7346
	with:avgAscent
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7347
	with:avgDescent
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7348
	with:maxAscent
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7349
	with:maxDescent
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7350
	with:minWidth
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7351
	with:maxWidth
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7352
	with:avgWidth
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7353
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7354
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7355
fontMetricsOf:fontId into:aBlock
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7356
    "evaluate aBlock, passing a fonts metrics as arguments"
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7357
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7358
    |info encoding avgAscent avgDescent
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7359
     maxAscent maxDescent minWidth maxWidth avgWidth|
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7360
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7361
    info := self fontMetricInfoOf:fontId.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7362
    avgAscent := info at:1.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7363
    avgDescent := info at:2.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7364
    maxAscent  := info at:3.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7365
    maxDescent := info at:4.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7366
    minWidth   := info at:5.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7367
    maxWidth   := info at:6.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7368
    avgWidth   := info at:7.
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7369
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7370
    encoding := self encodingOf:fontId.
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7371
    aBlock value:encoding
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7372
	   value:avgAscent
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7373
	   value:avgDescent
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7374
	   value:maxAscent
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7375
	   value:maxDescent
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7376
	   value:minWidth
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7377
	   value:maxWidth
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7378
	   value:avgWidth
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7379
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7380
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7381
fontResolutionOf:fontId
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7382
    "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
  7383
     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
  7384
     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
  7385
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7386
    |res resX resY|
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7387
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7388
%{
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7389
    XFontStruct *f;
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7390
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7391
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7392
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7393
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7394
	if (__isExternalAddress(fontId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7395
	    f = __FontVal(fontId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7396
	    if (f) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7397
		char *cp;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7398
		XFontProp *prop;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7399
		Atom resolutionXAtom, resolutionYAtom;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7400
		int n;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7401
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7402
		n = f->n_properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7403
		prop = f->properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7404
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7405
		if (prop) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7406
		    resolutionXAtom = XInternAtom(dpy, "RESOLUTION_X", True);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7407
		    resolutionYAtom = XInternAtom(dpy, "RESOLUTION_Y", True);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7408
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7409
		    while (n--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7410
			if (prop->name == resolutionXAtom) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7411
			    resX = __MKSMALLINT(prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7412
			} else if (prop->name == resolutionYAtom) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7413
			    resY = __MKSMALLINT(prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7414
			} else if (prop->name == XA_RESOLUTION) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7415
			    res = __MKSMALLINT(prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7416
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7417
			prop++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7418
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7419
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7420
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7421
	}
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7422
    }
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7423
%}.
1046
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  7424
    (resX notNil and:[resY notNil]) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7425
	^ resX @ resY
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7426
    ].
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7427
    res notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7428
	^ res @ res
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7429
    ].
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7430
    ^ self resolution
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7431
!
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7432
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7433
fullNameOf:aFontId
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7434
    "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
  7435
     used for user feed-back (for example: in the fontPanel).
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7436
     If the display/font do not provide that info, return nil."
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7437
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7438
    |fullName fontName|
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7439
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7440
%{ 
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7441
    XFontStruct *f;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7442
    XFontProp *prop;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7443
    int n;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7444
    char *cp;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7445
    Atom fontAtom;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7446
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7447
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7448
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7449
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7450
	fontAtom = XInternAtom(dpy, "FONT", True);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7451
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7452
	if (__isExternalAddress(aFontId)) {
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7453
        
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7454
	    f = __FontVal(aFontId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7455
	    if (f) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7456
		n = f->n_properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7457
		prop = f->properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7458
		if (prop) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7459
		    while (n--) {
1049
59cc92776676 oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
  7460
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7461
			cp = XGetAtomName(dpy, prop->name);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7462
			printf("%s (%d) -> %d\n", cp, prop->name, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7463
			XFree(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7464
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7465
			if (prop->name == XA_FULL_NAME) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7466
			    cp = XGetAtomName(dpy, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7467
			    if (cp) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7468
				fullName = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7469
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7470
				printf("   FULL_NAME -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7471
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7472
				XFree(cp);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7473
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7474
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7475
			if (prop->name == fontAtom) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7476
			    cp = XGetAtomName(dpy, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7477
			    if (cp) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7478
				fontName = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7479
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7480
				printf("   FONT -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7481
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7482
				XFree(cp);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7483
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7484
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7485
			prop++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7486
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7487
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7488
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7489
	}
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7490
    }
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7491
%}.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7492
    (fullName notNil and:[fullName notEmpty]) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7493
	^ fullName
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7494
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7495
    ^ fontName
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7496
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7497
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7498
getAvailableFontsMatching:pattern
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7499
    "return an Array filled with font names matching aPattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7500
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7501
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7502
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7503
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7504
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7505
    int nnames = 1500;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7506
    int available = nnames + 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7507
    char **fonts;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7508
    OBJ arr, str;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7509
    int i;
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
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7512
	if (__isString(pattern)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7513
	    for (;;) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7514
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7515
		fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7516
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7517
		if ((fonts == NULL) || (available < nnames)) break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7518
		XFreeFontNames(fonts);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7519
		nnames = available * 2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7520
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7521
	    if (fonts == NULL) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7522
		RETURN ( nil );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7523
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7524
	    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7525
	     * now, that we know the number of font names,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7526
	     * create the array ...
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7527
	     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7528
	    arr = __ARRAY_NEW_INT(available);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7529
	    if (! arr) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7530
		RETURN (nil);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7531
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7532
	    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7533
	     * ... and fill it
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7534
	     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7535
	    for (i=0; i<available; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7536
		__PROTECT__(arr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7537
		str = __MKSTRING(fonts[i]);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7538
		__UNPROTECT__(arr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7539
		__ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7540
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7541
	    RETURN (arr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7542
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7543
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7544
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7545
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7546
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7547
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7548
getDefaultFont
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7549
    "return a default font id - used when class Font cannot
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7550
     find anything usable"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7551
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7552
     ^ self createFontFor:'fixed'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7553
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7554
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7555
getFontWithFamily:familyString face:faceString
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7556
	    style:styleArgString size:sizeArg encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7557
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7558
    "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
  7559
     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
  7560
     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
  7561
     can be aquired that way."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7562
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7563
    |styleString theName theId xlatedStyle 
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7564
     id spacing encodingMatch registryMatch idx|
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7565
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7566
    styleString := styleArgString.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7567
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7568
    "special: if face is nil, allow access to X-fonts"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7569
    faceString isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7570
	sizeArg notNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7571
	    theName := familyString , '-' , sizeArg printString
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7572
	] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7573
	    theName := familyString
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7574
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7575
	theName isNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7576
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7577
	     mhmh - fall back to the default font
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7578
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7579
	    theName := 'fixed'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7580
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7581
	theId := self createFontFor:theName.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7582
	theId isNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7583
	    theId := self getDefaultFont
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7584
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7585
	^ theId
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7586
    ].
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7587
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7588
    "/ 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
  7589
    "/ in style
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7590
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  7591
    (styleString notNil
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  7592
     and:[(styleString endsWith:'-narrow') 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7593
	  or:[styleString endsWith:'-semicondensed']]) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7594
	|i|
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7595
	i := styleString lastIndexOf:$-.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7596
	spacing := styleString copyFrom:(i+1).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7597
	styleString := styleString copyTo:(i-1).
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7598
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7599
	spacing := 'normal'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7600
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7601
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7602
    xlatedStyle := styleString.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7603
    xlatedStyle notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7604
	xlatedStyle := xlatedStyle first asString
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7605
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7606
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7607
    encodingMatch := encoding.
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7608
    registryMatch := '*'.
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7609
    encoding isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7610
	encodingMatch := '*'.
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7611
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7612
	idx := encoding indexOf:$-.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7613
	idx ~~ 0 ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7614
	    encodingMatch := encoding copyTo:idx - 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7615
	    registryMatch := encoding copyFrom:idx + 1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7616
	].
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7617
    ].
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7618
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7619
    id := self 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7620
	    getFontWithFoundry:'*'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7621
	    family:familyString asLowercase
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7622
	    weight:faceString
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7623
	    slant:xlatedStyle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7624
	    spacing:spacing
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7625
	    pixelSize:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7626
	    size:sizeArg 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7627
	    registry:encodingMatch
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7628
	    encoding:registryMatch.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7629
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7630
    id isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7631
	(encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7632
	    "/ too stupid: encodings come in both cases
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7633
	    "/ and X does not ignore case
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7634
	    "/
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7635
	    id := self 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7636
		    getFontWithFoundry:'*'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7637
		    family:familyString asLowercase
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7638
		    weight:faceString
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7639
		    slant:xlatedStyle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7640
		    spacing:spacing
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7641
		    pixelSize:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7642
		    size:sizeArg 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7643
		    registry:encodingMatch asUppercase
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7644
		    encoding:registryMatch.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7645
	    id isNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7646
		id := self 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7647
			getFontWithFoundry:'*'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7648
			family:familyString asLowercase
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7649
			weight:faceString
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7650
			slant:xlatedStyle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7651
			spacing:spacing
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7652
			pixelSize:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7653
			size:sizeArg 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7654
			registry:encodingMatch asLowercase
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7655
			encoding:registryMatch.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7656
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7657
	]
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7658
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7659
    ^ id
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7660
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7661
    "Modified: 4.7.1996 / 11:38:47 / stefan"
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7662
    "Modified: 10.4.1997 / 19:20:06 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7663
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7664
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7665
getFontWithFoundry:foundry family:family weight:weight
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7666
	      slant:slant spacing:spc pixelSize:pSize size:size 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7667
	      registry:registry encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7668
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7669
    "get the specified font, if not available, return nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7670
     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
  7671
     use this entry.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7672
     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
  7673
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7674
     foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7675
     family:  'helvetica' 'courier' 'times' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7676
     weight:  'bold' 'medium' 'demi' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7677
     slant:   'r(oman)' 'i(talic)' 'o(blique)'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7678
     spacing: 'narrow' 'normal' semicondensed' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7679
     pixelSize: 16,18 ... usually left empty
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7680
     size:      size in point (1/72th of an inch)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7681
     registry:  iso8859, sgi ... '*'
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7682
     encoding:  registry specific encoding (usually '*')
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7683
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7684
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7685
    |theName sizeMatch 
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7686
     foundryMatch familyMatch weightMatch slantMatch spcMatch
1099
b236304804f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1098
diff changeset
  7687
     pSizeMatch registryMatch encodingMatch|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7688
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7689
    "this works only on 'Release >= 3' - X-servers"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7690
    "name is:
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7691
	-foundry-family    -weight -slant-
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7692
	 sony    helvetica bold     r
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7693
	 adobe   courier   medium   i
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7694
	 msic    fixed              o
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7695
	 ...     ...
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7696
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7697
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7698
    size isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7699
	sizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7700
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7701
	sizeMatch := size printString , '0'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7702
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7703
    foundry isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7704
	foundryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7705
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7706
	foundryMatch := foundry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7707
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7708
    family isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7709
	familyMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7710
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7711
	familyMatch := family
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7712
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7713
    weight isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7714
	weightMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7715
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7716
	weightMatch := weight
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7717
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7718
    slant isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7719
	slantMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7720
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7721
	slantMatch := slant
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7722
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7723
    spc isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7724
	spcMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7725
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7726
	spcMatch := spc
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7727
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7728
    pSize isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7729
	pSizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7730
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7731
	pSizeMatch := pSize printString
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7732
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7733
    registry isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7734
	registryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7735
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7736
	registryMatch := registry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7737
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7738
    encoding isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7739
	encodingMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7740
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7741
	encodingMatch := encoding
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7742
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7743
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7744
    theName := ('-' , foundryMatch,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7745
		'-' , familyMatch,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7746
		'-' , weightMatch ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7747
		'-' , slantMatch , 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7748
		'-' , spcMatch ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7749
		'-*' ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7750
		'-' , pSizeMatch ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7751
		'-' , sizeMatch ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7752
		'-*-*-*-*' ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7753
		'-' , registryMatch ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7754
		'-' , encodingMatch).
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7755
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 652
diff changeset
  7756
"/  Transcript showCR:theName; endEntry.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7757
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7758
    ^ self createFontFor:theName.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7759
        
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7760
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7761
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7762
     Display getFontWithFoundry:'*'
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7763
			 family:'courier'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7764
			 weight:'medium'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7765
			  slant:'r'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7766
			spacing:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7767
		      pixelSize:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7768
			   size:13
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7769
		       registry:'iso8859'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7770
		       encoding:'*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7771
    "
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7772
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7773
    "Modified: 10.4.1997 / 19:15:44 / cg"
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7776
listOfAvailableFonts
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7777
    "return a list with all available fonts on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7778
     Since this takes a long time, keep the result of the query for the
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7779
     next time. The elements of the returned collection are instances of
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7780
     FontDescription."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7781
392
caf4452ec3dd merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
  7782
    |"stream aName fntDescr" names|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7783
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7784
    listOfXFonts isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7785
"/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7786
"/ old code; using a pipe to xlsfonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7787
"/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7788
"/      stream := PipeStream readingFrom:'xlsfonts ''*'''.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7789
"/      stream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7790
"/      listOfXFonts := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7791
"/      [stream atEnd] whileFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7792
"/          aName := stream nextLine.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7793
"/          aName notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7794
"/          self decomposeXFontName:aName into:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7795
"/                  [:family :face :style :size :coding |
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7796
"/                      family notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7797
"/                          fntDescr := FontDescription
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7798
"/                                          family:family
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7799
"/                                          face:face
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7800
"/                                          style:style
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7801
"/                                          size:size
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7802
"/                                          encoding:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7803
"/                          listOfXFonts add:fntDescr
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7804
"/                      ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7805
"/                  ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7806
"/          ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7807
"/      ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7808
"/      stream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7809
"/      "if xlsfont is broken ... (hey sco)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7810
"/      (listOfXFonts size == 0) ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7811
"/          listOfXFonts := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7812
"/      ] ifFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7813
"/          listOfXFonts sort:[:a :b | a family < b family].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7814
"/      ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7815
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7816
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7817
	"/ new code:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7818
	"/ use new primitive to get font names;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7819
	"/ this is much faster, and also works on systems where
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7820
	"/      a) xlsfonts is broken (sco)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7821
	"/      b) xlsfonts is not available (aix)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7822
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7823
	names := self getAvailableFontsMatching:'*'.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7824
	names isNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7825
	    "no names returned ..."
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7826
	    ^ nil
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7827
	].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7828
	listOfXFonts := names collect:[:aName |
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7829
				    |fntDescr|
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7830
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7831
				    (self decomposeXFontName:aName into:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7832
					[:family :face :style :size :coding |
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7833
					   family notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7834
					       fntDescr := FontDescription
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7835
							       family:family
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7836
							       face:face
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7837
							       style:style
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7838
							       size:size
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7839
							       encoding:coding.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7840
					   ] ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7841
					       fntDescr := FontDescription
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7842
							       name:aName
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7843
					   ]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7844
					]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7845
				    ) ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7846
					fntDescr := FontDescription name:aName.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7847
				    ].  
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7848
				    fntDescr
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7849
			    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7850
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7851
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7852
    ^ listOfXFonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7853
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7854
    "
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  7855
     Display listOfAvailableFonts.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  7856
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  7857
     Display getAvailableFontsMatching:'*'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7858
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7859
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7860
    "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
  7861
    "Modified: 17.4.1996 / 15:27:57 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7862
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7863
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7864
releaseFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7865
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7866
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7867
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7868
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7869
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7870
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  7871
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7872
	RETURN ( self );
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  7873
    }
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  7874
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  7875
    if (__isExternalAddress(aFontId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7876
	f = __FontVal(aFontId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7877
	if (f) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7878
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7879
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7880
	    XFreeFont(myDpy, f);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7881
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  7882
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7883
	    __cnt_font--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  7884
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7885
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7886
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7887
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7888
    }
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  7889
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7890
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7891
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7892
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7893
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7894
    "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
  7895
     on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7896
     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
  7897
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7898
    |sizes|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7899
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  7900
    sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7901
    (sizes notNil and:[sizes includes:0]) ifTrue:[
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  7902
	"special: in X11R5 and above, size 0 means:
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  7903
	 there are scaled versions in all sizes available"
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  7904
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  7905
	^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7906
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7907
    ^ sizes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7908
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7909
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7910
     Display sizesInFamily:'courier' face:'bold' style:'roman'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7911
    "
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  7912
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  7913
    "Created: 27.2.1996 / 01:38:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7914
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7915
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7916
widthOf:aString from:index1 to:index2 inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7917
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7918
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7919
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7920
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7921
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7922
    char *cp;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7923
    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
  7924
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7925
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7926
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  7927
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7928
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  7929
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7930
	if (__bothSmallInteger(index1, index2)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7931
	 && __isExternalAddress(aFontId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7932
	 && __isNonNilObject(aString)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7933
	    int lMax = __intVal(@global(XWorkstation:MaxStringLength));
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7934
	    f = __FontVal(aFontId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7935
	    if (! f) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7936
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7937
	    i1 = __intVal(index1) - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7938
	    cls = __qClass(aString);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7939
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7940
	    if (i1 >= 0) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7941
		i2 = __intVal(index2) - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7942
		if (i2 < i1) {
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  7943
		    RETURN ( __MKSMALLINT(0) );
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7944
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7945
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  7946
		cp = (char *) __stringVal(aString);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7947
		l = i2 - i1 + 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7948
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7949
		if ((cls == @global(String)) || (cls == @global(Symbol))) {
2011
47e72d42226b eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
  7950
		    n = __stringSize(aString);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7951
		    if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7952
			cp += i1;
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7953
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7954
			ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7955
			len = XTextWidth(f, cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7956
			LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7957
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7958
			RETURN ( __MKSMALLINT(len) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7959
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7960
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7961
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7962
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7963
		cp += nInstBytes;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7964
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7965
		if (__isBytes(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7966
		    n = __byteArraySize(aString) - nInstBytes;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7967
		    if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7968
			cp += i1;
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7969
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7970
			ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7971
			len = XTextWidth(f, cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7972
			LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7973
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7974
			RETURN ( __MKSMALLINT(len) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7975
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7976
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7977
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7978
		/* TWOBYTESTRINGS */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7979
		if (__isWords(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7980
		    n = (__byteArraySize(aString) - nInstBytes) / 2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7981
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7982
		    if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7983
			union {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7984
			    char b[2];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7985
			    unsigned short s;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7986
			} u;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7987
			int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7988
			XChar2b *cp2 = (XChar2b *)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7989
			int mustFree = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7990
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7991
			cp += (i1 * 2);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7992
			if (l > lMax) l = lMax;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7993
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7994
			/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7995
			 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7996
			 * X expects them MSB first
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7997
			 * convert as required
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7998
			 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7999
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8000
			u.s = 0x1234;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8001
			if (u.b[0] != 0x12) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8002
			    if (l <= NLOCALBUFFER) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8003
				cp2 = xlatebuffer;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8004
			    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8005
				cp2 = (XChar2b *)(malloc(l * 2));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8006
				mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8007
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8008
			    for (i=0; i<l; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8009
				cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8010
				cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8011
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8012
			    cp = (char *) cp2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8013
			}
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8014
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8015
			ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8016
			len = XTextWidth16(f, (XChar2b *)cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8017
			LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8018
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8019
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8020
			if (mustFree) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8021
			    free(cp2);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8022
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8023
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8024
			RETURN ( __MKSMALLINT(len) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8025
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8026
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8027
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8028
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8029
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8030
#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
  8031
fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8032
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8033
    self primitiveFailedOrClosedConnection.
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  8034
    ^ 0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8035
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8036
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8037
widthOf:aString inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8038
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8039
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8040
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8041
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8042
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8043
    char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8044
    int len, n;
447
9a58924e921b dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  8045
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8046
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8047
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  8048
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8049
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8050
    if (ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8051
	if (__isExternalAddress(aFontId)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8052
	 && __isNonNilObject(aString)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8053
	    int lMax = __intVal(@global(XWorkstation:MaxStringLength));
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8054
	    f = __FontVal(aFontId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8055
	    if (! f) goto fail;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8056
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8057
	    cls = __qClass(aString);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8058
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8059
	    cp = (char *) __stringVal(aString);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8060
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8061
	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8062
		n = __stringSize(aString);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8063
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8064
		ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8065
		len = XTextWidth(f, cp, n);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8066
		LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8067
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8068
		RETURN ( __MKSMALLINT(len) );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8069
	    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8070
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8071
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8072
	    cp += nInstBytes;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8073
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8074
	    if (__isBytes(aString)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8075
		n = __byteArraySize(aString) - nInstBytes;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8076
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8077
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8078
		ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8079
		len = XTextWidth(f, cp, n);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8080
		LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8081
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8082
		RETURN ( __MKSMALLINT(len) );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8083
	    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8084
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8085
	    /* TWOBYTESTRINGS */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8086
	    if (__isWords(aString)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8087
		union {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8088
		    char b[2];
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8089
		    unsigned short s;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8090
		} u;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8091
		int i;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8092
		XChar2b *cp2;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8093
		int mustFree = 0;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8094
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8095
		n = (__byteArraySize(aString) - nInstBytes) / 2;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8096
		if (n > lMax) n = lMax;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8097
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8098
		/*
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8099
		 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8100
		 * X expects them MSB first
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8101
		 * convert as required
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8102
		 */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8103
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8104
		u.s = 0x1234;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8105
		if (u.b[0] != 0x12) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8106
		    if (n <= NLOCALBUFFER) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8107
			cp2 = xlatebuffer;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8108
		    } else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8109
			cp2 = (XChar2b *)(malloc(n * 2));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8110
			mustFree = 1;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8111
		    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8112
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8113
		    for (i=0; i<n; i++) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8114
			cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8115
			cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8116
		    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8117
		    cp = (char *) cp2;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8118
		}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8119
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8120
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8121
		ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8122
		len = XTextWidth16(f, (XChar2b *)cp, n);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8123
		LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8124
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8125
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8126
		if (mustFree) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8127
		    free(cp2);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8128
		}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8129
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8130
		RETURN ( __MKSMALLINT(len) );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8131
	    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8132
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8133
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8134
#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
  8135
  fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8136
%}.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  8137
    ^ super widthOf:aString inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8138
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8139
3177
8aa3c800394a category rename
Claus Gittinger <cg@exept.de>
parents: 3146
diff changeset
  8140
!XWorkstation methodsFor:'grabbing'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8141
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8142
allowEvents:mode
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8143
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8144
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8145
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8146
    int _mode, ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8147
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8148
    if (mode == @symbol(asyncPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8149
	_mode = AsyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8150
    else if (mode == @symbol(syncPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8151
	_mode = SyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8152
    else if (mode == @symbol(asyncKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8153
	_mode = AsyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8154
    else if (mode == @symbol(syncKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8155
	_mode = SyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8156
    else if (mode == @symbol(syncBoth))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8157
	_mode = SyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8158
    else if (mode == @symbol(asyncBoth))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8159
	_mode = AsyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8160
    else if (mode == @symbol(replayPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8161
	_mode = ReplayPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8162
    else if (mode == @symbol(replayKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8163
	_mode = ReplayKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8164
    else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8165
	ok = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8166
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8167
    if (ok
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8168
     && ISCONNECTED) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8169
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8170
	XAllowEvents(myDpy, _mode, CurrentTime);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8171
	LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8172
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8173
	RETURN (self);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8174
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8175
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8176
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8177
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8178
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8179
grabKeyboardIn:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8180
    "grab the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8181
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8182
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8183
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8184
    int result, ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8185
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8186
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8187
	if (__isExternalAddress(aWindowId)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8188
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8189
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8190
	    result = XGrabKeyboard(myDpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8191
				   __WindowVal(aWindowId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8192
				   True /* False */,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8193
				   GrabModeAsync,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8194
				   GrabModeAsync,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8195
				   CurrentTime);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8196
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8197
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8198
	    ok = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8199
	    switch(result) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8200
		case AlreadyGrabbed: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8201
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8202
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8203
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8204
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8205
		case GrabNotViewable: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8206
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8207
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8208
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8209
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8210
		case GrabInvalidTime: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8211
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8212
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8213
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8214
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8215
		case GrabFrozen: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8216
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8217
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8218
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8219
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8220
		default:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8221
		    ok = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8222
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8223
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8224
	    if (! ok) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8225
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8226
		XUngrabKeyboard(myDpy, CurrentTime);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8227
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8228
		RETURN (false);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8229
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8230
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8231
	    RETURN ( true );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8232
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8233
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  8234
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8235
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8236
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8237
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8238
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8239
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
  8240
    "grap the pointer - return true if ok"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8241
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8242
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8243
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8244
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8245
    int result, ok, evMask;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8246
    Window confineWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8247
    Cursor curs;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8248
    int pointer_mode, keyboard_mode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8249
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8250
    if (ISCONNECTED) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8251
	if (__isExternalAddress(aWindowId)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8252
	    if (__isExternalAddress(confineId)) 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8253
		confineWin = __WindowVal(confineId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8254
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8255
		confineWin = (Window) None;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8256
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8257
	    if (__isExternalAddress(aCursorId)) 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8258
		curs = __CursorVal(aCursorId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8259
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8260
		curs = (Cursor) None;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8261
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8262
	    if (pMode == @symbol(sync))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8263
		pointer_mode = GrabModeSync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8264
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8265
		pointer_mode = GrabModeAsync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8266
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8267
	    if (kMode == @symbol(sync))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8268
		keyboard_mode = GrabModeSync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8269
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8270
		keyboard_mode = GrabModeAsync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8271
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8272
	    if (__isSmallInteger(eventMask))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8273
		evMask = __intVal(eventMask);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8274
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8275
		evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8276
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8277
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8278
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8279
	    ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8280
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8281
	    result = XGrabPointer(myDpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8282
				  __WindowVal(aWindowId), 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8283
				  False, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8284
				  evMask,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8285
				  pointer_mode, keyboard_mode,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8286
				  confineWin,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8287
				  curs,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8288
				  CurrentTime);
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8289
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8290
	    LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8291
*/
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8292
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8293
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8294
	    ok = 0;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8295
	    switch (result) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8296
		case AlreadyGrabbed: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8297
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8298
			fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8299
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8300
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8301
		case GrabNotViewable: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8302
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8303
			fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8304
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8305
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8306
		case GrabInvalidTime: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8307
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8308
			fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8309
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8310
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8311
		case GrabFrozen: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8312
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8313
			fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8314
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8315
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8316
		default:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8317
		    ok = 1;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8318
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8319
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8320
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8321
	    if (! ok) {
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8322
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8323
		ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8324
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8325
		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
  8326
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8327
		LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8328
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8329
		RETURN (false);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8330
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8331
	    RETURN ( true );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8332
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8333
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  8334
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8335
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8336
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8337
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8338
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8339
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
  8340
    "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
  8341
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8342
    ^ self
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8343
	grabPointerIn:aWindowId 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8344
	withCursor:aCursorId 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8345
	eventMask:nil
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8346
	pointerMode:pMode 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8347
	keyboardMode:kMode 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8348
	confineTo:confineId
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8349
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8350
    "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
  8351
!
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8352
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8353
primUngrabKeyboard
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8354
    "release the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8355
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8356
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8357
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8358
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8359
    if (ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8360
	Display *dpy = myDpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8361
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8362
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8363
	XUngrabKeyboard(dpy, CurrentTime);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8364
	XSync(dpy, 0);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8365
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8366
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8367
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8368
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8369
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8370
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8371
primUngrabPointer
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8372
    "release the pointer"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8373
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8374
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8375
%{
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8376
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8377
    if (ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8378
	Display *dpy = myDpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8379
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8380
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8381
	XUngrabPointer(dpy, CurrentTime);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8382
	XSync(dpy, 0);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8383
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8384
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8385
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8386
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8387
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8388
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8389
ungrabKeyboard
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8390
    "release the keyboard"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8391
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8392
    self primUngrabKeyboard.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8393
    activeKeyboardGrab := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8394
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8395
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8396
ungrabPointer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8397
    "release the pointer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8398
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8399
    self primUngrabPointer.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8400
    activePointerGrab := nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8401
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8402
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8403
!XWorkstation methodsFor:'graphic context stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8404
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  8405
noClipIn:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8406
    "disable clipping rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8407
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8408
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8409
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8410
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8411
    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
  8412
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8413
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8414
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8415
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8416
	    gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8417
	    gcv.clip_mask = None;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8418
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8419
	    XChangeGC(myDpy, gc, GCClipMask, &gcv);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8420
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8421
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8422
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8423
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8424
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8425
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8426
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8427
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8428
setBackground:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8429
    "set background color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8430
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8431
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8432
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8433
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8434
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8435
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8436
	 && __isSmallInteger(bgColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8437
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8438
	    XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8439
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8440
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8441
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8442
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8443
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8444
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8445
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8446
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8447
setBitmapMask:aBitmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8448
    "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
  8449
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8450
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8451
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8452
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8453
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8454
    Pixmap bitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8455
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8456
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8457
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8458
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8459
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8460
	    gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8461
	    if (__isExternalAddress(aBitmapId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8462
		bitmap = __PixmapVal(aBitmapId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8463
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8464
		XSetStipple(dpy, gc, bitmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8465
		XSetFillStyle(dpy, gc, FillOpaqueStippled);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8466
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8467
		RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8468
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8469
	    if (aBitmapId == nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8470
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8471
		XSetFillStyle(dpy, gc, FillSolid);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8472
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8473
		RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8474
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8475
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8476
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8477
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8478
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8479
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8480
1681
069ede63fb19 pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1627
diff changeset
  8481
setClipByChildren:aBool in:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8482
    "enable/disable drawing into child views"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8483
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8484
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8485
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8486
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8487
    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
  8488
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8489
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8490
    if (ISCONNECTED) {
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  8491
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8492
	    gc = __GCVal(aGCId);
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  8493
	    if (aBool == true)
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  8494
		gcv.subwindow_mode = ClipByChildren;
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  8495
	    else
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  8496
		gcv.subwindow_mode = IncludeInferiors;
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  8497
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8498
	    ENTER_XLIB();
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  8499
	    XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8500
	    LEAVE_XLIB();
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  8501
	    RETURN ( self );
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  8502
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8503
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8504
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8505
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8506
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8507
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  8508
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
  8509
    "clip to a rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8510
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8511
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8512
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8513
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8514
    XRectangle r;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8515
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8516
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8517
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8518
	 && __bothSmallInteger(clipX, clipY)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8519
	 && __bothSmallInteger(clipWidth, clipHeight)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8520
	    r.x = __intVal(clipX);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8521
	    r.y = __intVal(clipY);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8522
	    r.width = __intVal(clipWidth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8523
	    r.height = __intVal(clipHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8524
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8525
	    XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8526
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8527
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8528
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8529
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8530
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8531
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8532
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8533
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8534
setDashes:dashList dashOffset:offset in:aGCId
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8535
    "set line attributes"
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8536
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8537
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8538
%{  
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8539
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8540
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8541
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8542
	 && __isSmallInteger(offset)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8543
	 && __isByteArray(dashList)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8544
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8545
	    XSetDashes(myDpy, __GCVal(aGCId), 
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8546
		       __intVal(offset),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8547
		       __ByteArrayInstPtr(dashList)->ba_element,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8548
		       __byteArraySize(dashList));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8549
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8550
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8551
	}
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8552
    }
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8553
bad: ;
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8554
%}.
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8555
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8556
     either aGCId is invalid,
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8557
     and/or dashList is not a byteArray
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8558
     and/or offset is not a smallInteger
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8559
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8560
    self primitiveFailedOrClosedConnection
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8561
!
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8562
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8563
setFont:aFontId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8564
    "set font to be drawn in"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8565
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8566
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8567
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8568
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8569
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8570
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8571
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8572
	if (__isExternalAddress(aFontId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8573
	 && __isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8574
	    f = (XFontStruct *) __FontVal(aFontId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8575
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8576
	    XSetFont(myDpy, __GCVal(aGCId), f->fid);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8577
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8578
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8579
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8580
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8581
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8582
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8583
     aGCId and/or aFontId are invalid
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8584
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8585
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8586
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8587
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8588
setForeground:fgColorIndex background:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8589
    "set foreground and background colors to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8590
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8591
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8592
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8593
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8594
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8595
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8596
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8597
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8598
	if (__bothSmallInteger(fgColorIndex, bgColorIndex)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8599
	 && __isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8600
	    gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8601
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8602
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8603
	    XSetForeground(dpy, gc, __intVal(fgColorIndex));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8604
	    XSetBackground(dpy, gc, __intVal(bgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8605
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8606
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8607
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8608
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8609
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8610
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8611
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8612
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8613
setForeground:fgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8614
    "set foreground color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8615
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8616
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8617
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8618
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8619
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8620
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8621
	 && __isSmallInteger(fgColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8622
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8623
	    XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8624
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8625
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8626
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8627
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8628
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8629
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8630
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8631
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8632
setFunction:aFunctionSymbol in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8633
    "set alu function to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8634
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8635
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8636
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8637
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8638
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8639
    int fun = -1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8640
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8641
    if (ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8642
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8643
	    gc = __GCVal(aGCId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8644
	    if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8645
	    else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8646
	    else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8647
	    else if (aFunctionSymbol == @symbol(and)) fun = GXand;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8648
	    else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8649
	    else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8650
	    else if (aFunctionSymbol == @symbol(or)) fun = GXor;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8651
	    else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8652
	    else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8653
	    else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8654
	    else if (aFunctionSymbol == @symbol(clear)) fun = GXclear;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8655
	    else if (aFunctionSymbol == @symbol(set)) fun = GXset;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8656
	    else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8657
	    else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8658
	    else if (aFunctionSymbol == @symbol(nand)) fun = GXnand;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8659
	    if (fun != -1) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8660
		ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8661
		XSetFunction(myDpy, gc, fun);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8662
		LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8663
		RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8664
	    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8665
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8666
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8667
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8668
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8669
     either aGCId is not an integer, or an invalid symbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8670
     was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8671
     #andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8672
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8673
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8674
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8675
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8676
setGraphicsExposures:aBoolean in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8677
    "set or clear the graphics exposures flag"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8678
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8679
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8680
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8681
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8682
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8683
	if (__isExternalAddress(aGCId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8684
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8685
	    XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8686
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8687
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8688
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8689
    }
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8690
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8691
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8692
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8693
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8694
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  8695
    "set line attributes; 
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  8696
     lineStyle must be one of #solid, #dashed or #doubleDashed;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  8697
     capStyle one of: #notLast, #butt, #round or #projecting;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  8698
     joinStyle one of: #miter, #bevel or #round."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8699
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8700
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8701
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8702
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8703
    int x_style, x_cap, x_join;
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8704
    static char dashList[2] = { 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8705
    static char dotList[2]  = { 4,4 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8706
    static char dashDotList[4]    = { 4,1 , 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8707
    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
  8708
    char *x_dashes = 0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8709
    int x_nDash;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8710
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8711
    if (ISCONNECTED) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8712
	if (__isExternalAddress(aGCId)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8713
	 && __isSmallInteger(aNumber)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  8714
	    Display *dpy = myDpy;
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  8715
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8716
	    if (lineStyle == @symbol(solid)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8717
		x_dashes = (char *)0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8718
		x_style = LineSolid;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8719
	    } else if (lineStyle == @symbol(dashed)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8720
		x_dashes = dashList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8721
		x_nDash = sizeof(dashList);
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  8722
		x_style = LineOnOffDash;
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8723
	    } else if (lineStyle == @symbol(doubleDashed)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8724
		x_dashes = dashList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8725
		x_nDash = sizeof(dashList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8726
		x_style = LineDoubleDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8727
	    } else if (lineStyle == @symbol(dotted)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8728
		x_dashes = dotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8729
		x_nDash = sizeof(dotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8730
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8731
	    } else if (lineStyle == @symbol(dashDot)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8732
		x_dashes = dashDotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8733
		x_nDash = sizeof(dashDotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8734
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8735
	    } else if (lineStyle == @symbol(dashDotDot)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8736
		x_dashes = dashDotDotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8737
		x_nDash = sizeof(dashDotDotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8738
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8739
	    } else goto bad;
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8740
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8741
	    if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8742
	    else if (capStyle == @symbol(butt)) x_cap = CapButt;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8743
	    else if (capStyle == @symbol(round)) x_cap  = CapRound;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8744
	    else if (capStyle == @symbol(projecting)) x_cap  = CapProjecting;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8745
	    else goto bad;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8746
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8747
	    if (joinStyle == @symbol(miter)) x_join = JoinMiter;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8748
	    else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8749
	    else if (joinStyle == @symbol(round)) x_join  = JoinRound;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8750
	    else goto bad;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8751
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8752
	    ENTER_XLIB();
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8753
	    if (x_dashes) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8754
		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
  8755
	    }
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  8756
	    XSetLineAttributes(dpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8757
			       __GCVal(aGCId), __intVal(aNumber),
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8758
			       x_style, x_cap, x_join);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8759
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8760
	    RETURN ( self );
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8761
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8762
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8763
bad: ;
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
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8766
     either aGCId is invalid,
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  8767
     and/or lineWidth is not a smallInteger,
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8768
     and/or lineStyle is none of #solid, #dashed, #doubleDashed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8769
     and/or capStyle is none of #notLast, #butt, #round, #projecting
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8770
     and/or joinStyle is none of #miter, #bevel, #round
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8771
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8772
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8773
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8774
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8775
setMaskOriginX:orgX y:orgY in:aGCid
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8776
    "set the mask origin"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8777
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8778
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8779
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8780
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8781
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8782
	if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8783
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8784
	    XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8785
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8786
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8787
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8788
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8789
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8790
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8791
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8792
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8793
setPixmapMask:aPixmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8794
    "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
  8795
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8796
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8797
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8798
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8799
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8800
    Pixmap pixmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8801
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8802
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8803
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8804
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8805
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8806
	    gc = __GCVal(aGCId);
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8807
	    if (__isExternalAddress(aPixmapId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8808
		pixmap = __PixmapVal(aPixmapId);
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8809
		ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8810
		XSetTile(dpy, gc, pixmap);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8811
		XSetFillStyle(dpy, gc, FillTiled);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8812
		LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8813
		RETURN ( self );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8814
	    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8815
	    if (aPixmapId == nil) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8816
		ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8817
		XSetFillStyle(dpy, gc, FillSolid);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8818
		LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8819
		RETURN ( self );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8820
	    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8821
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8822
    }
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
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8825
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8826
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8827
!XWorkstation methodsFor:'initialize / release'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8828
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8829
closeConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8830
    "close down the connection to the X-server"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8831
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8832
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8833
3061
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  8834
"/ 'closing' errorPrintCR.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  8835
"/ thisContext fullPrintAll.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  8836
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  8837
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8838
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8839
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8840
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8841
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8842
	__INST(displayId) = nil;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8843
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8844
	XCloseDisplay(dpy);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8845
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8846
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8847
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8848
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8849
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8850
emergencyCloseConnection
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8851
    "low level close of the displays connection (without sending any buffered
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8852
     requests to the display). Only used in case of emergency (brokenConnection)"
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8853
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8854
%{ 
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8855
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8856
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8857
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8858
	__INST(displayId) = nil;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8859
	close(ConnectionNumber(dpy));
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8860
    }
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8861
%}
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8862
!
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8863
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8864
eventBufferSize
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8865
%{
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8866
    RETURN ( __MKSMALLINT(sizeof(XEvent) + 100) );
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8867
%}
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8868
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8869
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8870
initializeDefaultValues
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  8871
    activateOnClick := false.
2862
2f43bf146110 moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents: 2856
diff changeset
  8872
    super initializeDefaultValues.
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
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8875
initializeDeviceSignals
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8876
    super initializeDeviceSignals.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8877
2984
6a278fd02e74 Signal init.
Stefan Vogel <sv@exept.de>
parents: 2977
diff changeset
  8878
    deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignal.
2856
95cb0ea5f7cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2855
diff changeset
  8879
    deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8880
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8881
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8882
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8883
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8884
!
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8885
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8886
initializeEventBuffer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8887
    eventBuffer isNil ifTrue:[
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8888
	eventBuffer := ByteArray new:(self eventBufferSize).
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8889
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8890
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8891
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8892
initializeFor:aDisplayName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8893
    "initialize the receiver for a connection to an X-Server;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8894
     the argument, aDisplayName may be nil (for the default server from
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8895
     DISPLAY-variable or command line argument) or the name of the server 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8896
     as hostname:number"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8897
334
8c851e8a0b05 access comandline args via access method
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  8898
    |dpyName index arguments|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8899
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8900
    displayId notNil ifTrue:[
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8901
	"/ already connected - you bad guy try to trick me manually ?
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8902
	^ self
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8903
    ].
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8904
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8905
    dpyName := aDisplayName.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8906
    dpyName isNil ifTrue:[
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8907
	"look for a '-display xxx' argument"
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8908
	(arguments := Smalltalk commandLineArguments) notNil ifTrue:[
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8909
	    index := arguments indexOf:'-display'.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8910
	    (index between:1 and:(arguments size - 1)) ifTrue:[
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8911
		dpyName := arguments at:index+1
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8912
	    ]
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8913
	].
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8914
	dpyName isNil ifTrue:[
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8915
	    dpyName := OperatingSystem getEnvironment:'DISPLAY'.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8916
	].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8917
    ].
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8918
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8919
    displayId := self openConnectionTo:dpyName.
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8920
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8921
    displayId isNil ifTrue:[
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8922
	"/ could not connect.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8923
	"/ only output a message, if running under X
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8924
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8925
	((OperatingSystem isMSWINDOWSlike not) or:[WinWorkstation isNil]) ifTrue:[
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8926
	    'XWorkstation [warning]: cannot connect to Display (' infoPrint.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8927
	    (dpyName ? ((OperatingSystem getEnvironment:'Display') ? 'default')) infoPrint.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8928
	    ')' infoPrintCR.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8929
	].
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8930
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8931
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8932
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8933
    dispatching := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8934
    dispatchingExpose := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8935
    isSlow := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8936
    shiftDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8937
    ctrlDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8938
    metaDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8939
    altDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8940
    motionEventCompression := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8941
    buttonsPressed := 0.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8942
    displayName := dpyName.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8943
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8944
    protocolsAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8945
    deleteWindowAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8946
    saveYourselfAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8947
    quitAppAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8948
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  8949
    self initializeDeviceResourceTables.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8950
    self initializeScreenProperties.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8951
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8952
    self initializeDefaultValues.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8953
    self initializeEventBuffer.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8954
    self initializeSpecialFlags.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8955
    self initializeKeyboardMap.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8956
    self initializeDeviceSignals.
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  8957
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  8958
    self initializeViewStyle.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8959
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8960
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8961
initializeModifierMappings
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  8962
    "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
  8963
     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
  8964
     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
  8965
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8966
    |map mod|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8967
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  8968
    super initializeModifierMappings.                                     
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8969
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8970
    rawKeySymTranslation := RawKeySymTranslation.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8971
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8972
    map := self modifierMapping.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  8973
    map isNil ifTrue:[
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8974
        "/
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8975
        "/ mhmh - a crippled Xlib which does not provide modifier mappings
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8976
        "/ setup some reasonable default. If that is not sufficient,
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8977
        "/ you have to change things from your display.rc file.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8978
        "/
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8979
        altModifierMask := self modifier1Mask.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8980
        metaModifierMask := self modifier2Mask.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  8981
    ] ifFalse:[
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8982
        altModifierMask := 0.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8983
        metaModifierMask := 0.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8984
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8985
        mod := map at:1.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8986
        mod notNil ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8987
            shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8988
        ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8989
        mod := map at:3.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8990
        mod notNil ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8991
            ctrlModifiers  := mod collect:[ :key | self stringFromKeycode:key ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8992
        ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8993
        mod := map at:4.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8994
        mod notNil ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8995
            mod := mod collect:[ :key | self stringFromKeycode:key ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8996
            (mod includes:'Num_Lock') ifFalse:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8997
                metaModifiers := mod.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8998
                metaModifierMask := 1 bitShift:(4-1).
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8999
            ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9000
        ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9001
        mod := map at:5.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9002
        mod notNil ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9003
            mod := mod collect:[ :key | self stringFromKeycode:key ].    
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9004
            (mod includes:'Num_Lock') ifFalse:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9005
                altModifiers   := mod.    
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9006
                altModifierMask := 1 bitShift:(5-1).
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9007
            ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9008
        ]
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9009
    ].                                                          
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9010
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9011
    "
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9012
      Display initializeModifierMappings
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9013
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9014
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9015
    "Modified: 1.12.1995 / 23:44:40 / stefan"
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9016
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9017
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9018
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9019
initializeScreenProperties
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9020
    |masks|
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9021
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9022
    super initializeScreenProperties.
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9023
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9024
    hasShapeExtension := self queryShapeExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9025
    hasShmExtension := self querySHMExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9026
    hasDPSExtension := self queryDPSExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9027
    hasXVideoExtension := self queryXVideoExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9028
    hasMbufExtension := self queryMBUFExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9029
    hasPEXExtension := self queryPEXExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9030
    hasImageExtension := self queryXIEExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9031
    hasInputExtension := self queryXIExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9032
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9033
    primaryAtom := self atomIDOf:#PRIMARY.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9034
    stringAtom := self atomIDOf:#STRING.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9035
    lengthAtom := self atomIDOf:#LENGTH.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9036
    cutBuffer0Atom := self atomIDOf:#'CUT_BUFFER0'.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9037
    wmStateAtom := self atomIDOf:#WM_STATE.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9038
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9039
    altModifierMask := self modifier2Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9040
    metaModifierMask := self modifier1Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9041
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9042
    screen := self queryDefaultScreen.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9043
    depth := self queryDepth.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9044
    ncells := self queryCells.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9045
    width := self queryWidth.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9046
    height := self queryHeight.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9047
    widthMM := self queryWidthMM.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9048
    heightMM := self queryHeightMM.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9049
    blackpixel := self queryBlackPixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9050
    whitepixel := self queryWhitePixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9051
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9052
    monitorType := #unknown.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9053
    visualType := self queryDefaultVisualType.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9054
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9055
    hasColors := hasGreyscales := true.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9056
    (visualType == #StaticGray
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9057
    or:[ visualType == #GrayScale]) ifTrue:[
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9058
	hasColors := false.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9059
	monitorType := #monochrome.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9060
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9061
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9062
    ncells == 2 ifTrue:[
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9063
	hasColors := hasGreyscales := false.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9064
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9065
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9066
    masks := self queryRGBMasks.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9067
    redMask := masks at:1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9068
    greenMask := masks at:2.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9069
    blueMask := masks at:3.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9070
    bitsPerRGB := masks at:4.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9071
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9072
    visualType == #TrueColor ifTrue:[
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9073
	redShift := redMask lowBit - 1.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9074
	greenShift := greenMask lowBit - 1.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9075
	blueShift := blueMask lowBit - 1.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9076
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9077
	bitsRed := redMask highBit - redMask lowBit + 1.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9078
	bitsGreen := greenMask highBit - greenMask lowBit + 1.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9079
	bitsBlue := blueMask highBit - blueMask lowBit + 1.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9080
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9081
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  9082
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9083
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9084
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9085
    int scr;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9086
    Visual *visual;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9087
    XVisualInfo viproto;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9088
    XVisualInfo *vip;                   /* retured info */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9089
    int maxRGBDepth;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9090
    int rgbRedMask, rgbGreenMask, rgbBlueMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9091
    int rgbVisualID;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9092
    int nvi, i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9093
    char *type, *nm;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9094
    int dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9095
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9096
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9097
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9098
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9099
	/*
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9100
	 * look for RGB visual
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9101
	 */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9102
	nvi = 0;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9103
	viproto.screen = scr;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9104
	vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9105
	maxRGBDepth = 0;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9106
	for (i = 0; i < nvi; i++) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9107
	    switch (vip[i].class) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9108
		case TrueColor:
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9109
		    if (vip[i].depth > maxRGBDepth) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9110
			maxRGBDepth = vip[i].depth;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9111
			rgbRedMask = vip[i].red_mask;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9112
			rgbGreenMask = vip[i].green_mask;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9113
			rgbBlueMask = vip[i].blue_mask;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9114
			rgbVisualID = vip[i].visualid;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9115
		    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9116
		    break;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9117
	    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9118
	}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9119
	if (vip) XFree ((char *) vip);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9120
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9121
	if (maxRGBDepth) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9122
	    __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9123
	}
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9124
    }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9125
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9126
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9127
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9128
initializeSpecialFlags
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9129
    "perform additional special server implementation flags"
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
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9132
    "/ assume we have it ... (should check)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9133
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9134
    hasSaveUnder := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9135
    ignoreBackingStore := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9136
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9137
    (self serverVendor = 'X11/NeWS') ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9138
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9139
	"/ this is a kludge around a bug in the X11/NeWS server,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9140
	"/ which does not correctly handle saveUnder
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9141
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9142
	hasSaveUnder := false.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9143
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9144
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9145
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9146
openConnectionTo:dpyName
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9147
    "open a connection to some display;
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9148
     return displayId if ok, nil of not ok"
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9149
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9150
%{
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9151
    Display *dpy;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9152
    int i;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9153
    char *nm;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9154
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9155
    if (__isString(dpyName))
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9156
	nm = (char *) __stringVal(dpyName);
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9157
    else {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9158
	nm = NULL;
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9159
    }
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9160
    dpy = XOpenDisplay(nm);
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9161
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9162
    if (dpy) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9163
	static int firstCall = 1;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9164
	OBJ dpyID;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9165
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9166
	dpyID = __MKEXTERNALADDRESS(dpy);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9167
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9168
	if (firstCall) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9169
	    firstCall = 0;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9170
	    XSetErrorHandler(__XErrorHandler__);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9171
	    XSetIOErrorHandler(__XIOErrorHandler__);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9172
	}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9173
	RETURN (dpyID);
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9174
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9175
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9176
    ^ nil
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9177
!
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9178
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9179
reinitialize
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9180
    virtualRootId := rootId := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9181
    super reinitialize.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9182
    dispatchingExpose := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9183
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9184
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9185
!XWorkstation methodsFor:'keyboard mapping'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9186
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9187
altModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9188
    "return the mask (in motionEvents) for the alt-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9189
     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
  9190
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9191
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9192
    ^ altModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9193
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9194
    "Created: 23.3.1996 / 12:43:22 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9195
    "Modified: 23.3.1996 / 12:44:56 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9196
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9197
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9198
altModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9199
    "define which key takes the role of an alt-key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9200
     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
  9201
     most keyboards. However, there may be exceptions to this,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9202
     and the setting can be changed with:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9203
	Display altModifierMask:(Display modifier2Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9204
     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
  9205
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9206
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9207
    altModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9208
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9209
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9210
ctrlModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9211
    "return the Xlib mask bit for the control modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9212
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9213
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9214
    RETURN (__MKSMALLINT(ControlMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9215
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9216
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9217
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9218
metaModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9219
    "return the mask (in motionEvents) for the meta-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9220
     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
  9221
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9222
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9223
    ^ metaModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9224
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9225
    "Created: 23.3.1996 / 12:43:39 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9226
    "Modified: 23.3.1996 / 12:45:09 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9227
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9228
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9229
metaModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9230
    "define which key takes the role of a meta key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9231
     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
  9232
     most keyboards (if present at all).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9233
     However, there may be exceptions to this, and the setting can
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9234
     be changed with:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9235
	Display metaModifierMask:(Display modifier1Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9236
     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
  9237
     As reported, some Xservers place the Meta-key onto NumLock,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9238
     and having NumLock enabled makes ST/X think, that meta is pressed
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9239
     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
  9240
     the mask to 0.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9241
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9242
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9243
    metaModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9244
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9245
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9246
modifier1Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9247
    "return the Xlib mask bit for the 1st modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9248
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9249
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9250
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9251
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9252
    RETURN (__MKSMALLINT(Mod1Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9253
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9254
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9255
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9256
modifier2Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9257
    "return the Xlib mask bit for the 2nd modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9258
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9259
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9260
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9261
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9262
    RETURN (__MKSMALLINT(Mod2Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9263
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9264
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9265
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9266
modifier3Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9267
    "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
  9268
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9269
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9270
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9271
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9272
    RETURN (__MKSMALLINT(Mod3Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9273
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9274
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9275
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9276
modifier4Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9277
    "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
  9278
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9279
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9280
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9281
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9282
    RETURN (__MKSMALLINT(Mod4Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9283
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9284
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9285
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9286
modifier5Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9287
    "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
  9288
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9289
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9290
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9291
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9292
    RETURN (__MKSMALLINT(Mod5Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9293
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9294
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9295
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9296
modifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9297
    "Get the Modifier Mapping.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9298
     We return an array of arrays of keycodes"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9299
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9300
    |modifierKeyMap maxKeyPerMod ret nextKey|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9301
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9302
    modifierKeyMap := self rawModifierMapping.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9303
    maxKeyPerMod := modifierKeyMap size // 8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9304
    modifierKeyMap isNil ifTrue:[^ nil].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9305
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9306
    ret := Array new:8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9307
    nextKey := 1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9308
    1 to:8 do:[ :i |
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9309
        (modifierKeyMap at:nextKey) ~= 0 ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9310
            |mod|
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9311
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9312
            mod := OrderedCollection new:maxKeyPerMod.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9313
            modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9314
                key ~= 0 ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9315
                    mod add:key
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9316
                ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9317
            ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9318
            ret at:i put:mod.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9319
        ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9320
        nextKey := nextKey+maxKeyPerMod.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9321
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9322
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9323
    ^ ret
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9324
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9325
    "
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9326
     Display modifierMapping
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9327
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9328
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9329
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9330
     |mapping|
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9331
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9332
     mapping := Display modifierMapping.
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9333
     ^ mapping collect:[:eachRow | 
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9334
                             eachRow notNil ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9335
                                 eachRow collect:[ :key | Display stringFromKeycode:key ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9336
                             ] ifFalse:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9337
                                 nil
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9338
                             ]
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9339
                       ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9340
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9341
!
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9342
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9343
rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9344
    "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
  9345
     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
  9346
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9347
    ^ rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9348
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9349
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9350
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9351
     Display rawKeySymTranslation
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9352
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9353
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9354
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9355
rawModifierMapping
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9356
    "Get the raw Modifier Mapping."
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9357
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9358
    |modifierKeyMap maxKeyPerMod |
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9359
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9360
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9361
    XModifierKeymap *modmap;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9362
    OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT();
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9363
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9364
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9365
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9366
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9367
	if ((modmap = XGetModifierMapping(dpy)) != 0) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9368
	   maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9369
	   modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9370
	   if (modifierKeyMap != nil) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9371
		memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9372
		       (char *)modmap->modifiermap, modmap->max_keypermod * 8);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9373
	   }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9374
	   XFreeModifiermap(modmap);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9375
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9376
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9377
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9378
    ^ modifierKeyMap 
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9379
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9380
    "
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  9381
	Display rawModifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9382
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9383
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9384
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9385
shiftModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9386
    "return the Xlib mask bit for the shift modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9387
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9388
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9389
    RETURN (__MKSMALLINT(ShiftMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9390
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9391
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9392
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9393
stringFromKeycode:code
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9394
    "Get a KeySymbol (a smalltalk symbol) from the keycode."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9395
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9396
    |str|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9397
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9398
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9399
    KeySym keysym;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9400
    char *keystring;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9401
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9402
    if (ISCONNECTED
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9403
     && __isSmallInteger(code)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9404
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9405
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  9406
	if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol &&
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9407
	    (keystring = XKeysymToString(keysym)) != 0) 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9408
	    str = __MKSTRING(keystring);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9409
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9410
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9411
    ^ str
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9412
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9413
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9414
	Display stringFromKeycode:28
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9415
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9416
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9417
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9418
superModifierMask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9419
    "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
  9420
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9421
    ^ self modifier4Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9422
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9423
2140
21ad63e0c739 allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  9424
translateKey:untranslatedKey forView:aView
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9425
    "Return the key translated via the translation table.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9426
     Here, we preTranslate the key into a common ST/X symbolic name, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9427
     which gets further processed in the superclasses translation method."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9428
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9429
    |key|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9430
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9431
    key := untranslatedKey.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9432
    (rawKeySymTranslation includesKey:key) ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9433
        key := rawKeySymTranslation at:key.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9434
    ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9435
    key isCharacter ifFalse:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9436
        key := key asSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9437
    ].
2140
21ad63e0c739 allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  9438
    ^ super translateKey:key forView:aView
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9439
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9440
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9441
!XWorkstation methodsFor:'misc'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9442
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9443
beep
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9444
    "output an audible beep or bell"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9445
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  9446
    UserPreferences current beepEnabled ifTrue:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9447
	self beep:50
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9448
    ]
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  9449
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  9450
    "Modified: / 3.12.1999 / 17:13:59 / ps"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9451
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9452
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9453
beep:volumeInPercent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9454
    "output an audible beep"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9455
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9456
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9457
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9458
    int volume;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9459
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9460
    if (__isSmallInteger(volumeInPercent)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9461
     && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9462
	/* stupid: X wants -100 .. 100 and calls this percent */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9463
	volume = __intVal(volumeInPercent) * 2 - 100;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9464
	if (volume < -100) volume = -100;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9465
	else if (volume > 100) volume = 100;
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9466
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9467
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9468
	XBell(myDpy, volume);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9469
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9470
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9471
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9472
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9473
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9474
buffered
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9475
    "buffer drawing - do not send it immediately to the display.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9476
     This is the default anyway.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9477
     See #unBuffered for additional info."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9478
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9479
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9480
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9481
    if (ISCONNECTED) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9482
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9483
	XSynchronize(myDpy, 0);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9484
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9485
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9486
%}
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9487
    "
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9488
     Display buffered
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9489
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9490
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9491
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9492
flush
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9493
    "send all buffered drawing to the display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9494
     This may be required to make certain, that all previous operations
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9495
     are really sent to the display before continuing. For example,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9496
     after a cursor-change with a followup long computation.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9497
     (otherwise, the cursor change request may still be in the output buffer)
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9498
     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
  9499
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9500
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9501
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9502
    if (ISCONNECTED) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9503
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9504
	XFlush(myDpy);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9505
	LEAVE_XLIB();
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  9506
    }
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  9507
%}
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  9508
!
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  9509
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9510
flushDpsContext:aDPSContext
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9511
    <context: #return>
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9512
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9513
#ifdef DPS
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9514
    if (ISCONNECTED
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9515
	&& __isExternalAddress(aDPSContext)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9516
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9517
	DPSFlushContext(__DPSContextVal(aDPSContext));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9518
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9519
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9520
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9521
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9522
#endif
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9523
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9524
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9525
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9526
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9527
primSync
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9528
    "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
  9529
     has finished drawing it.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9530
     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
  9531
     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
  9532
     to be finished. See also #flush."
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9533
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9534
    <context: #return>
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9535
%{  
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9536
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9537
    if (ISCONNECTED) {
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9538
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9539
        ENTER_XLIB();
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9540
        XSync(myDpy, 0);
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9541
        LEAVE_XLIB();
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9542
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9543
    }
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9544
%}
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9545
!
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9546
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9547
refreshKeyboardMapping:eB
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9548
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9549
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9550
    XMappingEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9551
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9552
    if (ISCONNECTED
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9553
     && __isByteArray(eB)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9554
	ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9555
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9556
	XRefreshKeyboardMapping(ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9557
	LEAVE_XLIB();
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9558
	RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9559
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9560
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9561
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9562
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9563
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9564
setInputFocusTo:aWindowId
2871
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  9565
    "set the focus to the view as defined by aWindowId.
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  9566
     When released, return the focus to the root window"
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  9567
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9568
"/    self setInputFocusTo:aWindowId revertTo:#parent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9569
    self setInputFocusTo:aWindowId revertTo:#root
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9570
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9571
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9572
setInputFocusTo:aWindowId revertTo:revertSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9573
    "set the focus to the view as defined by aWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9574
     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
  9575
     input until a new focus is set.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9576
     RevertSymbol specifies what should happen if the view becomes invisible;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9577
     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
  9578
     given to the parent view, the root view or no view."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9579
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9580
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9581
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9582
    int arg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9583
    Window focusWindow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9584
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9585
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9586
	if (__isExternalAddress(aWindowId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9587
	    focusWindow = __WindowVal(aWindowId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9588
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9589
	    focusWindow = None;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9590
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9591
	if (revertSymbol == @symbol(parent))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9592
	    arg = RevertToParent;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9593
	else if (revertSymbol == @symbol(root))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9594
	    arg = RevertToPointerRoot;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9595
	else 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9596
	    arg = RevertToNone;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9597
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9598
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9599
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9600
	XSetInputFocus(myDpy, focusWindow, arg, CurrentTime);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9601
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9602
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9603
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9604
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9605
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9606
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9607
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9608
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9609
sync
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9610
    "send all buffered drawing to the display AND wait until the display
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9611
     has finished drawing it.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9612
     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
  9613
     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
  9614
     to be finished. See also #flush."
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9615
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9616
    self primSync.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9617
    self dispatchPendingEvents.
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9618
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9619
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9620
unBuffered
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9621
    "make all drawing be sent immediately to the display.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9622
     This makes all graphics synchronous and turns off any buffering
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9623
     (i.e. each individual draw-request is sent immediately without 
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9624
      packing multiple requests into a larger message buffer).
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9625
     Be prepared, that this slows down graphics considerably.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9626
     However, it allows display errors to be handled immediately and
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9627
     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
  9628
     which was responsible for it. See also #buffered."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9629
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9630
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9631
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9632
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9633
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9634
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9635
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9636
	XSynchronize(myDpy, 1);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9637
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9638
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9639
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9640
%}
1813
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  9641
    "
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  9642
     Display unBuffered
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  9643
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9644
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9645
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9646
!XWorkstation methodsFor:'pointer stuff'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9647
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9648
anyButtonStateMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9649
    "return an integer for masking out any button from a
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9650
     buttonStates value."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9651
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9652
    "/ should use ``Display buttonXMotionMask bitOr:....''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9653
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9654
    ^ 256 + 512 + 1024
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9655
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9656
    "Modified: 23.3.1996 / 12:41:33 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9657
    "Created: 23.3.1996 / 12:46:35 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9658
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9659
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9660
buttonStates
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9661
    "return an integer representing the state of the pointer buttons;
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9662
     a one-bit in positions 0.. represent a pressed button.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9663
     See the button1Mask/button2Mask/button3Mask,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9664
     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
  9665
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9666
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9667
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9668
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  9669
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9670
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9671
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9672
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9673
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9674
    if (ISCONNECTED) {
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9675
	Display *dpy = myDpy;
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9676
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9677
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9678
#ifdef VIRTUAL_ROOT
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  9679
	w = getRootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9680
#else
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9681
	w = RootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9682
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9683
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9684
	if (w) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9685
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9686
	    ENTER_XLIB();
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9687
	    XQueryPointer(dpy, w, &rootRet, &childRet,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9688
				 &rootX, &rootY,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9689
				 &winX, &winY,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9690
				 &mask);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9691
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9692
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9693
	    RETURN (__MKSMALLINT(mask));
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9694
	}
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9695
    }
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9696
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9697
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9698
    ^ nil
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9699
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9700
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9701
     Display buttonStates     
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9702
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9703
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9704
    "is the control-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9705
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9706
     Display buttonStates bitTest:(Display controlMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9707
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9708
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9709
    "is the alt/meta-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9710
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9711
     Display buttonStates bitTest:(Display altModifierMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9712
     Display buttonStates bitTest:(Display metaModifierMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9713
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9714
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9715
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9716
leftButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9717
    "return an integer for masking out the left button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9718
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9719
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9720
    "/ should use ``Display button1MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9721
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9722
    ^ 256
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9723
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9724
    "Modified: 23.3.1996 / 12:41:33 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9725
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9726
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9727
middleButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9728
    "return an integer for masking out the middle button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9729
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9730
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9731
    "/ should use ``Display button2MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9732
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9733
    ^ 512
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9734
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9735
    "Modified: 23.3.1996 / 12:41:43 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9736
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9737
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9738
pointerPosition
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9739
    "return the current pointer position in root-window coordinates"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9740
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9741
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9742
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9743
    |xpos ypos|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9744
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9745
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9746
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  9747
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9748
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9749
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9750
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9751
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9752
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9753
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9754
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9755
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9756
#ifdef VIRTUAL_ROOT
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  9757
	w = getRootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9758
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9759
	w = RootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9760
#endif
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9761
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9762
	XQueryPointer(dpy, w, &rootRet, &childRet,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9763
			      &rootX, &rootY,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9764
			      &winX, &winY,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9765
			      &mask);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9766
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9767
	xpos = __MKSMALLINT(rootX);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9768
	ypos = __MKSMALLINT(rootY);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9769
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9770
    }
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9771
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9772
    xpos isNil ifTrue:[
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9773
	self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9774
	^ nil
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9775
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9776
    ^ xpos @ ypos
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9777
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9778
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9779
rightButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9780
    "return an integer for masking out the right button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9781
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9782
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9783
    "/ should use ``Display button3MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9784
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9785
    ^ 1024
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9786
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9787
    "Modified: 23.3.1996 / 12:41:52 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9788
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9789
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9790
rootPositionOfLastEvent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9791
    "return the position in root-window coordinates
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9792
     of the last button, key or pointer event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9793
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9794
    ^ eventRootX @ eventRootY
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9795
!
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9796
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9797
setPointerPosition:newPosition in:aWindowId
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9798
    "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
  9799
     given windows origin (which may be the rootWindow).
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9800
     Be careful with this - its usually not very ergonimically
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9801
     to change the mousePointer position.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9802
     This interface is provided for special applications (presentation
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9803
     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
  9804
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9805
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9806
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9807
    |xpos ypos|
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9808
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9809
    xpos := newPosition x.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9810
    ypos := newPosition y.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9811
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9812
%{
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9813
    if (ISCONNECTED
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9814
     && __isExternalAddress(aWindowId)
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9815
     && __bothSmallInteger(xpos, ypos)) {
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9816
	Display *dpy = myDpy;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9817
	Window w = __WindowVal(aWindowId);
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9818
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9819
	ENTER_XLIB();
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9820
	XWarpPointer(dpy, 
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9821
		     None,  /* src window */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9822
		     w,  /* dst window */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9823
		     0,  /* src_x */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9824
		     0,  /* src_y */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9825
		     0,  /* src_w */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9826
		     0,  /* src_h */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9827
		     __intVal(xpos),  /* dst_x */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9828
		     __intVal(ypos)   /* dst_y */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9829
		    );
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9830
	LEAVE_XLIB();
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9831
    }
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9832
%}.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9833
    ^ self
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9834
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9835
    "
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9836
     Display setPointerPosition:1000@1000
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9837
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9838
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9839
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9840
!XWorkstation methodsFor:'properties'!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9841
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9842
getObjectProperty:propertyID from:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9843
    "get an object property from the server; return object or nil"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9844
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9845
    self getProperty:propertyID from:aWindowID into:[:type :value |
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  9846
	type == stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  9847
	    ^ value
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  9848
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  9849
	(value isMemberOf:ByteArray) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  9850
	    ^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil])
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  9851
	]
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9852
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9853
    ^ nil
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9854
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9855
    "Modified: 6.4.1997 / 13:27:07 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9856
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9857
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9858
getProperty:propertySymbolOrID from:aWindowID into:aTwoArgBlock
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9859
    "get a property, evaluate aTwoArgBlock with typeID and value"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9860
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9861
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9862
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9863
    |val typeID cls propertyID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9864
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9865
    propertySymbolOrID isString ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9866
	propertyID := self atomIDOf:propertySymbolOrID create:false.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9867
    ] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9868
	propertyID := propertySymbolOrID.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9869
    ].
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9870
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9871
    cls := ByteArray.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9872
%{
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9873
    Window window;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9874
    Atom property;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9875
    char *cp, *cp2;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9876
    Atom actual_type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9877
    int actual_format,i;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9878
    unsigned long nitems, bytes_after, nread;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9879
    unsigned char *data;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9880
    int ok = 1;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9881
#   define PROP_SIZE    2048
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9882
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9883
    if (ISCONNECTED) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9884
	Display *dpy = myDpy;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9885
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9886
	if (__isAtomID(propertyID)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9887
	    property = __AtomVal(propertyID);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9888
	    if (__isExternalAddress(aWindowID)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9889
		window = __WindowVal(aWindowID);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9890
	    } else {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9891
		window = DefaultRootWindow(dpy);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9892
	    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9893
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9894
	    nread = 0;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9895
	    cp = 0;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9896
/*
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9897
	    fprintf(stderr, "getProperty: ");
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9898
 */
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9899
	    do {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9900
		int retVal;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9901
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9902
		ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9903
		retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE, False,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9904
					    AnyPropertyType, &actual_type, &actual_format,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9905
					    &nitems, &bytes_after, (unsigned char **)&data);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9906
		LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9907
		if (retVal != Success) {
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9908
			ok = 0;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9909
			break;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9910
		}
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9911
		typeID = __MKATOMOBJ(actual_type);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9912
		if (! cp) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9913
		    cp = cp2 = (char *)malloc(nitems+1);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9914
		} else {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9915
		    cp = (char *)realloc(cp, nread + nitems + 1);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9916
		    cp2 = cp + nread;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9917
		}
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9918
		if (! cp) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9919
		    XFree(data);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9920
		    goto fail;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9921
		}
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9922
    
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9923
		nread += nitems;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9924
		bcopy(data, cp2, nitems);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9925
		XFree(data);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9926
    /*
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9927
		fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9928
     */
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9929
	    } while (bytes_after > 0);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9930
    /*
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9931
	    fprintf(stderr, "\n");
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9932
     */
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9933
    
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9934
	    if (ok) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9935
		if (actual_type == XA_STRING) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9936
		    cp[nread] = '\0';
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9937
		    val = __MKSTRING_L(cp, nread);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9938
		} else {
2449
5fdfb68d0bcc renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 2428
diff changeset
  9939
		    val = __STX___new(nread + OHDR_SIZE);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9940
		    val->o_class = cls;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9941
		    bcopy(cp, __ByteArrayInstPtr(val)->ba_element, nread);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9942
		}
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9943
	    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9944
	    if (cp)
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9945
		free(cp);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9946
	}
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9947
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9948
fail: ;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9949
%}.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9950
    typeID isNil ifTrue:[
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9951
	^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9952
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9953
    aTwoArgBlock value:typeID value:val.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9954
    ^ true
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9955
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9956
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9957
getTextProperty:propertyID from:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9958
    "get a text property; return string or nil"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9959
1798
fcbbdcbd5870 clipBoardEncoding
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  9960
    |stringClass|
fcbbdcbd5870 clipBoardEncoding
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  9961
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9962
    self getProperty:propertyID from:aWindowID into:[:type :value |
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9963
	type == stringAtom ifTrue:[
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9964
	    clipBoardEncoding notNil ifTrue:[
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9965
		stringClass := (CharacterArray classForEncoding:clipBoardEncoding).
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9966
		stringClass ~~ String ifTrue:[
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9967
		    ^ stringClass fromBytes:(value asByteArray)
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9968
		].
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9969
		^ value decodeFrom:clipBoardEncoding
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9970
	    ].    
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9971
	    ^ value
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9972
	]
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9973
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9974
    ^ nil
1793
5cda147b5f33 added clipboardEncoding
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
  9975
1798
fcbbdcbd5870 clipBoardEncoding
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  9976
    "Modified: 30.6.1997 / 20:54:59 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9977
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9978
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9979
setLengthProperty:propertyID value:aNumber for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9980
    "set a size property"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9981
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9982
    ^ self 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  9983
	setProperty:propertyID 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9984
	type:(self atomIDOf:#LENGTH)
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  9985
	value:aNumber 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  9986
	for:aWindowID
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9987
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9988
    "Modified: 6.4.1997 / 13:27:26 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9989
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9990
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9991
setObjectProperty:propertyID value:anObject for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9992
    "set a property to a smalltalk object in the XServer.
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9993
     Non-strings can only be retrieved by another ST/X smalltalk"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9994
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9995
    |s|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9996
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9997
    (anObject isMemberOf:String) ifTrue:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9998
	^ self setTextProperty:propertyID value:anObject for:aWindowID
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9999
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10000
    s := WriteStream on:(ByteArray new:200).
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10001
    anObject storeBinaryOn:s.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10002
    ^ self 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10003
	setProperty:propertyID 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10004
	type:(self atomIDOf:#'ST_OBJECT' create:true) 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10005
	value:(s contents) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10006
	for:aWindowID
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10007
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10008
    "Modified: / 17.6.1998 / 17:23:49 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10009
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10010
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10011
setProperty:propertyID type:typeID value:anObject for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10012
    "set a property in the XServer"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10013
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10014
    <context: #return>
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10015
%{  /* UNLIMITEDSTACK */
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10016
    if (__isAtomID(propertyID)
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10017
     && __isAtomID(typeID) 
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10018
     && ISCONNECTED
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10019
     && (__isString(anObject) 
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10020
	 || __isSmallInteger(anObject) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10021
	 || __isSymbol(anObject) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10022
	 || __isByteArray(anObject)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10023
	 || __isWords(anObject))) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10024
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10025
	Display *dpy = myDpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10026
	Atom prop, type;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10027
	Window window;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10028
	unsigned INT value;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10029
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10030
	prop = __AtomVal(propertyID);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10031
	type = __AtomVal(typeID);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10032
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10033
	if (__isExternalAddress(aWindowID)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10034
	    window = __WindowVal(aWindowID);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10035
	} else if (__isSmallInteger(aWindowID)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10036
	    window = (Window)__smallIntegerVal(aWindowID);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10037
	} else if (aWindowID == nil) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10038
	    window = DefaultRootWindow(dpy);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10039
	} else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10040
	    window = (Window)__unsignedLongIntVal(aWindowID);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10041
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10042
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10043
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10044
	if (__isSmallInteger(anObject)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10045
	    value = __intVal(anObject);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10046
	    XChangeProperty(dpy, window, prop, type, 32,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10047
			    PropModeReplace,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10048
			    (unsigned char *)(&value), sizeof(unsigned int));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10049
	} else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10050
	    if (__isByteArray(anObject)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10051
		XChangeProperty(dpy, window, prop, type, 8,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10052
				PropModeReplace,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10053
				__ByteArrayInstPtr(anObject)->ba_element,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10054
				__byteArraySize(anObject));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10055
	    } else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10056
		/* string or symbol or wordArray-like (16bit-string) object */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10057
		if (__isWords(__qClass(anObject))) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10058
		    XChangeProperty(dpy, window, prop, type, 16,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10059
				    PropModeReplace,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10060
				    __stringVal(anObject),
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10061
				    __wordArraySize(anObject));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10062
		} else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10063
		    /* must be string or symbol */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10064
		    XChangeProperty(dpy, window, prop, type, 8,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10065
				    PropModeReplace,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10066
				    __stringVal(anObject),
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10067
				    __stringSize(anObject));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10068
		}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10069
	    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10070
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10071
	LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10072
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10073
	DPRINTF(("changeProp win=%x prop=%x type=%x\n", window, prop, type));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10074
	RETURN (true);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10075
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10076
%}.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10077
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10078
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10079
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10080
setTextProperty:propertyID value:aString for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10081
    "set a property to a stringValue in the XServer"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10082
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10083
    ^ self 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10084
	setProperty:propertyID 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10085
	type:(self atomIDOf:#STRING) 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10086
	value:aString 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10087
	for:aWindowID
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10088
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10089
    "Modified: 6.4.1997 / 13:26:32 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10090
! !
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10091
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10092
!XWorkstation methodsFor:'resources'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10093
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10094
atomIDOf:aStringOrSymbol
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10095
    "return an Atoms ID; dont create if not already present.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10096
     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
 10097
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10098
    ^ self atomIDOf:aStringOrSymbol create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10099
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10100
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10101
     Display atomIDOf:'FACE_NAME'      
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10102
     Display atomIDOf:'FULL_NAME' 
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10103
     Display atomIDOf:'DndProtocol' 
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10104
     Display atomIDOf:'DndSelection' 
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10105
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10106
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10107
    "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
 10108
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10109
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10110
atomIDOf:aStringOrSymbol create:create
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10111
    "return an Atoms ID; if create is true, create it if not already present.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10112
     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
 10113
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10114
    |atomSymbol atom|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10115
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10116
    atomSymbol := aStringOrSymbol asSymbol.   
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10117
    (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:nil) notNil]) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10118
	^ atom.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10119
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10120
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10121
    atom := self primAtomIDOf:atomSymbol create:create.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10122
    atom notNil ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10123
	atoms isNil ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10124
	    atoms := IdentityDictionary new.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10125
	].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10126
	atoms at:atomSymbol put:atom.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10127
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10128
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10129
    ^ atom
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10130
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10131
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10132
     Display atomIDOf:'VT_SELECTION' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10133
     Display atomIDOf:'CUT_BUFFER0' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10134
     Display atomIDOf:'STRING' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10135
     Display atomIDOf:'PRIMARY' create:false
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10136
    "
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10137
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10138
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10139
atomName:anAtomID
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10140
    "given an AtomID, return its name.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10141
     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
 10142
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10143
%{  /* NOCONTEXT */ 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10144
    OBJ str;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10145
    char *name;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10146
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10147
    if (ISCONNECTED
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10148
     && __isAtomID(anAtomID)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10149
	name = XGetAtomName(myDpy, __AtomVal(anAtomID));
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10150
	if (name == 0) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10151
	    RETURN (nil);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10152
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10153
	str = __MKSTRING(name);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10154
	XFree(name);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10155
	RETURN ( str );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10156
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10157
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10158
    self primitiveFailedOrClosedConnection.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10159
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10160
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10161
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10162
     Display atomName:1 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10163
     Display atomName:130  '_DEC_DEVICE_FONTNAMES'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10164
     Display atomName:132  'FONTNAME_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10165
     Display atomName:135 'FOUNDRY' 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10166
     Display atomName:150  'CHARSET_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10167
     Display atomName:151  'ISO8859'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10168
     Display atomName:152 'CHARSET_ENCODING'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10169
     Display atomName:154 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10170
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10171
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10172
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10173
getResource:name class:cls
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10174
    "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
 10175
     of name in a resource class.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10176
     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
 10177
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10178
     Notice: 
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10179
	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
 10180
	styles or resources. This would make porting of applications
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10181
	to different platforms much more difficult (Windows has no resource
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10182
	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
 10183
	easily transported to other platforms.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10184
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10185
     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
 10186
     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
 10187
     platforms."
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10188
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10189
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10190
    char *rslt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10191
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10192
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10193
     && __isNonNilObject(name)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10194
     && (__qIsString(name) || __qIsSymbol(name))
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10195
     && __isNonNilObject(cls)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10196
     && (__qIsString(cls) || __qIsSymbol(cls))) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10197
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
 10198
	rslt = XGetDefault(myDpy, (char *) __stringVal(cls),
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
 10199
				  (char *) __stringVal(name));
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10200
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10201
	RETURN (rslt ? __MKSTRING(rslt) : nil );
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10202
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10203
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10204
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10205
    ^ nil.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10206
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10207
    "if your ~/.Xdefaults contains an entry such as:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10208
	OpenWindows.Beep:       notices
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10209
     the following returns 'notices'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10210
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10211
	 Display getResource:'Beep' class:'OpenWindows'   
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10212
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10213
     if your ~/.Xdefaults contains an entry such as:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10214
	*.beNiceToColormap:       false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10215
     the following return 'false'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10216
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10217
	 Display getResource:'beNiceToColormap' class:'any'  
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10218
	 Display getResource:'beNiceToColormap' class:''  
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10219
    "
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10220
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10221
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10222
primAtomIDOf:aStringOrSymbol create:create
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10223
    "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
 10224
     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
 10225
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10226
%{  /* NOCONTEXT */
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10227
    Atom prop;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10228
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10229
    if (ISCONNECTED
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10230
     && __isNonNilObject(aStringOrSymbol)
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10231
     && (__qIsString(aStringOrSymbol) || __qIsSymbol(aStringOrSymbol))) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10232
	prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10233
				  (create == true) ? False : True);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10234
	if (prop == None) {
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10235
	    RETURN (nil);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10236
	}
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10237
	RETURN ( __MKATOMOBJ(prop) );
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10238
    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10239
%}.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10240
    self primitiveFailedOrClosedConnection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10241
    ^ nil
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10242
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10243
    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10244
     Display primAtomIDOf:'VT_SELECTION' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10245
     Display primAtomIDOf:'CUT_BUFFER0' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10246
     Display primAtomIDOf:'STRING' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10247
     Display primAtomIDOf:'PRIMARY' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10248
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10249
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10250
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10251
!XWorkstation methodsFor:'retrieving pixels'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10252
1462
f8b2909deb3c renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
 10253
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
 10254
    "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
 10255
     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
 10256
     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
 10257
     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
 10258
     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
 10259
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 10260
    |rawInfo info|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10261
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10262
    ((w <= 0) or:[h <= 0]) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10263
	self primitiveFailed.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10264
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10265
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10266
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 10267
    rawInfo := Array new:8.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10268
		  "1 -> bit order"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10269
		  "2 -> depth"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10270
		  "3 -> bytes_per_line"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10271
		  "4 -> byte_order"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10272
		  "5 -> format"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10273
		  "6 -> bitmap_unit"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10274
		  "7 -> bitmap_pad"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10275
		  "8 -> bits_per_pixel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10276
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10277
    "/ 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
 10278
    "/ unlimitedStack (some implementations use alloca and require huge amounts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10279
    "/ of temporary stack space
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10280
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 10281
    (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
 10282
	info := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10283
	info at:#bitOrder put:(rawInfo at:1).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10284
	info at:#depth put:(rawInfo at:2).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10285
	info at:#bytesPerLine put:(rawInfo at:3).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10286
	info at:#byteOrder put:(rawInfo at:4).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10287
	info at:#format put:(rawInfo at:5).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10288
	info at:#bitmapUnit put:(rawInfo at:6).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10289
	info at:#bitmapPad put:(rawInfo at:7).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10290
	info at:#bitsPerPixel put:(rawInfo at:8).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10291
	^ info
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10292
    ].
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
     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
 10295
     or is too small to hold the bits
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10296
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10297
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10298
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10299
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10300
2713
1aef3acb4e04 need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
 10301
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
 10302
    "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
 10303
     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
 10304
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10305
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10306
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10307
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 10308
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10309
    XImage *img;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10310
    int ret;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10311
    int xpos, ypos;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10312
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 10313
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 10314
     && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10315
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10316
	xpos = __intVal(x);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10317
	ypos = __intVal(y);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10318
	if ((xpos < 0) || (ypos < 0)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10319
	    RETURN ( __MKSMALLINT(0) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10320
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10321
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10322
	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
 10323
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10324
	if (img != 0) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10325
	    ret = XGetPixel(img, 0, 0);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10326
	    XDestroyImage(img);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10327
	    RETURN (  __MKSMALLINT(ret) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10328
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10329
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10330
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10331
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10332
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10333
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10334
primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10335
    "since XGetImage may allocate huge amount of stack space 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10336
     (some implementations use alloca), this must run with unlimited stack."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10337
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10338
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10339
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10340
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 10341
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10342
    XImage *image = (XImage *)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10343
    int pad, bytes_per_line, numBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10344
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10345
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10346
     && __isExternalAddress(aDrawableId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10347
     && __bothSmallInteger(srcx, srcy)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10348
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10349
     && __isArray(info)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10350
     && __isByteArray(imageBits)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10351
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10352
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10353
	win = __WindowVal(aDrawableId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10354
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10355
	image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10356
				    __intVal(w), __intVal(h),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10357
				    (unsigned)AllPlanes, ZPixmap);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10358
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10359
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10360
	if (! image) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10361
	    RETURN ( false );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10362
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10363
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10364
	pad = image->bitmap_pad;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10365
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10366
	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
 10367
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10368
	switch (image->depth) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10369
	    case 1:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10370
	    case 2:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10371
	    case 4:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10372
	    case 8:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10373
	    case 16:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10374
	    case 24:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10375
	    case 32:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10376
		numBytes = image->bytes_per_line * image->height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10377
		break;
1728
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
 10378
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10379
	    default:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10380
		/* unsupported depth ? */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10381
		printf("possibly unsupported depth:%d in primGetBits\n", image->depth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10382
		numBytes = image->bytes_per_line * image->height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10383
		break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10384
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10385
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10386
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10387
	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
 10388
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10389
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10390
	if (numBytes > __byteArraySize(imageBits)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10391
	    /* imageBits too small */
1728
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
 10392
	    fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
 10393
	    fprintf(stderr, "  bytes need:%d given:%d\n", numBytes, __byteArraySize(imageBits));
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
 10394
	    fprintf(stderr, "  pad:%d depth:%d imgBytesPerLine:%d\n", 
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
 10395
				image->bitmap_pad, image->depth, image->bytes_per_line);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10396
	    goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10397
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10398
	if (image->bitmap_bit_order == MSBFirst)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10399
	    __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10400
	else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10401
	    __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10402
	__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10403
	__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10404
	if (image->byte_order == MSBFirst)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10405
	    __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10406
	else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10407
	    __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10408
	if (image->format == XYBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10409
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10410
	else if (image->format == XYPixmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10411
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10412
	else if (image->format == ZPixmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10413
	    __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
 10414
        
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10415
	__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10416
	__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10417
	__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10418
	bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10419
	XDestroyImage(image);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10420
	RETURN ( true );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10421
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10422
fail: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10423
    if (image) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10424
	XDestroyImage(image);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10425
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10426
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10427
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10428
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10429
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10430
!XWorkstation methodsFor:'selections'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10431
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10432
getSelectionFor:drawableId
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10433
    "get the object selection - either immediate, or asynchronous.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10434
     Returns nil, if async request is on its way"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10435
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10436
    (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10437
	"no primary selection - use cut buffer"
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10438
	^ self getObjectProperty:cutBuffer0Atom from:nil.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10439
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10440
    self requestSelection:primaryAtom 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10441
		 property:(self atomIDOf:#'ST_SELECTION' create:true) 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10442
		     type:(self atomIDOf:#'ST_OBJECT' create:true) 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10443
		      for:drawableId.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10444
    ^ nil
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10445
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10446
    "Modified: / 17.6.1998 / 17:11:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10447
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10448
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10449
getSelectionOwnerOf:selectionAtomSymbolOrID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10450
    "get the owner of a selection"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10451
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10452
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10453
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10454
    selectionAtomSymbolOrID isString ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10455
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10456
    ] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10457
	selectionAtomID := selectionAtomSymbolOrID.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10458
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10459
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10460
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10461
    Atom selection;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10462
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10463
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10464
    if (__isAtomID(selectionAtomID)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10465
     && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10466
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10467
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10468
	window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
 10469
	RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10470
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10471
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10472
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10473
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10474
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10475
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10476
getTextSelectionFor:drawableId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10477
    "get the text selection -  either immediate, or asynchronous.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10478
     Returns nil, if async request is on its way"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10479
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10480
    (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10481
	"no primary selection - use cut buffer"
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10482
	^ self getTextProperty:cutBuffer0Atom from:nil.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10483
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10484
    self requestSelection:primaryAtom 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10485
		 property:(self atomIDOf:#'VT_SELECTION' create:true) 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10486
		     type:stringAtom 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10487
		      for:drawableId.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10488
    ^ nil
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10489
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10490
    "Modified: / 17.6.1998 / 17:12:05 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10491
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10492
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10493
requestSelection:selectionID property:propertyID type:typeID for:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10494
    "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
 10495
     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
 10496
     with the selections value)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10497
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10498
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10499
    Atom sel_prop;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10500
    char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10501
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10502
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10503
     && ISCONNECTED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10504
     && __isSmallInteger(typeID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10505
     && __isAtomID(selectionID)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10506
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10507
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10508
	if (XGetSelectionOwner(dpy, __AtomVal(selectionID)) == None) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10509
	    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10510
	     * no owner of primary selection
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10511
	     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10512
	    RETURN (false);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10513
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10514
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10515
	 * PRIMARY selection
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10516
	 */
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10517
	XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID), 
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10518
			       __AtomVal(propertyID), __WindowVal(aWindowId), CurrentTime);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10519
	RETURN (true);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10520
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10521
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10522
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10523
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10524
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10525
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10526
     Display requestSelection:(Display atomIDOf:'PRIMARY')
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10527
		     property:(Display atomIDOf:'VT_SELECTION')
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10528
			  for:0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10529
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10530
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10531
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10532
sendSelection:something selection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10533
    "send aString back from a SelectionRequest"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10534
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10535
    self 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10536
	setProperty:propertyID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10537
	type:targetID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10538
	value:something 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10539
	for:requestorID.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10540
    self 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10541
	sendSelectionNotifySelection:selectionID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10542
	property:propertyID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10543
	target:targetID
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10544
	time:t 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10545
	from:windowID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10546
	to:requestorID.
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10547
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10548
    "Modified: / 17.6.1998 / 17:03:20 / cg"
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10549
    "Created: / 17.6.1998 / 19:44:03 / cg"
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10550
!
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10551
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10552
sendSelectionNotifySelection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10553
    "send a selectionNotify back from a SelectionRequest"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10554
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10555
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10556
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10557
    if (__isAtomID(propertyID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10558
     && ISCONNECTED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10559
     && __isAtomID(targetID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10560
     && __isAtomID(selectionID)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10561
	Display *dpy = myDpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10562
	XEvent ev;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10563
	Window requestor, originator;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10564
	Atom property = __AtomVal(propertyID);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10565
	Atom target = __AtomVal(targetID);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10566
	Atom selection = __AtomVal(selectionID);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10567
	Status result;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10568
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10569
	if (__isExternalAddress(requestorID)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10570
	    requestor = __WindowVal(requestorID);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10571
	} else if (__isSmallInteger(requestorID)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10572
	    requestor = (Window)__smallIntegerVal(requestorID);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10573
	} else if (requestorID == nil) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10574
	    requestor = DefaultRootWindow(dpy);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10575
	} else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10576
	    requestor = (Window)__unsignedLongIntVal(requestorID);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10577
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10578
	if (__isExternalAddress(windowID)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10579
	    originator = __WindowVal(windowID);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10580
	} else if (__isSmallInteger(windowID)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10581
	    originator = (Window)__smallIntegerVal(windowID);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10582
	} else if (windowID == nil) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10583
	    originator = DefaultRootWindow(dpy);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10584
	} else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10585
	    originator = (Window)__unsignedLongIntVal(windowID);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10586
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10587
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10588
	ev.xselection.type = SelectionNotify;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10589
	ev.xselection.display = dpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10590
	ev.xselection.selection = selection;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10591
	ev.xselection.target = target;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10592
	ev.xselection.requestor = originator;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10593
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10594
	if (__isExternalAddress(t)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10595
	    ev.xselection.time = (INT)(__externalAddressVal(t));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10596
	} else if (__isSmallInteger(t)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10597
	    ev.xselection.time = __smallIntegerVal(t);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10598
	} else if (t == nil) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10599
	    ev.xselection.time = CurrentTime;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10600
	} else {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10601
	    ev.xselection.time = (INT)__unsignedLongIntVal(t);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10602
	}
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
 10603
#if 0
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10604
	printf("ev.xselection.selection: %x\n", ev.xselection.selection);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10605
	printf("ev.xselection.target: %x\n", ev.xselection.target);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10606
	printf("ev.xselection.requestor: %x\n", ev.xselection.requestor);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10607
	printf("ev.xselection.time: %x\n", ev.xselection.time);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10608
	printf("requestor: %x\n", requestor);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10609
#endif
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10610
	if (property == None)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10611
	    ev.xselection.property = target;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10612
	else
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10613
	    ev.xselection.property = property;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10614
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10615
	DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n",
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10616
		ev.xselection.selection,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10617
		ev.xselection.property,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10618
		ev.xselection.target,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10619
		ev.xselection.requestor,
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10620
		requestor));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10621
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10622
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10623
	result = XSendEvent(dpy, requestor, False, 0 , &ev);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10624
	LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10625
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10626
	if ((result == BadValue) || (result == BadWindow)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10627
	    DPRINTF(("bad status\n"));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10628
	    RETURN (false);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10629
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10630
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10631
	XFlush(dpy);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10632
	LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10633
	RETURN (true)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10634
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10635
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10636
    self primitiveFailedOrClosedConnection.
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
 10637
    ^ false
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10638
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10639
    "Modified: / 17.6.1998 / 20:23:20 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10640
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10641
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10642
setSelection:anObject owner:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10643
    "set the object selection, and make aWindowId be the owner.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10644
     This can be used by other Smalltalk(X) applications only."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10645
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10646
    (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10647
	^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10648
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10649
"/    ^ self setObjectProperty:cutBuffer0Atom value:anObject for:nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10650
    ^ true
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10651
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10652
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10653
setSelectionOwner:aWindowId of:selectionAtomSymbolOrID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10654
    "set the owner of a selection; return false if failed"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10655
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10656
    <context: #return>
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10657
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10658
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10659
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10660
    selectionAtomSymbolOrID isString ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10661
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10662
    ] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10663
	selectionAtomID := selectionAtomSymbolOrID.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10664
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10665
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10666
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10667
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10668
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10669
    if (__isExternalAddress(aWindowId)
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10670
     && __isAtomID(selectionAtomID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10671
     && ISCONNECTED) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10672
	Display *dpy = myDpy;
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10673
	Window owner;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10674
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10675
	win = __WindowVal(aWindowId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10676
	DPRINTF(("setOwner prop=%x win=%x\n", __AtomVal(selectionAtomID), win));
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10677
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10678
	XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, CurrentTime);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10679
	owner = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10680
	LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10681
	if (owner != win) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10682
	    RETURN (false);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10683
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10684
	RETURN (true);
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10685
    }
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10686
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10687
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10688
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10689
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10690
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10691
setTextSelection:aString owner:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10692
    "set the text selection, and make aWindowId be the owner.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10693
     This can be used by any other X application."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10694
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10695
    (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10696
	'XWorkstation [warning]: selection ownerchange failed' errorPrintCR.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10697
    ].
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10698
    ^ self setTextProperty:cutBuffer0Atom value:aString for:rootId.
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10699
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10700
    "Modified: / 17.6.1998 / 19:48:54 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10701
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10702
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10703
!XWorkstation methodsFor:'window stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10704
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10705
clearRectangleX:x y:y width:width height:height in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10706
    "clear a rectangular area to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10707
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10708
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10709
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10710
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10711
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10712
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10713
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10714
	if (__isExternalAddress(aWindowId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10715
	 && __bothSmallInteger(x, y)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10716
	 && __bothSmallInteger(width, height)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10717
	    w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10718
	    h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10719
	    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10720
	     * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10721
	     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10722
	    if ((w >= 0) && (h >= 0)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10723
		ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10724
		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
 10725
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10726
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10727
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10728
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10729
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10730
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10731
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10732
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10733
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10734
clearWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10735
    "clear a window to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10736
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10737
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10738
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10739
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10740
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10741
	if (__isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10742
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10743
	    XClearWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10744
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10745
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10746
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10747
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10748
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10749
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10750
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10751
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10752
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10753
    "configure stacking operation of aWindowId w.r.t siblingId"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10754
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10755
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10756
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10757
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10758
    XWindowChanges chg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10759
    int mask = CWSibling | CWStackMode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10760
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10761
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10762
	if (__isExternalAddress(aWindowId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10763
	 && __isExternalAddress(siblingId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10764
	    if (modeSymbol == @symbol(above)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10765
		chg.stack_mode = Above;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10766
	    } else if (modeSymbol == @symbol(below)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10767
		chg.stack_mode = Below;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10768
	    } else if (modeSymbol == @symbol(topIf)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10769
		chg.stack_mode = TopIf;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10770
	    } else if (modeSymbol == @symbol(bottomIf)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10771
		chg.stack_mode = BottomIf;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10772
	    } else if (modeSymbol == @symbol(opposite)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10773
		chg.stack_mode = Opposite;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10774
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10775
		mask = CWSibling;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10776
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10777
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10778
	    chg.sibling = __WindowVal(siblingId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10779
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10780
	    XConfigureWindow(myDpy, __WindowVal(aWindowId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10781
				    mask, &chg);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10782
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10783
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10784
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10785
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10786
bad: ;
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10787
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10788
    self primitiveFailedOrClosedConnection
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
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10791
isValidWindowId:aWindowId
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10792
    "return true, if the given window ID is (still) valid.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10793
     Especially useful, if the passed windowID is 
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10794
     an alien (external) windows id."
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10795
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10796
    |ret|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10797
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10798
%{ 
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10799
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10800
    if (ISCONNECTED
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10801
     && __isExternalAddress(aWindowId)) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10802
	char *name = NULL;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10803
	Status ok;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10804
	Window root, parent, *children = NULL;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10805
	int nChildren;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10806
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10807
/*        ENTER_XLIB(); */
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10808
	ok = XQueryTree(myDpy, __WindowVal(aWindowId), 
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10809
			&root, &parent, &children, &nChildren);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10810
	if (children) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10811
	    XFree(children);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10812
	}
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10813
/*        LEAVE_XLIB();   */
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10814
	if (ok) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10815
	    RETURN (true);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10816
	}
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10817
	RETURN (false);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10818
    }
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10819
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10820
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10821
    ^ false
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10822
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10823
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10824
     |v aWindowId ok|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10825
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10826
     v := StandardSystemView new.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10827
     v label:'hello'.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10828
     v openAndWait.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10829
     aWindowId := v id.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10830
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10831
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10832
     Delay waitForSeconds:1.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10833
     v destroy.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10834
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10835
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10836
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10837
!
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10838
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10839
lowerWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10840
    "bring a window to back"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10841
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10842
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10843
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10844
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10845
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10846
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10847
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10848
	XLowerWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10849
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10850
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10851
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10852
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10853
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10854
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10855
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10856
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos 
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10857
	      width:w height:h minExtent:minExt maxExtent:maxExt
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10858
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10859
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10860
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10861
    "make a window visible - either as icon or as a real view 
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10862
     in addition, allow change of extend, position, minExtend and maxExtent.
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10863
     Needed for restart, to allow recreating a view as iconified,
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10864
     and to collaps/expand windows."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10865
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10866
    |wicon wiconId wiconView wiconViewId wlabel minW minH maxW maxH|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10867
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10868
    aBoolean ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10869
	wicon := aView icon.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10870
	wicon notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10871
	    wiconId := wicon id
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10872
	].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10873
	wiconView := aView iconView.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10874
	wiconView notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10875
	    wiconViewId := wiconView id
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10876
	].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10877
	wlabel := aView label.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10878
    ].
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10879
    minExt notNil ifTrue:[
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10880
	minW := minExt x.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10881
	minH := minExt y.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10882
    ].
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10883
    maxExt notNil ifTrue:[
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10884
	maxW := maxExt x.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10885
	maxH := maxExt y.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10886
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10887
%{  
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10888
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10889
    XWMHints wmhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10890
    XSizeHints szhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10891
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10892
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10893
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10894
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10895
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10896
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10897
	win = __WindowVal(aWindowId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10898
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10899
	szhints.flags = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10900
	if (__bothSmallInteger(xPos, yPos)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10901
	    szhints.x = __intVal(xPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10902
	    szhints.y = __intVal(yPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10903
	    szhints.flags |= USPosition;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10904
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10905
	if (__bothSmallInteger(w, h)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10906
	    szhints.width = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10907
	    szhints.height = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10908
	    szhints.flags |= USSize;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10909
	}
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10910
	if (__bothSmallInteger(minW, minH)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10911
	    szhints.flags |= PMinSize;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10912
	    szhints.min_width = __intVal(minW);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10913
	    szhints.min_height = __intVal(minH);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10914
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10915
	if (__bothSmallInteger(maxW, maxH)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10916
	    szhints.flags |= PMaxSize;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10917
	    szhints.max_width = __intVal(maxW);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10918
	    szhints.max_height = __intVal(maxH);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10919
	}
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10920
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10921
	if (aBoolean == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10922
	    char *windowName;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10923
	    Pixmap iconBitmap = (Pixmap)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10924
	    Window iconWindow;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10925
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10926
	    if (__isExternalAddress(wiconId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10927
		iconBitmap = __PixmapVal(wiconId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10928
	    else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10929
		iconBitmap = (Pixmap)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10930
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10931
	    if (__isExternalAddress(wiconViewId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10932
		iconWindow = __WindowVal(wiconViewId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10933
	    else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10934
		iconWindow = (Window)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10935
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10936
	    if (__isString(wlabel) || __isSymbol(wlabel))
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
 10937
		windowName = (char *) __stringVal(wlabel);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10938
	    else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10939
		windowName = "";
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10940
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10941
	    if (iconBitmap || windowName) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10942
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10943
		XSetStandardProperties(dpy, win,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10944
					windowName, windowName,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10945
					iconBitmap,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10946
					0, 0, &szhints);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10947
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10948
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10949
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10950
	    wmhints.flags = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10951
	    if (iconBitmap) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10952
		wmhints.flags |= IconPixmapHint;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10953
		wmhints.icon_pixmap = iconBitmap;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10954
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10955
	    if (iconWindow) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10956
		wmhints.flags |= IconWindowHint;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10957
		wmhints.icon_window = iconWindow;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10958
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10959
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10960
	    wmhints.initial_state = IconicState;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10961
	    wmhints.flags |= StateHint;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10962
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10963
	    XSetWMHints(dpy, win, &wmhints);
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
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10966
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10967
	if (szhints.flags) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10968
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10969
	    XSetNormalHints(dpy, win, &szhints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10970
	    LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10971
	}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10972
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10973
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10974
	XMapWindow(dpy, win);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10975
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10976
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10977
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10978
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10979
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10980
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10981
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10982
mapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10983
    "make a window visible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10984
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10985
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10986
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10987
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10988
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10989
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10990
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10991
	XMapWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10992
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10993
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10994
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10995
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10996
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10997
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10998
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10999
moveResizeWindow:aWindowId x:x y:y width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11000
    "move and resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11001
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11002
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11003
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11004
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11005
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11006
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11007
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11008
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11009
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11010
     && __bothSmallInteger(x, y)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11011
	newWidth = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11012
	newHeight = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11013
	if (newWidth < 1) newWidth = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11014
	if (newHeight < 1) newHeight = 1;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11015
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11016
	XMoveResizeWindow(myDpy, __WindowVal(aWindowId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11017
			      __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11018
			      newWidth, newHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11019
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11020
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11021
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11022
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11023
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11024
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11025
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11026
moveWindow:aWindowId x:x y:y
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11027
    "move a window"
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>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
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) && __bothSmallInteger(x, y)) {
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
	XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y));
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
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11041
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11042
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11043
raiseWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11044
    "bring a window to front"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11045
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11046
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11047
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11048
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11049
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11050
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11051
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11052
	XRaiseWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11053
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11054
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11055
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11056
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11057
    self primitiveFailedOrClosedConnection
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11058
!
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11059
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11060
reparentWindow:windowId to:newParentWindowId
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11061
    "change a windows parent (an optional interface)"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11062
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11063
    <context: #return>
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11064
%{
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11065
    if (ISCONNECTED
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11066
     && __isExternalAddress(windowId)
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11067
     && __isExternalAddress(newParentWindowId)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11068
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11069
	Window _child, _newParent;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11070
	int i;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11071
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11072
	_child = __WindowVal(windowId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11073
	_newParent = __WindowVal(newParentWindowId);
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11074
	ENTER_XLIB();
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11075
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 11076
#if 0
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11077
	XWithdrawWindow (dpy, _child, DefaultScreen(dpy));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11078
	XSync (dpy, 0);
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 11079
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11080
	/*
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11081
	 * Code 'stolen' from xswallow source ...
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11082
	 * ... mhmh - what is this loop for ?
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11083
	 */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11084
	for (i=0; i<5; i++) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11085
	    XReparentWindow (dpy, _child, _newParent, 0, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11086
	    XSync (dpy, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11087
	}
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 11088
#if 0
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11089
	XMapWindow (dpy, _child);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11090
	XSync (dpy, 0);
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 11091
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11092
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 11093
	RETURN ( true );
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11094
    }
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11095
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11096
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11097
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11098
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11099
resizeWindow:aWindowId width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11100
    "resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11101
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11102
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11103
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11104
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11105
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11106
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11107
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11108
     && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11109
	newWidth = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11110
	newHeight = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11111
	if (newWidth < 1) newWidth = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11112
	if (newHeight < 1) newHeight = 1;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11113
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11114
	XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11115
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11116
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11117
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11118
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11119
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11120
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11121
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11122
setBackingStore:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11123
    "turn on/off backing-store for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11124
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11125
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11126
%{  
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
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11129
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11130
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11131
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11132
	if (__INST(ignoreBackingStore) != true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11133
	    if (how == @symbol(always)) wa.backing_store = Always;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11134
	    else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11135
	    else if (how == true) wa.backing_store = Always;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11136
	    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
 11137
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11138
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11139
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11140
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11141
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11142
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11143
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11144
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11145
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11146
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11147
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11148
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11149
setBitGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11150
    "set bit gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11151
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11152
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11153
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11154
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11155
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11156
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11157
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11158
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11159
	if (how == @symbol(NorthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11160
	    wa.bit_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11161
	} else if (how == @symbol(NorthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11162
	    wa.bit_gravity = NorthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11163
	} else if (how == @symbol(SouthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11164
	    wa.bit_gravity = SouthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11165
	} else if (how == @symbol(SouthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11166
	    wa.bit_gravity = SouthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11167
	} else if (how == @symbol(Center)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11168
	    wa.bit_gravity = CenterGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11169
	} else if (how == @symbol(North)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11170
	    wa.bit_gravity = NorthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11171
	} else if (how == @symbol(South)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11172
	    wa.bit_gravity = SouthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11173
	} else if (how == @symbol(West)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11174
	    wa.bit_gravity = WestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11175
	} else if (how == @symbol(East)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11176
	    wa.bit_gravity = EastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11177
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11178
	    wa.bit_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11179
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11180
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11181
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11182
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11183
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11184
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11185
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11186
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11187
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11188
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11189
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11190
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11191
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11192
setCursor:aCursorId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11193
    "define a windows cursor"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11194
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11195
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11196
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11197
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11198
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11199
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11200
     && __isExternalAddress(aCursorId)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11201
	Display *dpy = myDpy;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11202
	Window w = __WindowVal(aWindowId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11203
	Cursor c = __CursorVal(aCursorId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11204
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11205
	if (w && c) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11206
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11207
	    XDefineCursor(dpy, w, c);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11208
	    LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11209
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11210
	RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11211
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11212
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11213
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11214
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11215
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11216
setIconName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11217
    "define a windows iconname"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11218
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11219
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11220
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11221
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11222
    if (ISCONNECTED
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11223
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11224
     && (__qIsString(aString) || __qIsSymbol(aString))
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11225
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11226
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11227
	XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11228
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11229
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11230
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11231
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11232
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11233
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11234
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11235
setSaveUnder:yesOrNo in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11236
    "turn on/off save-under for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11237
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11238
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11239
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11240
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11241
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11242
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11243
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11244
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11245
	if (__INST(hasSaveUnder) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11246
	    wa.save_under = (yesOrNo == true) ? 1 : 0;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11247
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11248
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11249
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11250
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11251
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11252
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11253
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11254
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11255
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11256
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11257
setTransient:aWindowId for:aMainWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11258
    "set aWindowId to be a transient of aMainWindow"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11259
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11260
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11261
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11262
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11263
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11264
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11265
	Window w;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11266
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11267
	if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11268
	    w = (Window) 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11269
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11270
	    if (__isExternalAddress(aMainWindowId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11271
		w = __WindowVal(aMainWindowId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11272
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11273
		goto getOutOfHere;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11274
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11275
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11276
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11277
	XSetTransientForHint(myDpy, __WindowVal(aWindowId), w);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11278
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11279
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11280
    }
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
 11281
 getOutOfHere: ;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11282
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11283
    self primitiveFailedOrClosedConnection
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11286
setWindowBackground:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11287
    "set the windows background color. This is the color with which
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11288
     the view is filled whenever exposed. Do not confuse this with
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11289
     the background drawing color, which is used with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11290
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11291
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11292
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11293
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11294
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11295
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11296
     && __isSmallInteger(aColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11297
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11298
	XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11299
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11300
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11301
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11302
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11303
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11304
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11305
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11306
setWindowBackgroundPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11307
    "set the windows background pattern to be a form.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11308
     This is the pattern with which the view is filled whenever exposed. 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11309
     Do not confuse this with the background drawing color, which is used 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11310
     with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11311
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11312
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11313
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11314
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11315
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11316
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11317
     && __isExternalAddress(aPixmapId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11318
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11319
	XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11320
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11321
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11322
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11323
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11324
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11325
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11326
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11327
setWindowBorderColor:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11328
    "set the windows border color"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11329
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11330
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11331
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11332
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11333
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11334
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11335
     && __isSmallInteger(aColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11336
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11337
	XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11338
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11339
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11340
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11341
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11342
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11343
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11344
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11345
setWindowBorderPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11346
    "set the windows border pattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11347
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11348
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11349
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11350
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11351
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11352
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11353
     && __isExternalAddress(aPixmapId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11354
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11355
	XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11356
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11357
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11358
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11359
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11360
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11361
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11362
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11363
setWindowBorderShape:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11364
    "set the windows border shape"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11365
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11366
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11367
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11368
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11369
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11370
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11371
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11372
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11373
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11374
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11375
    if (__isExternalAddress(aPixmapId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11376
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11377
    else
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11378
	shapeBitmap = (Pixmap)0;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11379
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11380
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11381
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11382
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11383
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding,
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11384
			  0, 0, shapeBitmap, ShapeSet);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11385
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11386
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11387
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11388
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11389
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11390
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11391
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11392
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11393
setWindowBorderWidth:aNumber in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11394
    "set the windows border width"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11395
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11396
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11397
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11398
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11399
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11400
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11401
     && __isSmallInteger(aNumber)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11402
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11403
	XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11404
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11405
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11406
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11407
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11408
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11409
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11410
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11411
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
 11412
    "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
 11413
     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
 11414
     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
 11415
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11416
    <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
 11417
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11418
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11419
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11420
	XClassHint classhint;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11421
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11422
	classhint.res_class = classhint.res_name = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11423
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11424
	if (__isString(wClass) || __isSymbol(wClass)) {
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
 11425
	    classhint.res_class = (char *) __stringVal(wClass);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11426
	} else if (wClass != nil)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11427
	    goto error;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11428
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11429
	if (__isString(wName) || __isSymbol(wName)) {
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
 11430
	    classhint.res_name = (char *) __stringVal(wName);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11431
	} else if (wName != nil)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11432
	    goto error;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11433
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11434
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11435
	XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11436
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11437
	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
 11438
error:;
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11439
    }
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11440
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11441
    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
 11442
!
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11443
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11444
setWindowGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11445
    "set window gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11446
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11447
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11448
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11449
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11450
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11451
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11452
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11453
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11454
	if (how == @symbol(NorthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11455
	    wa.win_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11456
	} else if (how == @symbol(NorthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11457
	    wa.win_gravity = NorthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11458
	} else if (how == @symbol(SouthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11459
	    wa.win_gravity = SouthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11460
	} else if (how == @symbol(SouthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11461
	    wa.win_gravity = SouthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11462
	} else if (how == @symbol(Center)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11463
	    wa.win_gravity = CenterGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11464
	} else if (how == @symbol(North)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11465
	    wa.win_gravity = NorthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11466
	} else if (how == @symbol(South)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11467
	    wa.win_gravity = SouthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11468
	} else if (how == @symbol(West)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11469
	    wa.win_gravity = WestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11470
	} else if (how == @symbol(East)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11471
	    wa.win_gravity = EastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11472
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11473
	    wa.win_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11474
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11475
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11476
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11477
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11478
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11479
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11480
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11481
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11482
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11483
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11484
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11485
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11486
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11487
setWindowIcon:aForm in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11488
    "define a bitmap to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11489
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11490
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11491
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11492
    |iconId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11493
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11494
    aForm notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11495
	iconId := aForm id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11496
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11497
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11498
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11499
     && __isExternalAddress(iconId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11500
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11501
	XWMHints hints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11502
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11503
	hints.icon_pixmap = __PixmapVal(iconId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11504
	hints.flags = IconPixmapHint;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11505
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11506
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11507
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11508
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11509
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11510
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11511
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11512
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11513
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11514
setWindowIcon:aForm mask:aMaskForm in:aWindowId
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11515
    "define a windows icon and (optional) iconMask."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11516
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11517
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11518
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11519
    |iconId maskId|
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11520
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11521
    aForm notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11522
	iconId := aForm id
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11523
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11524
    aMaskForm notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11525
	maskId := aMaskForm id.
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11526
    ].
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
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11529
     && __isExternalAddress(iconId)
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11530
     && __isExternalAddress(aWindowId)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11531
	XWMHints hints;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11532
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11533
	hints.icon_pixmap = __PixmapVal(iconId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11534
	hints.flags = IconPixmapHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11535
	if ((maskId != nil)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11536
	 && __isExternalAddress(maskId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11537
	    hints.icon_mask = __PixmapVal(maskId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11538
	    hints.flags |= IconMaskHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11539
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11540
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11541
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11542
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11543
	RETURN ( self );
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11544
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11545
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11546
    self primitiveFailedOrClosedConnection
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11547
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11548
!
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11549
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11550
setWindowIconWindow:aView in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11551
    "define a window to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11552
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11553
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11554
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11555
    |iconWindowId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11556
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11557
    aView notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11558
	iconWindowId := aView id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11559
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11560
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11561
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11562
     && __isExternalAddress(iconWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11563
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11564
	XWMHints wmhints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11565
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11566
	wmhints.icon_window = __WindowVal(iconWindowId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11567
	wmhints.flags = IconWindowHint;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11568
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11569
	XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11570
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11571
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11572
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11573
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11574
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11575
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11576
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
 11577
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
 11578
    "set a windows minimum & max extents.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11579
     nil arguments are ignored."
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11580
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11581
    <context: #return>
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11582
%{  
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11583
    if (ISCONNECTED
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11584
     && __isExternalAddress(aWindowId)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11585
	Display *dpy = myDpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11586
	XSizeHints szhints;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11587
	Window win;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11588
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11589
	win = __WindowVal(aWindowId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11590
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11591
	szhints.flags = 0;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11592
	if (__bothSmallInteger(minW, minH)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11593
	    szhints.flags |= PMinSize;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11594
	    szhints.min_width = __intVal(minW);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11595
	    szhints.min_height = __intVal(minH);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11596
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11597
	if (__bothSmallInteger(maxW, maxH)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11598
	    szhints.flags |= PMaxSize;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11599
	    szhints.max_width = __intVal(maxW);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11600
	    szhints.max_height = __intVal(maxH);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11601
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11602
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11603
	if (szhints.flags) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11604
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11605
	    XSetNormalHints(dpy, win, &szhints);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11606
	    LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11607
	}
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11608
    }
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11609
%}.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11610
!
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11611
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11612
setWindowName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11613
    "define a windows name"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11614
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11615
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11616
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11617
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11618
    if (ISCONNECTED
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11619
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11620
     && (__qIsString(aString) || __qIsSymbol(aString))
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11621
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11622
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11623
	XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11624
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11625
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11626
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11627
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11628
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11629
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11630
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11631
setWindowShape:aPixmapId in:aWindowId
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11632
    "set the windows shape.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11633
     Returns false, if the display does not support the
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11634
     X shape extension."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11635
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11636
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11637
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11638
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11639
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11640
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11641
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11642
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11643
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11644
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11645
    if (__isExternalAddress(aPixmapId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11646
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11647
    else
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11648
	shapeBitmap = (Pixmap)0;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11649
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11650
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11651
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11652
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11653
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip,
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11654
			  0, 0,
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11655
			  shapeBitmap, ShapeSet);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11656
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11657
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11658
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11659
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11660
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11661
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11662
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11663
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11664
unmapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11665
    "make a window invisible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11666
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11667
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11668
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11669
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 11670
    if (!ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11671
	RETURN ( self );
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 11672
    }
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 11673
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 11674
    if (__isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11675
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11676
	XUnmapWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11677
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11678
	RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11679
    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11680
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11681
    self primitiveFailedOrClosedConnection
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11682
!
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11683
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11684
windowIsIconified:aWindowId
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11685
    "return true, if some window is iconified.
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11686
     The passed windowID may be an alien windows id."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11687
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11688
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11689
%{  
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11690
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11691
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11692
     && __isExternalAddress(aWindowId)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11693
	Atom JunkAtom;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11694
	int JunkInt;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11695
	unsigned long WinState,JunkLong;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11696
	unsigned char *Property;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11697
	Atom WM_STATE_Atom;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11698
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11699
	if (__INST(wmStateAtom) != nil) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11700
	    WM_STATE_Atom = __AtomVal(__INST(wmStateAtom));
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11701
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11702
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11703
	    XGetWindowProperty(myDpy, __WindowVal(aWindowId),
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11704
			       WM_STATE_Atom,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11705
			       0L, 2L, False, AnyPropertyType,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11706
			       &JunkAtom,&JunkInt,&WinState,&JunkLong,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11707
			       &Property);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11708
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11709
	    WinState=(unsigned long)(*((long*)Property));
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11710
	    if (WinState==3) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11711
		RETURN (true);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11712
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11713
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11714
	RETURN (false);
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11715
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11716
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11717
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11718
    ^ false "/ or true or what ?
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11719
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11720
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
 11721
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11722
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11723
version
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 11724
    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.378 2000-10-09 14:28:46 cg Exp $'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11725
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11726
XWorkstation initialize!