XWorkstation.st
author Claus Gittinger <cg@exept.de>
Fri, 05 Mar 2004 12:12:16 +0100
changeset 4067 95d3cc7b4f62
parent 4061 10f8f47f03a3
child 4082 cb6eb58e8311
permissions -rw-r--r--
getEvent: return symbols for keys (used to return strings)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
     1
"{ Encoding: utf8 }"
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
     2
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     3
"
6
7ee0cfde237d *** empty log message ***
claus
parents: 5
diff changeset
     4
COPYRIGHT (c) 1989 by Claus Gittinger
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
     5
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    13
"
48194c26a46c Initial revision
claus
parents:
diff changeset
    14
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
    15
"{ 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
    16
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    17
DeviceWorkstation subclass:#XWorkstation
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
    18
	instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    19
		hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    20
		hasImageExtension hasInputExtension ignoreBackingStore blackpixel
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
    21
		whitepixel atoms protocolsAtom deleteWindowAtom saveYourselfAtom
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
    22
		quitAppAtom primaryAtom clipboardAtom stringAtom wmStateAtom
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
    23
		listOfXFonts buttonsPressed eventRootX eventRootY displayName
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
    24
		eventTrace dispatchingExpose rgbVisual virtualRootId rootId
3799
65c6905e1250 Instvar eventbuffer no longer needed
Stefan Vogel <sv@exept.de>
parents: 3798
diff changeset
    25
		altModifierMask metaModifierMask multiClickTime
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
    26
		deviceIOTimeoutErrorSignal activateOnClick rawKeySymTranslation
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
    27
		selectionOwner'
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
    28
	classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
    29
		SelectionHandlers'
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    30
	poolDictionaries:''
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    31
	category:'Interface-Graphics'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
    32
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    33
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
    34
!XWorkstation primitiveDefinitions!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    35
%{
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    36
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    37
#ifdef LINUX
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    38
# define SHM
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    39
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    40
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    41
#define COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    42
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    43
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    44
static int __cnt_color = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    45
static int __cnt_bitmap = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    46
static int __cnt_view = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    47
static int __cnt_gc = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    48
static int __cnt_cursor = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    49
static int __cnt_font = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    50
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    51
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    52
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    53
/*
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    54
 * x does a typedef Time - I need Object Time ...
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    55
 */
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    56
#undef Time
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    57
#define Time XTime
48194c26a46c Initial revision
claus
parents:
diff changeset
    58
391
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
 * x does a #define True / False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    61
 * 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
    62
 */
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    63
#undef True
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    64
#undef False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    65
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    66
#ifdef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    67
# undef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    68
#endif
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    69
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
    70
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    71
#include <stdio.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    72
#include <X11/Xlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    73
#include <X11/Xutil.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    74
#include <X11/Xatom.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    75
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    76
#define XK_MISCELLANY
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    77
#include <X11/keysymdef.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    78
277
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    79
#include <X11/cursorfont.h>
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    80
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    81
#ifdef LINUX
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    82
# include <sys/socket.h>
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    83
#endif
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    84
2422
6bffcb4c8360 changes for egcs (__new in stdio)
Claus Gittinger <cg@exept.de>
parents: 2386
diff changeset
    85
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
    86
/*
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    87
 * this define suppresses XAllocColor/XFreeColor on
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    88
 * 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
    89
 * 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
    90
 */
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    91
#define QUICK_TRUE_COLORS
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    92
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    93
/*
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    94
 * shape support works; enabled by -DSHAPE in makefile
48194c26a46c Initial revision
claus
parents:
diff changeset
    95
 * see RoundClock and RoundGlobe examples
48194c26a46c Initial revision
claus
parents:
diff changeset
    96
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
    97
#ifdef SHAPE
48194c26a46c Initial revision
claus
parents:
diff changeset
    98
# include <X11/extensions/shape.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    99
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   100
48194c26a46c Initial revision
claus
parents:
diff changeset
   101
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   102
 * shared memory extension access is currently not supported
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   103
 * (only query is implemented)
48194c26a46c Initial revision
claus
parents:
diff changeset
   104
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   105
#ifdef SHM
48194c26a46c Initial revision
claus
parents:
diff changeset
   106
# include <X11/extensions/XShm.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   107
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   108
48194c26a46c Initial revision
claus
parents:
diff changeset
   109
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   110
 * multiBuffer extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   111
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   112
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   113
#ifdef MBUF
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   114
# include <X11/extensions/multibuf.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   115
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   116
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   117
/*
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   118
 * XVideo extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   119
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   120
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   121
#ifdef XVIDEO
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   122
# include <X11/extensions/Xv.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   123
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   124
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   125
/*
186
claus
parents: 180
diff changeset
   126
 * PEX extension - if available
claus
parents: 180
diff changeset
   127
 */
claus
parents: 180
diff changeset
   128
#ifdef PEX5
claus
parents: 180
diff changeset
   129
# include <PEX5/PEX.h>
claus
parents: 180
diff changeset
   130
#endif
claus
parents: 180
diff changeset
   131
claus
parents: 180
diff changeset
   132
/*
claus
parents: 180
diff changeset
   133
 * XImage extension - if available
claus
parents: 180
diff changeset
   134
 */
claus
parents: 180
diff changeset
   135
#ifdef XIE
claus
parents: 180
diff changeset
   136
# include <X11/extensions/XIE.h>
claus
parents: 180
diff changeset
   137
#endif
claus
parents: 180
diff changeset
   138
claus
parents: 180
diff changeset
   139
/*
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   140
 * when I have more time to check it out, I will support display-PS
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   141
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   142
#ifdef DPS
48194c26a46c Initial revision
claus
parents:
diff changeset
   143
# ifdef sgi
48194c26a46c Initial revision
claus
parents:
diff changeset
   144
#  include <X11/extensions/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   145
#  include <X11/extensions/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   146
#  include <X11/extensions/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   147
# else
48194c26a46c Initial revision
claus
parents:
diff changeset
   148
#  include <DPS/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   149
#  include <DPS/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   150
#  include <DPS/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   151
# endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   152
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   153
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   154
#if defined(someMachine)
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   155
/*
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   156
 * if nformats cannot be found in the Display structure ...
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
# define NO_PRIVATE_DISPLAY_ACCESS
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   159
#endif
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   160
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   161
#if defined(IRIX5) || defined(__VMS) || (XlibSpecificationRelease == 6)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   162
  /*
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   163
   * accessing private data in Display ... sorry
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   164
   */
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   165
# define DISPLAYACCESS(d) ((_XPrivDisplay)d)
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   166
#else
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   167
# define DISPLAYACCESS(d) d
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   168
#endif
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   169
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   170
/*
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   171
 * some defines - tired of typing ...
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   172
 */
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   173
#define __DisplayVal(o)      (Display *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   174
#define __DrawableVal(o)     (Drawable)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   175
#define __WindowVal(o)       (Window)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   176
#define __PixmapVal(o)       (Pixmap)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   177
#define __GCVal(o)           (GC)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   178
#define __CursorVal(o)       (Cursor)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   179
#define __FontVal(o)         (XFontStruct *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   180
#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
   181
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   182
#define __MKATOMOBJ(a)       __MKSMALLINT(a)   /* add STORE macro if ever changed */
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   183
#define __AtomVal(o)         __intVal(o)
211
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   184
#define __isAtomID(o)        __isSmallInteger(o)
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   185
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   186
#define myDpy                __DisplayVal(__INST(displayId))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   187
#define ISCONNECTED          (__INST(displayId) != nil)
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   188
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   189
#ifdef __VMS__
1899
de1eb2a3318e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1898
diff changeset
   190
# include "vms_Xnames.h"
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   191
#endif
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   192
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   193
void __XTimeoutErrorHandler();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   194
int __XErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   195
int __XIOErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   196
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   197
#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
   198
  static __xlibTimeout__ = DEFAULT_XLIB_TIMEOUT;
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
   199
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   200
#define ENTER_XLIB()   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   201
    { \
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   202
	__blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   203
	__blockingPrimitiveTimeoutArg__ = (INT)self; \
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   204
	__blockingPrimitiveTimeout__ = __xlibTimeout__; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   205
    } {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   206
#define LEAVE_XLIB()   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   207
    { \
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   208
	__blockingPrimitiveTimeout__ = 0; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   209
    } }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   210
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   211
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   212
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   213
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   214
!XWorkstation primitiveVariables!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   215
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   216
/*
146
claus
parents: 145
diff changeset
   217
 * remembered info from private error handler
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   218
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   219
static char lastErrorMsg[128] = "";
1888
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   220
static unsigned INT lastRequestCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   221
static unsigned INT lastMinorCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   222
static unsigned INT lastResource = 0;
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   223
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   224
static int __debug__ = 0;
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   225
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   226
#define DPRINTF(x)      if (__debug__) { printf x; }
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   227
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   228
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   229
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   230
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   231
!XWorkstation primitiveFunctions!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   232
%{
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   233
1579
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
 * 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
   236
 * to include that stuff. Should be #ifdef'd ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   237
 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   238
#ifndef ELF
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   239
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   240
# ifdef __GNUC__
1081
f7d19178fb2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   241
VOLATILE 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   242
# endif
1081
f7d19178fb2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   243
static
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   244
dummyToForceLoading() {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   245
	XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   246
	XCloseDisplay(0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   247
	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
   248
	XSetWindowColormap(0, 0, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   249
	XQueryColors(0,0,0,0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   250
# ifdef SHM
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   251
	XShmAttach(0, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   252
	XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   253
	XShmDetach(0, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   254
	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
   255
	shmctl(0,0,0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   256
	fgetc(0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   257
# endif
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   258
}
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   259
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   260
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   261
/*
144
claus
parents: 143
diff changeset
   262
 * catch X-errors and forward as errorInterrupt:#DisplayError,
claus
parents: 143
diff changeset
   263
 * (which itself invokes my handler and optionally raises an exceptionSignal)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   264
 * the implementation below is somewhat wrong: it will
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   265
 * report all errors for Display, even though there could be
162
claus
parents: 160
diff changeset
   266
 * more than one display connection. (being fixed, new errorInterrupt mechanism
claus
parents: 160
diff changeset
   267
 * allows passing an additional argument, which is the displayID ...)
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   268
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   269
int
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
   270
__XErrorHandler__(dpy, event)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   271
    Display *dpy;
48194c26a46c Initial revision
claus
parents:
diff changeset
   272
    XErrorEvent *event;
48194c26a46c Initial revision
claus
parents:
diff changeset
   273
{
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   274
    XGetErrorText(dpy, event->error_code, lastErrorMsg, 127);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   275
    lastErrorMsg[127] = '\0';
1060
bc581886fe8f dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents: 1056
diff changeset
   276
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   277
    if (lastErrorMsg[0] == '\0') {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   278
	sprintf(lastErrorMsg, "code: %d", event->error_code);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   279
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   280
    lastRequestCode = event->request_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   281
    lastMinorCode = event->minor_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   282
    lastResource = event->resourceid;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   283
    if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   284
	/* 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   285
	 * this is a BadWindow error for X_DestroyWindow.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   286
	 * 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
   287
	 * in non bottom-up window order.
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   288
	 */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   289
	return 0;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   290
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   291
254
d6f12ecd7767 ErrorPrinting variable now correctly detected by stc
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   292
    if (@global(ErrorPrinting) == true) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   293
	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
   294
			event->request_code, event->request_code, 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   295
			event->minor_code, event->minor_code, event->resourceid);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   296
	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
   297
			event->error_code, lastErrorMsg);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   298
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   299
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   300
    __errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   301
    return 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
   302
}
48194c26a46c Initial revision
claus
parents:
diff changeset
   303
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   304
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   305
 * much like the above, but for IO Errors;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   306
 * forwarded as errorInterrupt:#DisplayIOError,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   307
 * In single display apps, handling those here does not
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   308
 * really make sense (except, for a controlled cleanup).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   309
 * However, in multiDisplay apps, a single broken
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   310
 * connection should not affect the other users.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   311
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   312
int
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   313
__XIOErrorHandler__(dpy)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   314
    Display *dpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   315
{
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   316
    if (@global(ErrorPrinting) == true) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   317
	fprintf(stderr, "XWorkstation [error]: I/O error\n");
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   318
    }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   319
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError),
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   320
						  __MKEXTERNALADDRESS(dpy));
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   321
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   322
#if 0
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   323
    /*
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   324
     * don't do this.
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   325
     * 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
   326
     */
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   327
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   328
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   329
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   330
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   331
     */
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   332
    __internalError("unhandled display I/O error");
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   333
    __terminateProcess(0);      /* soft terminate */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   334
    __terminateProcess(1);      /* hard terminate */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   335
    /* never reached */
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   336
#endif
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   337
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   338
    return 0;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   339
}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   340
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
 * timeout error in case of Xlib request timeout.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   343
 * forwarded as errorInterrupt:#DisplayIOTimeoutError,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   344
 * This is generated synthetically by the VM if the
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   345
 * timeoutHandler has been set.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   346
 */
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   347
void
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   348
__XTimeoutErrorHandler(displayDeviceInst)
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   349
    OBJ displayDeviceInst;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   350
{
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   351
    if (@global(ErrorPrinting) == true) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   352
	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
   353
    }
2057
ff2964f2bd9d increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents: 2021
diff changeset
   354
    if (displayDeviceInst == @global(MainDisplay)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   355
	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
   356
	return;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   357
    }
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
#if 0
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   360
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   361
This is litter: 
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   362
    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
   363
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   364
    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
   365
       false because displayId is nil.
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   366
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   367
    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
   368
       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
   369
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   370
    /*
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   371
     * must immediately flush that displays deviceID - otherwise,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   372
     * 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
   373
     * timer ...
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   374
     */
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   375
    __OINST(displayDeviceInst, displayId) = nil;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   376
#endif
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   377
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst);
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   378
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   379
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   380
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   381
     */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
diff changeset
   382
    if (__OINST(displayDeviceInst, displayId) != nil) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   383
	__internalError("unhandled display Timeout error");
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   384
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   385
	__terminateProcess(0);      /* soft terminate */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   386
	__terminateProcess(1);      /* hard terminate */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
diff changeset
   387
    }
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   388
}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   389
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   390
#ifdef VIRTUAL_ROOT
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   391
/*
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   392
 * added since RootWindow-macro is not sufficient
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   393
 * when virtual root-windows are involved (i.e. tvtwm)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   394
 */
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   395
static Window
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   396
getRootWindow(dpy, screen)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   397
    Display *dpy;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   398
{
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   399
    Window root;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   400
    Atom vRootAtom = None;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   401
    int i;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   402
    Window rootReturn, parentReturn;
1050
b2c03e24d56c another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents: 1049
diff changeset
   403
    Window* children = (Window *)0;
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   404
    unsigned int numChildren;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   405
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   406
    root = RootWindow(dpy, screen);
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   407
    /*
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   408
     * on IRIS, this creates a badwindow error - why ?
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   409
     * children contains a funny window (000034)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   410
     */
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   411
# if !defined(IRIS) || defined(IRIX5)
1887
98bb2fb45fda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1883
diff changeset
   412
    if (root) {
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   413
	vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   414
	if (vRootAtom != None) {
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   415
	    if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   416
		for (i=0; i < numChildren; i++) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   417
		    Atom actual_type;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   418
		    int actual_format;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   419
		    unsigned long nitems, bytesafter;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   420
		    Window* newRoot = (Window*) 0;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   421
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   422
		    if (children[i]) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   423
			if (XGetWindowProperty(dpy, children[i], vRootAtom,
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   424
					       0L, 1L, False, XA_WINDOW,
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   425
					       &actual_type, &actual_format, &nitems, &bytesafter,
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   426
					       (unsigned char**) &newRoot) == Success && newRoot) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   427
			    root = *newRoot;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   428
			    XFree(newRoot); /* XXX */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   429
			    break;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   430
			}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   431
		    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   432
		}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   433
	    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   434
	    if (children) XFree( children );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
   435
	}
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   436
    }
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   437
# endif
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   438
    return root;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   439
}
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   440
#endif
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   441
%}
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   442
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   443
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   444
!XWorkstation class methodsFor:'documentation'!
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
copyright
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   447
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   448
COPYRIGHT (c) 1989 by Claus Gittinger
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   449
	      All Rights Reserved
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   450
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   451
 This software is furnished under a license and may be used
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   452
 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
   453
 inclusion of the above copyright notice.   This software may not
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   454
 be provided or otherwise made available to, or used by, any
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   455
 other person.  No title to or ownership of the software is
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   456
 hereby transferred.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   457
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   458
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   459
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   460
documentation
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   461
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   462
    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
   463
    from DeviceWorkstation. Notice, that in Smalltalk/X you are not technically
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   464
    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
   465
    simultanously. However, the default setup is for one display only.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   466
    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
   467
    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
   468
    different protocol. However, 'normal' applications do not have to care for
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   469
    all of this ...
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
    See more documentation in my superclass, DeviceWorkstation.
613
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   472
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   473
    [author:]
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   474
	Claus Gittinger
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   475
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   476
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   477
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   478
!XWorkstation class methodsFor:'initialization'!
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   479
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   480
initialize
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   481
    |d|
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   482
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   483
    ConservativeSync := OperatingSystem platformName == #win32.
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   484
3267
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   485
    "/ some XServers crash, when given too long strings in XDrawString/XDrawInageString.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   486
    "/ the following is an adjustable soft-limit.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   487
    MaxStringLength := 4096.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   488
3321
3d0e6754dcd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   489
    RawKeySymTranslation isNil ifTrue:[
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   490
	"/ the following table maps X-keyevents to ST/X
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   491
	"/ device independend events. 
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   492
	"/ It is NOT meant as a keyboardMap replacement.
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   493
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   494
	RawKeySymTranslation := d := Dictionary new.
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   495
	d at:'Delete_line' put:#DeleteLine.
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   496
	d at:'Delete_word' put:#DeleteWord.
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   497
	d at:'Down' put:#CursorDown.
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   498
	d at:'Up' put:#CursorUp.
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   499
	d at:'Left' put:#CursorLeft.
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   500
	d at:'Right' put:#CursorRight.
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   501
    ]
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   502
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   503
    "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
   504
! !
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   505
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   506
!XWorkstation class methodsFor:'error handling'!
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   507
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   508
debug:aBoolean
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   509
%{  /* NOCONTEXT */
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   510
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   511
    __debug__ = (aBoolean == true) ? 1 : 0;
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   512
%}
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   513
!
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   514
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   515
debugResources
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   516
%{
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   517
#ifdef COUNT_RESOURCES
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   518
    fprintf(stderr, "colors:%d bitmaps:%d views:%d gc:%d cursors:%d fonts:%d\n",
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   519
	    __cnt_color, __cnt_bitmap,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   520
	    __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
   521
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   522
%}
1404
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   523
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   524
    "
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   525
     XWorkstation debugResources
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   526
    "
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   527
!
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   528
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   529
errorStringOfLastError
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   530
%{
1065
fdc5b9059d82 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1062
diff changeset
   531
    RETURN ( __MKSTRING(lastErrorMsg) );
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   532
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   533
!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   534
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   535
getConnectionTimeOut
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
    RETURN (__MKSMALLINT(__xlibTimeout__ / 50));
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   538
%}
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   539
!
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   540
135
claus
parents: 133
diff changeset
   541
lastErrorString
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   542
    "return the last X-error string - 
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   543
     when buffering is on, this may be
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   544
     an error for a long-ago operation"
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   545
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   546
    |string requestCode s match line|
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   547
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   548
    string := self errorStringOfLastError.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   549
    requestCode := self requestCodeOfLastError.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   550
    "
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   551
     X specific: search the requestCode in '/usr/lib/X11/XErrorDB',
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   552
     and append the name of the corresponding X-request
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   553
    "
3814
0d856538e64f Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 3806
diff changeset
   554
    s := '/usr/lib/X11/XErrorDB' asFilename readStreamOrNil.
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   555
    s notNil ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   556
	match := 'XRequest.' , requestCode printString.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   557
	line := s peekForLineStartingWith:match.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   558
	line notNil ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   559
	    string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1)
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   560
	].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   561
	s close.
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   562
    ].
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   563
    ^ string
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   564
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   565
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   566
minorCodeOfLastError
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   567
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   568
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   569
    RETURN ( __MKSMALLINT(lastMinorCode) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   570
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   571
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   572
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   573
requestCodeOfLastError
152
claus
parents: 150
diff changeset
   574
%{  /* NOCONTEXT */
claus
parents: 150
diff changeset
   575
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   576
    RETURN ( __MKSMALLINT(lastRequestCode) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   577
%}
135
claus
parents: 133
diff changeset
   578
!
claus
parents: 133
diff changeset
   579
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   580
resourceIdOfLastError
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   581
%{  /* NOCONTEXT */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   582
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   583
    RETURN ( __MKEXTERNALADDRESS(lastResource) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   584
%}
3016
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
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   587
setConnectionTimeOut:seconds
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   588
%{
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   589
    __xlibTimeout__ = __intVal(seconds) * 50;
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   590
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   591
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   592
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   593
!XWorkstation class methodsFor:'queries'!
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   594
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   595
platformName
133
claus
parents: 132
diff changeset
   596
    "ST-80 compatibility.
2777
60ba83db1fab comment
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   597
     Return a string describing the display systems platform.
60ba83db1fab comment
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   598
     WinWorkstation always returns 'X11'."
133
claus
parents: 132
diff changeset
   599
715
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   600
    ^ 'X11'  "I don't know what ST-80 returns for X ..."
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   601
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   602
    "Modified: 26.5.1996 / 15:32:46 / cg"
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   603
! !
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   604
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   605
!XWorkstation methodsFor:'Signal constants'!
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   606
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   607
deviceIOTimeoutErrorSignal
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   608
    "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
   609
     IO error (i.e. broken connection) occurs."
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   610
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   611
    ^ deviceIOTimeoutErrorSignal
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   612
! !
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   613
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   614
!XWorkstation methodsFor:'accessing & queries'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   615
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   616
activateOnClick:aBoolean
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   617
    "set/clear the activateOnClick behavior.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   618
     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
   619
     the (top) window.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   620
     Windows users typically enable this;
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   621
     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
   622
     it disabled.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   623
     Returns the previous setting."
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   624
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   625
    |prev|
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   626
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   627
    prev := activateOnClick ? false.
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   628
    aBoolean notNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   629
	activateOnClick := aBoolean.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   630
    ].
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   631
    ^ prev
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   632
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
     Display class activateOnClick:true
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   635
     Display class activateOnClick:false
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   636
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   637
!
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   638
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   639
anyButtonMotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   640
    "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
   641
     This is the devices mask."
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
%{  /* NOCONTEXT */
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   644
    RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask));
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   645
%}.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   646
    ^ nil
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   647
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   648
295
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
    "return the colornumber of black"
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
    ^ blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   653
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   654
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   655
button1MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   656
    "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
   657
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   658
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   659
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   660
    RETURN (__MKSMALLINT(Button1MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   661
%}
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   662
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   663
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   664
     Display button1MotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   665
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   666
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   667
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   668
button2MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   669
    "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
   670
     For backward compatibility."
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
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   673
    RETURN (__MKSMALLINT(Button2MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   674
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   675
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   676
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   677
button3MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   678
    "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
   679
     For backward compatibility."
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
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   682
    RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   683
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   684
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   685
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   686
buttonMotionMask:aButton
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   687
    "return the state-mask for button1 in motion events state-field.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   688
     This is the devices mask."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   689
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   690
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   691
    if (aButton == __MKSMALLINT(1)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   692
	RETURN (__MKSMALLINT(Button1MotionMask));
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(2)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   695
	RETURN (__MKSMALLINT(Button2MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   696
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   697
    if (aButton == __MKSMALLINT(3)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   698
	RETURN (__MKSMALLINT(Button3MotionMask));
295
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
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   701
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   702
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   703
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   704
controlMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   705
    "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
   706
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   707
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   708
    ^ self ctrlModifierMask
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   709
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   710
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   711
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   712
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   713
displayFileDescriptor
48194c26a46c Initial revision
claus
parents:
diff changeset
   714
    "return the displays fileNumber - for select"
48194c26a46c Initial revision
claus
parents:
diff changeset
   715
48194c26a46c Initial revision
claus
parents:
diff changeset
   716
%{  /* NOCONTEXT */
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   717
#ifndef WIN32
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   718
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   719
	RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) );
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   720
    }
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   721
#endif
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   722
    RETURN (nil);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   723
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
   724
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   725
133
claus
parents: 132
diff changeset
   726
displayName
claus
parents: 132
diff changeset
   727
    "return the X-connections display name.
claus
parents: 132
diff changeset
   728
     This is (currently) nil for the default display, 
claus
parents: 132
diff changeset
   729
     something like foo:0 for any other remote display.
claus
parents: 132
diff changeset
   730
     Future versions may return non-nil strings for the default display as well."
claus
parents: 132
diff changeset
   731
claus
parents: 132
diff changeset
   732
    ^ displayName
claus
parents: 132
diff changeset
   733
!
claus
parents: 132
diff changeset
   734
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   735
protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   736
    "return the X-servers protocol version - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   737
     any interest"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   738
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   739
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   740
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   741
	RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) );
341
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
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   744
%}
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
     Display protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   748
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   749
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   750
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   751
serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   752
    "return the X-server vendor string - this should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   753
     any interest, but can be for special cases
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   754
     (to avoid bugs in certain implementations)"
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
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   757
	RETURN ( __MKSTRING(XServerVendor(myDpy)) );
341
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
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   760
%}
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
     Display serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   764
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   765
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   766
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   767
shiftMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   768
    "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
   769
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   770
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   771
    ^ self shiftModifierMask
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   772
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   773
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   774
translatePoint:aPoint from:windowId1 to:windowId2
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   775
    "given a point in window1, return the coordinate in window2.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   776
     This expects a device coordinate (relative to the first views origin)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   777
     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
   778
     - use to xlate points from a window to rootwindow"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   779
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   780
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   781
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   782
    |x1 y1 x2 y2|
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
    x1 := x2 := aPoint x truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   785
    y1 := y2 := aPoint y truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   786
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   787
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   788
    Window w1, w2, child_ret;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   789
    int screen = __intVal(__INST(screen));
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   790
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   791
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   792
     && __isExternalAddress(windowId1)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   793
     && __isExternalAddress(windowId2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   794
     && __bothSmallInteger(x1, y1)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   795
	Display *dpy = myDpy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   796
	Window rootWin;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   797
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   798
	w1 = __WindowVal(windowId1);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   799
	w2 = __WindowVal(windowId2);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   800
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   801
#ifdef VIRTUAL_ROOT 
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   802
	rootWin = RootWindow(dpy, screen);
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   803
	if (w1 == rootWin) {
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   804
	    ENTER_XLIB();
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   805
	    w1 = getRootWindow(dpy, screen);
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   806
	    LEAVE_XLIB();
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   807
	}
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   808
	if (w2 == rootWin) {
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   809
	    ENTER_XLIB();
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   810
	    w2 = getRootWindow(dpy, screen);
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
   811
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   812
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   813
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   814
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   815
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   816
	XTranslateCoordinates(dpy, w1, w2,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   817
			      __intVal(x1), __intVal(y1), 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   818
			      &xpos, &ypos, &child_ret);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   819
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   820
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   821
	x2 = __MKSMALLINT(xpos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   822
	y2 = __MKSMALLINT(ypos);
341
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
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   825
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   826
    ^ (x2 @ y2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   827
!
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
vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   830
    "return the X-servers vendor release - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   831
     any interest, but can be for special cases.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   832
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   833
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   834
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   835
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   836
	RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   837
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   838
    RETURN (nil);
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
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   842
     Display vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   843
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   844
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   845
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   846
viewIdFromPoint:aPoint in:windowId
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   847
    "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
   848
     hit by this coordinate. Return nil if no view was hit.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   849
     The returned id may be the id of a non ST view.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   850
     - 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
   851
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   852
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   853
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   854
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   855
    int screen = __intVal(__INST(screen));
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   856
    OBJ xp, yp;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   857
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   858
    Window child_ret;
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   859
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   860
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   861
     && __isExternalAddress(windowId)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   862
     && __isPoint(aPoint)) {
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   863
	Display *dpy = myDpy;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   864
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   865
	xp = _point_X(aPoint);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   866
	yp = _point_Y(aPoint);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   867
	if (__bothSmallInteger(xp, yp)) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   868
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   869
	    ENTER_XLIB();
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   870
	    XTranslateCoordinates(dpy,
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   871
				  RootWindow(dpy, screen),
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   872
				  __WindowVal(windowId),
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   873
				  __intVal(xp), __intVal(yp), 
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   874
				  &xpos, &ypos, &child_ret);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   875
	    LEAVE_XLIB();
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   876
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   877
	    if (child_ret) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   878
		RETURN ( __MKEXTERNALADDRESS(child_ret) );
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   879
	    }
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   880
	    RETURN ( nil );
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   881
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   882
    }
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
    windowId notNil ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   885
	aPoint isPoint ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   886
	    ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
   887
	]
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   888
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   889
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   890
    ^ nil
3412
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
   891
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
   892
    "
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
   893
      Display viewIdFromPoint:100@100 in:Display realRootWindowId
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
   894
    "
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   895
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   896
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   897
virtualExtent
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   898
    "return the virtual extent of the display (in pixels).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   899
     On most systems, this is the same as the physical width;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   900
     except, if a window manager with a virtual desktop like olvwm
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   901
     (simulating a bigger screen) is running."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   902
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   903
%{
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   904
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   905
     && (__INST(rootId) != __INST(virtualRootId)) 
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   906
     && __isExternalAddress(__INST(virtualRootId))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   907
	Window vRootWin;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   908
	Window root;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   909
	int x, y;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   910
	unsigned int width, height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   911
	unsigned int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   912
	int ret;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   913
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   914
	vRootWin = __WindowVal(__INST(virtualRootId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   915
	ENTER_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   916
	ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   917
					  &dummy, &dummy);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   918
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   919
	if (ret) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   920
	    RETURN ( __MKPOINT_INT(width, height) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   921
	}
341
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
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   924
    ^ width @ height
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   925
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   926
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   927
whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   928
    "return the colornumber of white"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   929
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   930
    ^ whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   931
! !
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   932
3263
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 3250
diff changeset
   933
!XWorkstation methodsFor:'accessing-display capabilities'!
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   934
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   935
hasDPS
186
claus
parents: 180
diff changeset
   936
    "return true, if this workstation supports display postscript.
claus
parents: 180
diff changeset
   937
     Both the server must support it, and the feature must have been
claus
parents: 180
diff changeset
   938
     enabled in the smalltalk system, for true to be returned."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   939
48194c26a46c Initial revision
claus
parents:
diff changeset
   940
    ^ hasDPSExtension
186
claus
parents: 180
diff changeset
   941
claus
parents: 180
diff changeset
   942
    "
claus
parents: 180
diff changeset
   943
     Display hasDPS 
claus
parents: 180
diff changeset
   944
    "
claus
parents: 180
diff changeset
   945
!
claus
parents: 180
diff changeset
   946
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   947
hasExtension:extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   948
    "query for an X extension. The argument, extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   949
     should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc).
186
claus
parents: 180
diff changeset
   950
     Return true, if that extension is available in the server.
claus
parents: 180
diff changeset
   951
     (which does not imply, that there is support in smalltalk for it."
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   952
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   953
    <context: #return>
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   954
%{
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   955
    int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   956
    OBJ rslt = false;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   957
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   958
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   959
     && __isNonNilObject(extensionString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   960
     && (__qIsString(extensionString) || __qIsSymbol(extensionString))) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   961
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   962
	if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   963
	    rslt = true;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   964
	}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   965
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   966
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   967
    RETURN (rslt);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   968
%}
186
claus
parents: 180
diff changeset
   969
claus
parents: 180
diff changeset
   970
    "
claus
parents: 180
diff changeset
   971
     Display hasExtension:'XVideo' 
claus
parents: 180
diff changeset
   972
     Display hasExtension:'Input' 
claus
parents: 180
diff changeset
   973
     Display hasExtension:'GLX' 
claus
parents: 180
diff changeset
   974
     Display hasExtension:'X3D-PEX' 
claus
parents: 180
diff changeset
   975
     Display hasExtension:'XInputExtension' 
claus
parents: 180
diff changeset
   976
     Display hasExtension:'SHAPE' 
claus
parents: 180
diff changeset
   977
     Display hasExtension:'MIT-SHM' 
claus
parents: 180
diff changeset
   978
     Display hasExtension:'SGIFullScreenStereo' 
claus
parents: 180
diff changeset
   979
    "
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   980
!
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   981
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   982
hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   983
    "return true, if this workstation supports the X image extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   984
     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
   985
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   986
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   987
    ^ hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   988
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
     Display hasImageExtension 
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   994
hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   995
    "return true, if this workstation supports the X input extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   996
     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
   997
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   998
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   999
    ^ hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1000
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
     Display hasInputExtension 
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1006
hasMultibuffer
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1007
    "return true, if this workstation supports the multibuffer extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1008
     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
  1009
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1010
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1011
    ^ hasMbufExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1012
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
     Display hasMultibuffer 
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1018
hasPEX
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1019
    "return true, if this workstation supports PEX 3D graphics.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1020
     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
  1021
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1022
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1023
    ^ hasPEXExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1024
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
     Display hasPEX 
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1030
hasShm
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1031
    "return true, if this workstation supports the shared pixmap extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1032
     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
  1033
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1034
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1035
    ^ hasShmExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1036
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1037
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1038
     Display hasShm 
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1042
hasXVideo
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1043
    "return true, if this workstation supports the XVideo extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1044
     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
  1045
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1046
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1047
    ^ hasXVideoExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1048
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1049
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1050
     Display hasXVideo 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1051
    "
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1054
iconSizes
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1055
    "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
  1056
     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
  1057
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1058
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1059
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1060
    |xIconSizes count ret|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1061
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1062
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1063
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1064
    XIconSize *sizeList;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1065
    int cnt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1066
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1067
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1068
	Display *dpy = myDpy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1069
	int status;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1070
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1071
	ENTER_XLIB();
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  1072
	status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1073
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1074
	if (status > 0) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1075
	   xIconSizes = __MKEXTERNALBYTES(sizeList);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1076
	   count = __MKSMALLINT(cnt);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1077
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1078
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1079
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1080
    xIconSizes isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1081
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1082
    ret := OrderedCollection new:count.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1083
    1 to:count do:[ :i |
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1084
	|minWidth minHeight maxWidth maxHeight widthStep heightStep d|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1085
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1086
%{
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1087
	XIconSize *slp;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1088
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1089
	slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1];
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1090
	minWidth = __MKSMALLINT(slp->min_width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1091
	minHeight = __MKSMALLINT(slp->min_height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1092
	maxWidth = __MKSMALLINT(slp->max_width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1093
	maxHeight = __MKSMALLINT(slp->max_height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1094
	widthStep = __MKSMALLINT(slp->width_inc);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1095
	heightStep = __MKSMALLINT(slp->height_inc);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1096
%}.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1097
	d := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1098
	d at:#minWidth put:minWidth.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1099
	d at:#maxWidth put:maxWidth.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1100
	d at:#widthStep put:widthStep.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1101
	d at:#minHeight put:minHeight.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1102
	d at:#maxHeight put:maxHeight.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1103
	d at:#heightStep put:heightStep.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1104
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1105
	ret add:d
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1106
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1107
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1108
    xIconSizes free.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1109
    ^ ret
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1110
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1111
    "
819
88aaa6ff1ca3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 818
diff changeset
  1112
     Display iconSizes
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
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1115
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1116
ignoreBackingStore:aBoolean
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1117
    "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
  1118
     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
  1119
     very slow or is broken (can be put into display-rc-file)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1120
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1121
    ignoreBackingStore := aBoolean
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1122
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1123
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1124
preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1125
    "return the displays preferred size for icons.
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1126
     Redefined to return a special value on SGI servers."
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1127
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1128
    self serverVendor = 'Silicon Graphics' ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1129
	^ 86@68
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1130
    ].
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1131
    ^ super preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1132
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1133
    "Created: 10.6.1996 / 21:06:48 / cg"
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1134
!
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1135
1025
40dde7d8f538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  1136
scrollsAsynchronous
1008
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1137
    "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
  1138
     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
  1139
     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
  1140
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1141
    ^ true
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1142
!
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1143
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1144
supportedImageFormats
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1145
    "return an array with supported image formats; 
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1146
     each array entry is an attribute dictionary, consisting of 
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1147
     depth, bitsPerPixel and padding values."
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1148
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1149
    |nFormats "{ Class: SmallInteger }"
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1150
     formatArray|
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1151
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1152
    Display *dpy;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1153
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1154
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1155
	RETURN (nil);
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1156
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1157
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1158
    dpy = myDpy;
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1159
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1160
    nFormats = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1161
#else
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1162
    nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1163
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1164
%}.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1165
    formatArray := Array new:nFormats.
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1166
    1 to:nFormats do:[:index |
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1167
	|info bitsPerPixelInfo depthInfo paddingInfo i|
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1168
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1169
	i := index.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1170
%{
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1171
	ScreenFormat *format;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1172
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1173
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1174
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1175
	depthInfo = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1176
	bitsPerPixelInfo = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1177
	paddingInfo = __MKSMALLINT(8);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1178
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1179
	format = DISPLAYACCESS(dpy)->pixmap_format;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1180
	format += (__intVal(i)-1);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1181
	bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1182
	depthInfo = __MKSMALLINT(format->depth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1183
	paddingInfo = __MKSMALLINT(format->scanline_pad);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1184
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1185
%}.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1186
	info := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1187
	info at:#depth put:depthInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1188
	info at:#bitsPerPixel put:bitsPerPixelInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1189
	info at:#padding put:paddingInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1190
	formatArray at:index put:info.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1191
    ].
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1192
    ^ formatArray
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1193
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1194
    "
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1195
     Display supportedImageFormats 
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1196
    "
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1197
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1198
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1199
supportsAnyViewBackgroundPixmaps
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1200
    "return true, if the device allows pixmaps as
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1201
     viewBackground."
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1202
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1203
    ^ true
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1204
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1205
    "Created: / 4.5.1999 / 18:41:07 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1206
!
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1207
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1208
supportsArbitraryShapedViews
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1209
    "return true, if this workstation supports arbitrary shaped windows.
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1210
     Both the server must support it (the shape-extension), 
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1211
     and the feature must have been enabled in the smalltalk system, 
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1212
     for true to be returned."
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1213
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1214
    ^ hasShapeExtension
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1215
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1216
    "
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1217
     Display supportsArbitraryShapedViews   
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1218
    "
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1219
!
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1220
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1221
supportsIconViews
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1222
    "return true, if this device supports views as icons.
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1223
     Only Xservers (currently) support this."
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1224
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1225
    ^ true
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1226
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1227
    "
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1228
     Display supportsIconViews 
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1229
    "
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1230
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1231
    "Modified: 10.6.1996 / 20:11:48 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1232
    "Created: 10.6.1996 / 21:08:18 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1233
!
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1234
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1235
supportsMaskedDrawingWith:aForm
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1236
    "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
  1237
     to be used as paint color. 
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1238
     True returned here - X has no trouble with any mask."
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1239
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1240
    ^ true
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1241
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1242
    "Created: / 4.5.1999 / 12:16:43 / cg"
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1243
!
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1244
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1245
supportsViewBackgroundPixmap:aForm
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1246
    "return true, if the device allows the given pixmap as
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1247
     viewBackground. 
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1248
     True returned here - X support any size."
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1249
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1250
    ^ true
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1251
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1252
    "Created: / 4.5.1999 / 18:40:42 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1253
    "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
  1254
!
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1255
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1256
supportsViewGravity
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1257
    "return true, if this device supports gravity attributes.
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
  1258
     We do not depend on it being implemented, but some resizing operations
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1259
     are faster, it is is."
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1260
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1261
    ^ true
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1262
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1263
48194c26a46c Initial revision
claus
parents:
diff changeset
  1264
!XWorkstation methodsFor:'bitmap/window creation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1265
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1266
createBitmapFromArray:anArray width:w height:h
2896
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1267
    "create a monochrome, depth1 bitmap from a given (byte-)array.
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1268
     The rows are aligned to a multiple of 8"
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1269
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1270
    |bitmapId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1271
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1272
    bitmapId := self primCreateBitmapFromArray:anArray width:w height:h.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1273
    bitmapId isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1274
	self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1275
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1276
    ^ bitmapId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1277
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1278
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1279
createBitmapFromFile:aString for:aForm
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1280
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1281
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1282
    |id w h|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1283
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1284
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1285
    int screen = __intVal(__INST(screen));
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1286
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1287
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1288
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1289
     && (__qIsString(aString) || __qIsSymbol(aString))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1290
	Display *dpy = myDpy;
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1291
	char *filename;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1292
	int status;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1293
	Pixmap newBitmap;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1294
	unsigned b_width, b_height;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1295
	int b_x_hot, b_y_hot;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1296
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1297
	filename = (char *) __stringVal(aString);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1298
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1299
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1300
	ENTER_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1301
	status = XReadBitmapFile(dpy, RootWindow(dpy, screen),
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1302
				 filename, &b_width, &b_height, &newBitmap,
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1303
				 &b_x_hot, &b_y_hot);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1304
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1305
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1306
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1307
	if ((status == BitmapSuccess)  && newBitmap) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1308
#ifdef COUNT_RESOURCES
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1309
	    __cnt_bitmap++;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1310
#endif
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1311
	    w = __MKSMALLINT(b_width);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1312
	    h = __MKSMALLINT(b_height);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1313
	    id = __MKEXTERNALADDRESS(newBitmap);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1314
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1315
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1316
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1317
    id notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1318
	aForm setWidth:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1319
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1320
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1321
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1322
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1323
createBitmapWidth:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1324
    "allocate a bitmap on the Xserver, the contents is undefined
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1325
     (i.e. random). Return a bitmap id or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1326
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1327
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1328
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1329
%{  
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1330
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1331
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1332
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1333
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1334
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1335
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1336
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1337
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1338
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1339
				       __intVal(w), __intVal(h), 1);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1340
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1341
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1342
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1343
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1344
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1345
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1346
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1347
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1348
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1349
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1350
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1351
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1352
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1353
createPixmapWidth:w height:h depth:d
48194c26a46c Initial revision
claus
parents:
diff changeset
  1354
    "allocate a pixmap on the Xserver, the contents is undefined
48194c26a46c Initial revision
claus
parents:
diff changeset
  1355
     (i.e. random). Return a bitmap id or nil"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1356
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1357
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1358
%{  
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1359
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1360
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1361
    Pixmap newBitmap;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1362
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1363
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1364
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1365
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1366
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1367
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1368
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1369
				       __intVal(w), __intVal(h), __intVal(d));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1370
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1371
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1372
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1373
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1374
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1375
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1376
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1377
    }
1424
29fb970f157f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
  1378
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1379
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1380
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1381
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1382
1468
9832c4017a70 added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1383
createWindowFor:aView type:typeSymbol
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1384
		 origin:origin
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1385
		 extent:extent
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1386
		 minExtent:minExt 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1387
		 maxExtent:maxExt
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1388
		 borderWidth:bWidth
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1389
		 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
  1390
		 style:wStyle
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1391
		 inputOnly:winputOnly
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1392
		 label:wlabel
1960
aa9ef6e21f15 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1916
diff changeset
  1393
		 owner:wowner
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1394
		 icon:wicon iconMask:wiconMask
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1395
		 iconView:wiconView
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1396
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1397
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1398
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1399
    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight 
1960
aa9ef6e21f15 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1916
diff changeset
  1400
     bColorId wsuperViewId wiconId wiconMaskId windowId
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1401
     weventMask wiconViewId bitGravity viewGravity vBgColor
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1402
     vBgForm deepForm preferredVisual preferredDepth|
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1403
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1404
    displayId isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1405
	self primitiveFailedOrClosedConnection.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1406
	^ nil
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1407
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1408
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1409
    origin notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1410
	xpos := origin x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1411
	ypos := origin y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1412
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1413
	xpos := ypos := 0.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1414
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1415
    extent notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1416
	wwidth := extent x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1417
	wheight := extent y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1418
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1419
	wwidth := wheight := 100.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1420
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1421
    minExt notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1422
	minWidth := minExt x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1423
	minHeight := minExt y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1424
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1425
    maxExt notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1426
	maxWidth := maxExt x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1427
	maxHeight := maxExt y
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1428
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1429
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1430
    wsuperView notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1431
	wsuperViewId := wsuperView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1432
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1433
48194c26a46c Initial revision
claus
parents:
diff changeset
  1434
    wicon notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1435
	wiconId := wicon id.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1436
	wiconMask notNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1437
	    wiconMaskId := wiconMask id
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1438
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1439
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1440
    wiconView notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1441
	wiconViewId := wiconView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1442
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1443
    weventMask := aView eventMask.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1444
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1445
    preferredVisual := aView preferredVisual.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1446
    preferredDepth := aView preferredDepth.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1447
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1448
%{  /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1449
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1450
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1451
    Visual visual;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1452
    XGCValues xgcv;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1453
    XSetWindowAttributes xswa;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1454
    XSizeHints sizehints;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1455
    XWMHints wmhints;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1456
    int bw, bd, bg;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1457
    Window newWindow, parentWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1458
    char *windowName;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1459
    XFontStruct *f;
1537
16265a27165d icon masks
Claus Gittinger <cg@exept.de>
parents: 1535
diff changeset
  1460
    Pixmap backPixmap = (Pixmap)0, 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1461
	   iconBitmap = (Pixmap)0,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1462
	   iconMask = (Pixmap)0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1463
    int flags = 0, depth, ioClass;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1464
    Window iconWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1465
    Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1466
    Atom WmQuitAppAtom;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1467
    Atom atoms[3];
48194c26a46c Initial revision
claus
parents:
diff changeset
  1468
    int atomCount = 0, isTopWindow = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1469
48194c26a46c Initial revision
claus
parents:
diff changeset
  1470
    sizehints.flags = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1471
    sizehints.width = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1472
    sizehints.height = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1473
    sizehints.x = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1474
    sizehints.y = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1475
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1476
    if (__bothSmallInteger(wwidth, wheight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1477
	sizehints.flags |= PSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1478
	sizehints.width = __intVal(wwidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1479
	sizehints.height = __intVal(wheight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1480
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1481
    if (__bothSmallInteger(xpos, ypos)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1482
	sizehints.flags |= PPosition;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1483
	sizehints.x = __intVal(xpos);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1484
	sizehints.y = __intVal(ypos);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1485
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1486
    if (__bothSmallInteger(minWidth, minHeight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1487
	sizehints.flags |= PMinSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1488
	sizehints.min_width = __intVal(minWidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1489
	sizehints.min_height = __intVal(minHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1490
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1491
    if (__bothSmallInteger(maxWidth, maxHeight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1492
	sizehints.flags |= PMaxSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1493
	sizehints.max_width = __intVal(maxWidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1494
	sizehints.max_height = __intVal(maxHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1495
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1496
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
  1497
    bg = WhitePixel(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1498
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1499
    if (__isSmallInteger(bWidth)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1500
	bw = __intVal(bWidth);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1501
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1502
	bw = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1503
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1504
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  1505
    bd = BlackPixel(dpy, screen);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1506
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1507
    if (__isExternalAddress(wsuperViewId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1508
	parentWindow = __WindowVal(wsuperViewId);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1509
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1510
	parentWindow = RootWindow(dpy, screen);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1511
	isTopWindow = 1;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1512
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1513
1695
46d9101e4bee replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
  1514
    if (wStyle == @symbol(popUp))
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1515
	xswa.override_redirect = 1;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1516
    else 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1517
	xswa.override_redirect = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1518
48194c26a46c Initial revision
claus
parents:
diff changeset
  1519
    if (winputOnly == true) 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1520
	ioClass = InputOnly;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1521
    else 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1522
	ioClass = InputOutput;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1523
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1524
    if (__isSmallInteger(weventMask)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1525
	xswa.event_mask = __intVal(weventMask);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1526
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1527
	xswa.event_mask = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1528
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1529
48194c26a46c Initial revision
claus
parents:
diff changeset
  1530
    if (ioClass == InputOnly) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1531
	bw = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1532
	depth = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1533
	flags |= CWEventMask;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1534
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1535
	depth = DefaultDepth(dpy,screen);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1536
	flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1537
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1538
	if (backPixmap != (Pixmap)0) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1539
	    xswa.background_pixmap = backPixmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1540
	    flags |= CWBackPixmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1541
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1542
	    xswa.background_pixel = bg;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1543
	    flags |= CWBackPixel;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1544
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1545
	xswa.border_pixel = bd;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1546
    }
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1547
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1548
    visual.visualid = CopyFromParent;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1549
    if (__isSmallInteger(preferredDepth)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1550
	depth = __intVal(preferredDepth);
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1551
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1552
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1553
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1554
    if (preferredVisual != nil) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1555
	XVisualInfo vi;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1556
	int cls;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1557
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1558
	if (preferredVisual == @symbol(StaticGray))
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1559
	    cls = StaticGray;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1560
	else if (preferredVisual == @symbol(GrayScale)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1561
	    cls = GrayScale;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1562
	else if (preferredVisual == @symbol(StaticColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1563
	    cls = StaticColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1564
	else if (preferredVisual == @symbol(PseudoColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1565
	    cls = PseudoColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1566
	else if (preferredVisual == @symbol(TrueColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1567
	    cls = TrueColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1568
	else if (preferredVisual == @symbol(DirectColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1569
	    cls = DirectColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1570
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1571
	    cls = PseudoColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1572
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1573
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1574
	if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1575
	    visual.visualid = vi.visualid;
163
claus
parents: 162
diff changeset
  1576
/*
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
  1577
	    fprintf(stderr, "visualId=%x\n", vi.visualid);
163
claus
parents: 162
diff changeset
  1578
*/
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1579
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1580
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1581
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1582
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1583
    ENTER_XLIB();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1584
    newWindow = XCreateWindow(dpy, parentWindow,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1585
			   sizehints.x, sizehints.y,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1586
			   sizehints.width, sizehints.height,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1587
			   bw, depth, ioClass, &visual,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1588
			   flags, &xswa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1589
    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1590
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1591
48194c26a46c Initial revision
claus
parents:
diff changeset
  1592
    if (! newWindow) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1593
	RETURN ( nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1594
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1595
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1596
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1597
    __cnt_view++;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1598
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1599
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1600
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1601
48194c26a46c Initial revision
claus
parents:
diff changeset
  1602
    /*
48194c26a46c Initial revision
claus
parents:
diff changeset
  1603
     * define its icon and name
48194c26a46c Initial revision
claus
parents:
diff changeset
  1604
     * (only makes sense for topWindows)
48194c26a46c Initial revision
claus
parents:
diff changeset
  1605
     */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1606
    if (isTopWindow) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1607
	if (__isExternalAddress(wiconId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1608
	    iconBitmap = __PixmapVal(wiconId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1609
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1610
	    iconBitmap = (Pixmap)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1611
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1612
	if (__isExternalAddress(wiconMaskId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1613
	    iconMask = __PixmapVal(wiconMaskId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1614
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1615
	    iconMask = (Pixmap)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1616
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1617
	if (__isExternalAddress(wiconViewId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1618
	    iconWindow = __WindowVal(wiconViewId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1619
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1620
	    iconWindow = (Window)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1621
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1622
	if (__isString(wlabel) || __isSymbol(wlabel))
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1623
	    windowName = (char *) __stringVal(wlabel);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1624
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1625
	    windowName = "";
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1626
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1627
	if (iconBitmap || windowName) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1628
	    ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1629
	    XSetStandardProperties(dpy, newWindow,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1630
					windowName, windowName,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1631
					iconBitmap,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1632
					0, 0, &sizehints);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1633
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1634
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1635
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1636
	wmhints.flags = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1637
	if (iconBitmap) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1638
	    wmhints.flags |= IconPixmapHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1639
	    wmhints.icon_pixmap = iconBitmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1640
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1641
	if (iconMask) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1642
	    wmhints.flags |= IconMaskHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1643
	    wmhints.icon_mask = iconMask;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1644
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1645
	if (iconWindow) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1646
	    wmhints.flags |= IconWindowHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1647
	    wmhints.icon_window = iconWindow;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1648
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1649
/*
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1650
	wmhints.flags |= InputHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1651
	wmhints.input = True;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1652
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1653
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1654
	XSetWMHints(dpy, newWindow, &wmhints);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1655
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1656
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1657
	/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1658
	 * 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
  1659
	 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1660
	/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1661
	 * get atoms first (if not already known)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1662
	 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1663
	if (__INST(protocolsAtom) == nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1664
	    ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1665
	    WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1666
	    __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1667
#ifdef USE_SAVEYOURSELF_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1668
	    WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1669
	    __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1670
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1671
#ifdef USE_QUIT_APP_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1672
	    WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1673
	    __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1674
#endif
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1675
	    WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1676
	    __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1677
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1678
	} else {
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1679
#ifdef USE_QUIT_APP_ATOM
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1680
	    WmQuitAppAtom = __AtomVal(__INST(quitAppAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1681
#else
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1682
	    WmQuitAppAtom = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1683
#endif
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1684
	    WmProtocolsAtom = __AtomVal(__INST(protocolsAtom));
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1685
	    WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1686
#ifdef USE_SAVEYOURSELF_ATOM
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1687
	    WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1688
#else
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1689
	    WmSaveYourselfAtom = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1690
#endif
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1691
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1692
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1693
	atoms[0] = WmDeleteWindowAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1694
#ifdef USE_SAVEYOURSELF_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1695
	atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1696
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1697
#ifdef USE_QUIT_APP_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1698
	atoms[atomCount] = WmQuitAppAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1699
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1700
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1701
	XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1702
			32, PropModeReplace, (unsigned char *)atoms, atomCount);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1703
	LEAVE_XLIB();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1704
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1705
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1706
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1707
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1708
    windowId = __MKEXTERNALADDRESS(newWindow);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1709
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1710
    self addKnownView:aView withId:windowId.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1711
    ^ windowId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1712
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1713
48194c26a46c Initial revision
claus
parents:
diff changeset
  1714
destroyGC:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1715
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1716
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1717
%{ 
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1718
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1719
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1720
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1721
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1722
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1723
    if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1724
	GC gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1725
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1726
	if (gc) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1727
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1728
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1729
	    XFreeGC(myDpy, gc);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1730
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1731
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1732
	    __cnt_gc--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1733
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1734
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1735
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1736
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1737
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  1738
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1739
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1740
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1741
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1742
destroyPixmap:aDrawableId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1743
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1744
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1745
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1746
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1747
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1748
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1749
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1750
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1751
    if (__isExternalAddress(aDrawableId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1752
	Pixmap pix = __PixmapVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1753
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1754
	if (pix) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1755
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1756
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1757
	    XFreePixmap(myDpy, pix);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1758
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1759
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1760
	    __cnt_bitmap--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1761
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1762
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1763
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1764
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1765
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  1766
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1767
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1768
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1769
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1770
destroyView:aView withId:aWindowId
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1771
    self primDestroyView:aView withId:aWindowId.
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1772
    self removeKnownView:aView withId:aWindowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1773
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1774
48194c26a46c Initial revision
claus
parents:
diff changeset
  1775
dpsContextFor:aDrawableId and:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1776
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  1777
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  1778
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  1779
%{ 
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1780
#ifdef XXDPS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1781
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1782
    DPSContext dps;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1783
    int height;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1784
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1785
    if (__isExternalAddress(aDrawableId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1786
     && __isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1787
     && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1788
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  1789
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  1790
	dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId),
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  1791
				       __GCVal(aGCId),
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  1792
				       0, height, 0, colormap, NULL, 0,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  1793
				       XDPSDefaultTextBackstop,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  1794
				       XDPSDefaultErrorProc,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  1795
				       NULL);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  1796
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  1797
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  1798
	RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1799
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1800
#endif
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1801
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1802
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1803
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1804
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1805
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1806
gcFor:aDrawableId
132
claus
parents: 129
diff changeset
  1807
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1808
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1809
%{  
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1810
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1811
    GC gc;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1812
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1813
    if (__isExternalAddress(aDrawableId) && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1814
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1815
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1816
	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
  1817
	LEAVE_XLIB();
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1818
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1819
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1820
	if (gc)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1821
	    __cnt_gc++;
1089
dd14759d8370 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1822
#endif
dd14759d8370 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1823
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1824
	RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil );
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1825
    }
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1826
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1827
    self primitiveFailedOrClosedConnection.
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1828
    ^ nil
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1829
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1830
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1831
gcForBitmap:aDrawableId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1832
    "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
  1833
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1834
    ^ self gcFor:aDrawableId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1835
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1836
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1837
primCreateBitmapFromArray:anArray width:w height:h
154
claus
parents: 153
diff changeset
  1838
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1839
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1840
154
claus
parents: 153
diff changeset
  1841
%{  /* UNLIMITEDSTACK */
claus
parents: 153
diff changeset
  1842
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1843
    Display *dpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1844
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1845
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1846
    unsigned int b_width, b_height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1847
    REGISTER unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1848
    REGISTER unsigned char *pBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1849
    unsigned char *b_bits, *allocatedBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1850
    int index, row;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1851
    REGISTER int col;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1852
    unsigned bits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1853
    static char reverseBitTable[256];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1854
    static firstCall = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1855
    int nBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1856
    unsigned char fastBits[10000];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1857
    OBJ num, *op;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1858
    int bytesPerRow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1859
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  1860
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1861
	RETURN (nil);
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  1862
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1863
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1864
    dpy = myDpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1865
    if (firstCall) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1866
	for (index=0; index < 256; index++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1867
	    reverseBitTable[index] = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1868
	    if (index & 128) reverseBitTable[index] |=   1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1869
	    if (index &  64) reverseBitTable[index] |=   2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1870
	    if (index &  32) reverseBitTable[index] |=   4;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1871
	    if (index &  16) reverseBitTable[index] |=   8;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1872
	    if (index &   8) reverseBitTable[index] |=  16;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1873
	    if (index &   4) reverseBitTable[index] |=  32;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1874
	    if (index &   2) reverseBitTable[index] |=  64;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1875
	    if (index &   1) reverseBitTable[index] |= 128;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1876
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1877
	firstCall = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1878
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1879
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1880
    if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1881
	newBitmap = (Pixmap)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1882
	b_width = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1883
	b_height = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1884
	bytesPerRow = (b_width + 7) / 8;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1885
	nBytes = b_height * bytesPerRow;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1886
	if (nBytes < sizeof(fastBits)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1887
	    cp = b_bits = fastBits;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1888
	    allocatedBits = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1889
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1890
	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1891
	    if (! cp) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1892
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1893
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1894
	if (__qClass(anArray) == @global(Array)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1895
	    index = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1896
	    op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1897
	    for (row = b_height; row; row--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1898
		for (col = bytesPerRow; col; col--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1899
		    num = *op++;
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1900
		    if (__isSmallInteger(num)) {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1901
			bits = __intVal(num);
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1902
		    } else {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1903
			bits = __longIntVal(num);
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1904
			if (bits == 0) {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1905
			    goto fail;
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1906
			}
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1907
		    }
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1908
		    *cp++ = reverseBitTable[bits & 0xFF];
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1909
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1910
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1911
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1912
	    if (__qClass(anArray) == @global(ByteArray)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1913
		pBits = __ByteArrayInstPtr(anArray)->ba_element;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1914
		for (col = b_height*bytesPerRow; col; col--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1915
		    *cp++ = reverseBitTable[*pBits++];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1916
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1917
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1918
		goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1919
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1920
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1921
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1922
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1923
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1924
	newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1925
					       (char *)b_bits, 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1926
					       b_width, b_height);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1927
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1928
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1929
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1930
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1931
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1932
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1933
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1934
fail: ;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1935
	if (allocatedBits)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1936
	    free(allocatedBits);
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1937
	RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1938
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1939
%}.
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1940
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1941
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1942
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  1943
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
  1944
    "for rel5 only"
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  1945
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1946
    ^ self primitiveFailedOrClosedConnection
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  1947
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  1948
!
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  1949
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1950
primDestroyView:aView withId:aWindowId
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1951
    <context: #return>
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1952
%{
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1953
    if (! ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1954
	RETURN ( self );
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1955
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1956
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1957
    if (__isExternalAddress(aWindowId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1958
	Window win = __WindowVal(aWindowId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1959
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1960
	if (win) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1961
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1962
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1963
	    XDestroyWindow(myDpy, win);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1964
	    LEAVE_XLIB();
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1965
#ifdef COUNT_RESOURCES
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1966
	    __cnt_view--;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1967
#endif
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1968
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1969
	}
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1970
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1971
%}
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1972
!
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  1973
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1974
realRootWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1975
    "return the id of the real root window.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1976
     This may not be the window you see as background,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1977
     since some window managers install a virtual root window on top
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1978
     of it. Except for very special cases, use #rootWindowId, which takes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1979
     care of any virtual root."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1980
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  1981
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1982
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1983
    Window root;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1984
    OBJ id;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1985
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1986
    if (__INST(rootId) != nil) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1987
	RETURN (__INST(rootId));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1988
    }
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1989
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1990
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1991
	root = RootWindow(myDpy, screen);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1992
	if (! root) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1993
	    id = nil;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1994
	} else {
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1995
	    __INST(rootId) = id = __MKEXTERNALADDRESS(root); __STORE(self, id);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1996
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1997
	RETURN (id);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1998
    }
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1999
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2000
    self primitiveFailedOrClosedConnection.
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2001
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2002
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2003
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2004
rootWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2005
    "return the id of the root window.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2006
     This is the window you see as background, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2007
     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
  2008
     since some window managers install a virtual root window on top
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2009
     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
  2010
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  2011
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2012
    int screen = __intVal(__INST(screen));
3412
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  2013
    Window rootWin, vRootWin = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2014
    OBJ id;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2015
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2016
    if (__INST(virtualRootId) != nil) {
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2017
	RETURN (__INST(virtualRootId));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2018
    }
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2019
169
claus
parents: 168
diff changeset
  2020
    if (ISCONNECTED) {
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2021
	Display *dpy = myDpy;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2022
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2023
	rootWin = RootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2024
#ifndef IRIS
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2025
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2026
	/*
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2027
	 * on IRIS, this creates a badwindow error - why ?
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2028
	 * children contains a funny window (000034)
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2029
	 */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2030
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2031
	/*
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2032
	 * care for virtual root windows (tvtwm & friends)
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2033
	 */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2034
	{
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2035
	    Atom vRootAtom, kwinAtom;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2036
	    int i;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2037
	    Window rootReturn, parentReturn;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2038
	    Window* children = (Window *)0;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2039
	    unsigned int numChildren;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2040
	    int ignoreVRoot = 0;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2041
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2042
	    /*
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2043
	     * Take care of KDE 2.1.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2044
	     * they define _SWM_ROOT but this is not the parent of
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2045
	     * the application windows.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2046
	     * Instead it is used for background painting
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2047
	     */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2048
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2049
	    kwinAtom = XInternAtom(dpy, "KWIN_RUNNING", True);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2050
	    if (kwinAtom != None) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2051
		Atom actual_type;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2052
		int actual_format;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2053
		unsigned long nitems, bytesafter;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2054
		unsigned char *retVal = 0;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2055
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2056
		ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom, 
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2057
				       0L, 1L, False, kwinAtom,
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2058
				       &actual_type, &actual_format, 
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2059
				       &nitems, &bytesafter, &retVal) == Success 
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2060
			      && actual_type != 0;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2061
		if (retVal)
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2062
		    XFree(retVal);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2063
	    }
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2064
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2065
	    if (!ignoreVRoot) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2066
		vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2067
		if (vRootAtom != None) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2068
		    if (XQueryTree(dpy, rootWin, 
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2069
				       &rootReturn, &parentReturn, 
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2070
				       &children, &numChildren)) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2071
			for (i=0; i < numChildren; i++) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2072
			    Atom actual_type;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2073
			    int actual_format;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2074
			    unsigned long nitems, bytesafter;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2075
			    Window* newRoot = (Window*) 0;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2076
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2077
			    if (children[i]) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2078
				if (XGetWindowProperty(dpy, children[i], vRootAtom, 
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2079
						       0L, 1L, False, XA_WINDOW,
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2080
						       &actual_type, &actual_format, 
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2081
						       &nitems, &bytesafter,
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2082
						       (unsigned char**) &newRoot
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2083
						      ) == Success && newRoot) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2084
				    vRootWin = *newRoot;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2085
				    XFree(newRoot); /* XXX */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2086
				    break; 
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2087
				}
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2088
			    }
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2089
			}
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2090
			if (children) XFree(children);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2091
		    }
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2092
		}
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2093
	     }
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2094
	}
3412
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  2095
#endif
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  2096
    }
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  2097
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2098
    if (! vRootWin) {
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2099
	vRootWin = rootWin;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2100
	if (! vRootWin) {
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2101
	    RETURN ( nil );
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  2102
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2103
    }
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2104
    __INST(rootId) = id = __MKEXTERNALADDRESS(rootWin); __STORE(self, id);
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2105
    __INST(virtualRootId) = id = __MKEXTERNALADDRESS(vRootWin); __STORE(self, id);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2106
    RETURN ( id );
63
b9d17e2b6c92 keyRelease and more event masks
claus
parents: 55
diff changeset
  2107
%}
3412
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  2108
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  2109
    "
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  2110
      Display rootWindowId
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  2111
    "
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2112
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2113
48194c26a46c Initial revision
claus
parents:
diff changeset
  2114
!XWorkstation methodsFor:'color stuff'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2115
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2116
colorCell
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2117
    "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
  2118
     This method will return nil for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2119
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2120
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2121
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2122
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2123
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2124
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2125
    unsigned long dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2126
    Status ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2127
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2128
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2129
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2130
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2131
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2132
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2133
	ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2134
				   &dummy, 0, &color.pixel, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2135
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2136
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2137
	if (ok) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2138
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2139
	    __cnt_color++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2140
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2141
	    RETURN ( __MKSMALLINT(color.pixel) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2142
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2143
    }
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2144
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2145
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2146
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2147
48194c26a46c Initial revision
claus
parents:
diff changeset
  2148
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
  2149
    "allocate a color with color name - return the color index (i.e. colorID).
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2150
     Dont use this method, colornames are mostly X specific"
48194c26a46c Initial revision
claus
parents:
diff changeset
  2151
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2152
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2153
%{  
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2154
48194c26a46c Initial revision
claus
parents:
diff changeset
  2155
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2156
    XColor scolor, ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2157
    int screen = __intVal(__INST(screen));
850
Claus Gittinger <cg@exept.de>
parents: 847
diff changeset
  2158
    int id;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2159
    Status ok;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2160
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2161
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2162
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2163
     && (__qIsString(aString) || __qIsSymbol(aString))) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2164
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2165
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2166
	colorname = (char *) __stringVal(aString);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2167
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2168
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2169
	ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2170
	ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2171
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2172
	if (ok) {
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  2173
#ifdef QUICK_TRUE_COLORS
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2174
	    if (__INST(visualType) == @symbol(TrueColor)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2175
		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
  2176
		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
  2177
		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
  2178
		RETURN ( __MKSMALLINT(id) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2179
	    }
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2180
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2181
	    ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2182
	    ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2183
	    LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2184
	}
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2185
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2186
	if (! ok) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2187
	    RETURN ( nil );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2188
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2189
#ifdef COUNT_RESOURCES
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2190
	__cnt_color++;
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2191
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2192
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2193
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2194
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2195
    ^ 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
  2196
!
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2197
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2198
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
  2199
    "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
  2200
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2201
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2202
%{
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2203
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2204
    XColor ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2205
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2206
    Status ok;
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2207
    int id;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2208
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2209
    if (__bothSmallInteger(r, g) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2210
     && __isSmallInteger(b)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2211
     && ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2212
	ecolor.red = __intVal(r);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2213
	ecolor.green= __intVal(g);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2214
	ecolor.blue = __intVal(b);
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2215
#ifdef QUICK_TRUE_COLORS
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2216
	if (__INST(visualType) == @symbol(TrueColor)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2217
	    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
  2218
	    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
  2219
	    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
  2220
	    RETURN ( __MKSMALLINT(id) );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2221
	}
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2222
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2223
	dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2224
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2225
	ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2226
	ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2227
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2228
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2229
	if (! ok) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2230
	    RETURN ( nil );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2231
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2232
#ifdef COUNT_RESOURCES
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2233
	__cnt_color++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2234
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2235
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2236
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2237
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2238
    ^ super colorScaledRed:r scaledGreen:g scaledBlue:b
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2239
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2240
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2241
deviceColorValueToPercent:aDeviceValue
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2242
    "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
  2243
     x-component value (0..100)"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2244
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2245
    ^ (100.0 * aDeviceValue / 16rFFFF)
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2246
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2247
    "
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2248
     Display deviceColorValueToPercent:0      
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2249
     Display deviceColorValueToPercent:16r8000      
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2250
     Display deviceColorValueToPercent:16rFFFF
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2251
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2252
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2253
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2254
freeColor:colorIndex
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2255
    "free a display color when its no longer needed"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2256
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2257
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2258
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2259
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2260
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2261
    unsigned long color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2262
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2263
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2264
#ifdef QUICK_TRUE_COLORS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2265
    if (__INST(visualType) == @symbol(TrueColor)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2266
	/* no need to do anything on TrueColor displays ... */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2267
	RETURN (self);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2268
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2269
#endif
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2270
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2271
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2272
	RETURN (self);
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2273
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2274
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2275
    if (__isSmallInteger(colorIndex)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2276
	dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2277
	color = (long) __intVal(colorIndex);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2278
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2279
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2280
	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
  2281
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2282
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2283
	__cnt_color--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2284
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2285
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2286
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2287
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2288
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2289
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2290
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2291
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2292
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
  2293
    "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
  2294
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2295
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2296
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2297
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2298
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2299
    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
  2300
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2301
    int bits, scale, shift;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2302
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2303
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2304
     && __isSmallInteger(index)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2305
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2306
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2307
	color.pixel = __intVal(index);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2308
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2309
	ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2310
	XQueryColor(dpy, DefaultColormap(dpy, screen), &color);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2311
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2312
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2313
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2314
	/* 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2315
	 * 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
  2316
	 * 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
  2317
	 * (for example, color white on a 4bitsPerRGB server will Return
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2318
	 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2319
	 */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2320
	bits = __intVal(__INST(bitsPerRGB));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2321
	scale = (1<<bits) - 1;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2322
	shift = 16 - bits;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2323
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2324
	sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2325
	sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2326
	sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2327
	RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2328
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2329
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2330
    ^ super getScaledRGBFrom:index
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2331
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2332
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2333
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
  2334
    "get rgb components (0..16rFFFF) of color named colorName,
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2335
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2336
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2337
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2338
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2339
    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
  2340
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2341
    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
  2342
    int bits, scale, shift;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2343
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2344
    if (ISCONNECTED
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2345
     && __isNonNilObject(colorName)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2346
     && (__qIsString(colorName) || __qIsSymbol(colorName))) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2347
	Display *dpy = myDpy;
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2348
        
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2349
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2350
	if (XParseColor(dpy, DefaultColormap(dpy, screen), 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2351
			     (char *) __stringVal(colorName), &color)) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2352
	    /* 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2353
	     * 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
  2354
	     * 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
  2355
	     * (for example, color white on a 4bitsPerRGB server will Return
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2356
	     * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2357
	     */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2358
	    bits = __intVal(__INST(bitsPerRGB));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2359
	    scale = (1<<bits) - 1;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2360
	    shift = 16 - bits;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2361
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2362
	    sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2363
	    sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2364
	    sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2365
	    RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2366
	}
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2367
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2368
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2369
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2370
    ^ super getScaledRGBFromName:colorName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2371
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2372
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2373
listOfAvailableColors
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2374
    "return a list of all available colornames.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2375
     This should not be used, since colornames are very
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2376
     display-specific (here X-specific)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2377
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2378
    |aStream list line index colorName|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2379
3814
0d856538e64f Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 3806
diff changeset
  2380
    aStream := '/usr/lib/X11/rgb.txt' asFilename readStreamOrNil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2381
    aStream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2382
    list := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2383
    [aStream atEnd] whileFalse:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2384
	line := aStream nextLine.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2385
	line notNil ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2386
	    "skip the r/g/b numbers"
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2387
	    index := 1.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2388
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2389
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2390
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2391
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2392
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2393
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2394
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2395
	    colorName := line copyFrom:index.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2396
	    ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2397
		list add:colorName
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2398
	    ]
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  2399
	]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2400
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2401
    aStream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2402
    ^ list sort
1047
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2403
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2404
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2405
     Screen current listOfAvailableColors
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2406
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2407
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2408
    "Modified: 11.9.1996 / 15:26:28 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2409
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2410
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2411
percentToDeviceColorValue:aPercentage
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2412
    "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
  2413
     x-component value (0..65k) as an integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2414
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2415
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2416
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2417
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2418
    if (__isSmallInteger(aPercentage)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2419
	RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2420
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2421
    if (__isFloat(aPercentage)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  2422
	RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2423
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2424
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2425
    ^ (16rFFFF * aPercentage / 100) rounded
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2426
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2427
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2428
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
  2429
    "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
  2430
     This method is a noop for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2431
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2432
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2433
%{ 
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2434
48194c26a46c Initial revision
claus
parents:
diff changeset
  2435
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2436
    XColor color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2437
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2438
    int r, g, b;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2439
    int ok = 1;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2440
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2441
    if (__isSmallInteger(sred))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2442
	r = __intVal(sred);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2443
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2444
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2445
    if (__isSmallInteger(sgreen))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2446
	g = __intVal(sgreen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2447
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2448
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2449
    if (__isSmallInteger(sblue))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2450
	b = __intVal(sblue);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2451
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2452
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2453
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2454
     && __isSmallInteger(index) && ok) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2455
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2456
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2457
	color.pixel = __intVal(index);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2458
	color.red = r;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2459
	color.green = g;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2460
	color.blue = b;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2461
	color.flags = DoRed | DoGreen | DoBlue;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2462
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2463
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2464
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2465
	XStoreColor(dpy, DefaultColormap(dpy, screen), &color);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2466
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2467
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2468
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2469
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2470
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2471
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2472
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2473
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2474
!XWorkstation methodsFor:'cursor stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2475
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2476
builtInCursorShapes
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2477
    "return a collection of standard cursor names.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2478
     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
  2479
     user cursors.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2480
     (actually, there are more than those below ...)"
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2481
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2482
    "/ 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
  2483
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2484
    ^ #(
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2485
	#upLeftArrow            "/ XC_top_left_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2486
	#upRightHand            "/ XC_hand1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2487
	#upDownArrow            "/ XC_sb_v_double_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2488
	#leftRightArrow         "/ XC_sb_h_double_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2489
	#upLimitArrow           "/ XC_top_side         
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2490
	#downLimitArrow         "/ XC_bottom_side   
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2491
	#leftLimitArrow         "/ XC_left_side
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2492
	#rightLimitArrow        "/ XC_right_side
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2493
	#text                   "/ XC_xterm     
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2494
	#upRightArrow           "/ XC_draft_large
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2495
	#leftHand               "/ XC_hand2   
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2496
	#questionMark           "/ XC_question_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2497
	#cross                  "/ XC_X_cursor    
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2498
	#wait                   "/ XC_watch   
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2499
	#crossHair              "/ XC_tcross  
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2500
	#origin                 "/ XC_ul_angle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2501
	#topLeft                "/ XC_ul_angle    
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2502
	#corner                 "/ XC_lr_angle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2503
	#bottomRight            "/ XC_lr_angle      
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2504
	#topRight               "/ XC_ur_angle    
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2505
	#bottomLeft             "/ XC_ll_angle      
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2506
	#square                 "/ XC_dotbox     
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2507
	#fourWay                "/ XC_fleur     
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2508
	#crossCursor            "/ XC_X_cursor 
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2509
      )
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2510
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2511
    "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
  2512
    "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
  2513
!
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2514
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2515
colorCursor:aCursorId foreground:fgColor background:bgColor
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2516
    "change a cursors colors"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2517
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2518
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2519
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2520
    |fgR fgG fgB bgR bgG bgB|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2521
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2522
    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
  2523
    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
  2524
    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
  2525
    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
  2526
    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
  2527
    bgB := bgColor scaledBlue.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2528
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2529
    XColor fgcolor, bgcolor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2530
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2531
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2532
     && __isExternalAddress(aCursorId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2533
     && __bothSmallInteger(fgG, fgB)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2534
     && __bothSmallInteger(bgR, bgG) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2535
     && __bothSmallInteger(bgB, fgR)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2536
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2537
	fgcolor.red = __intVal(fgR);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2538
	fgcolor.green= __intVal(fgG);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2539
	fgcolor.blue = __intVal(fgB);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2540
	bgcolor.red = __intVal(bgR);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2541
	bgcolor.green= __intVal(bgG);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2542
	bgcolor.blue = __intVal(bgB);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2543
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2544
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2545
	XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2546
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2547
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2548
	RETURN ( self );
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2549
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2550
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2551
    self primitiveFailedOrClosedConnection
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2552
!
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2553
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2554
createCursorShape:aShape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2555
    "create a cursor given a shape-symbol. This only works
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2556
     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
  2557
     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
  2558
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2559
    |shapeNumber|
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2560
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2561
    shapeNumber := self shapeNumberFromSymbol:aShape.
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2562
    shapeNumber isNil ifTrue:[^ nil].
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2563
    ^ self primCreateCursorShapeNumber:shapeNumber
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2564
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2565
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2566
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
  2567
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2568
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2569
    ^ self
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2570
	primCreateCursorSourceFormId:sourceForm id 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2571
	maskFormId:maskForm id
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2572
	hotX:hx hotY:hy 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2573
	width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2574
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2575
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2576
destroyCursor:aCursorId
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2577
    "release a cursor - frees any device resources"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2578
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2579
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2580
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2581
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2582
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2583
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2584
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2585
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2586
    if (__isExternalAddress(aCursorId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2587
	Cursor curs = __CursorVal(aCursorId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2588
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2589
	if (curs) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2590
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2591
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2592
	    XFreeCursor(myDpy, curs);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2593
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2594
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2595
	    __cnt_cursor--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2596
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2597
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2598
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2599
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2600
    }
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2601
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2602
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2603
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2604
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2605
needDeviceFormsForCursor
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2606
    ^ true
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2607
!
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2608
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2609
primCreateCursorShapeNumber:aShapeNumber
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2610
    "create a cursor given a shape-number."
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2611
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2612
    <context: #return>
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2613
%{
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2614
    Cursor newCursor;
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2615
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2616
    if (ISCONNECTED
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2617
     && __isSmallInteger(aShapeNumber)) {
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2618
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2619
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2620
	newCursor = XCreateFontCursor(myDpy, __intVal(aShapeNumber));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2621
	LEAVE_XLIB();
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2622
#ifdef COUNT_RESOURCES
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2623
	if (newCursor)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2624
	    __cnt_cursor++;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2625
#endif
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2626
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2627
	if (newCursor != (Cursor)0) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2628
	    RETURN (__MKEXTERNALADDRESS(newCursor));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2629
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2630
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2631
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2632
    self primitiveFailedOrClosedConnection.
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2633
    ^ nil
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2634
!
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2635
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2636
primCreateCursorSourceFormId:sourceId maskFormId:maskId hotX:hx hotY:hy width:w height:h
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2637
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2638
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2639
    <context: #return>
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2640
%{
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2641
    Cursor newCursor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2642
    XColor fgColor, bgColor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2643
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2644
    if (ISCONNECTED
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2645
     && __isExternalAddress(sourceId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2646
     && __isExternalAddress(maskId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2647
     && __bothSmallInteger(hx, hy)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2648
	fgColor.red = 0;        /* fg is black */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2649
	fgColor.green = 0;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2650
	fgColor.blue = 0;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2651
	bgColor.red = 0xFFFF;   /* bg is white */
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2652
	bgColor.green = 0xFFFF;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2653
	bgColor.blue = 0xFFFF;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2654
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2655
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2656
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2657
	newCursor = XCreatePixmapCursor(myDpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2658
				__PixmapVal(sourceId),
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2659
				__PixmapVal(maskId),
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2660
				&fgColor, &bgColor, __intVal(hx), __intVal(hy));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2661
	LEAVE_XLIB();
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2662
#ifdef COUNT_RESOURCES
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2663
	if (newCursor)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2664
	    __cnt_cursor++;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2665
#endif
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2666
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2667
	if (newCursor != (Cursor)0) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2668
	    RETURN (__MKEXTERNALADDRESS(newCursor));
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2669
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2670
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2671
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2672
    self primitiveFailedOrClosedConnection.
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2673
    ^ nil
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2674
!
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2675
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2676
shapeNumberFromSymbol:shape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2677
    "given a shape-symbol, return the corresponding cursor-number,
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2678
     or nil if no such standard cursor exists."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2679
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2680
    "/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
  2681
    "/ 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
  2682
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2683
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2684
    (shape == #upLeftArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow)    %} "132" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2685
    (shape == #upRightHand)     ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1)             %} "58" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2686
    (shape == #upDownArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2687
    (shape == #leftRightArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2688
    (shape == #upLimitArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side)          %} "138" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2689
    (shape == #downLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side)       %} "16" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2690
    (shape == #leftLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side)         %} "70" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2691
    (shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side)        %} "96" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2692
    (shape == #text)            ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm)             %} "152" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2693
    (shape == #upRightArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large)       %} "44" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2694
    (shape == #leftHand)        ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2)             %} "60" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2695
    (shape == #questionMark)    ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow)    %} "92" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2696
    (shape == #cross)           ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2697
    (shape == #wait)            ifTrue:[ ^ %{ __MKSMALLINT(XC_watch)             %} "150" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2698
    (shape == #crossHair)       ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross)            %} "130" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2699
    ((shape == #origin)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2700
    or:[shape == #topLeft])     ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle)          %} "144" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2701
    ((shape == #corner)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2702
    or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle)          %} "78" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2703
    (shape == #topRight)        ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle)          %} "148" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2704
    (shape == #bottomLeft)      ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle)          %} "76" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2705
    (shape == #square)          ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox)            %} "40" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2706
    (shape == #fourWay)         ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur)             %} "52" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2707
    (shape == #crossCursor)     ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2708
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2709
"/    ('XWorkstation [info]: invalid cursorShape:' , shape printString) infoPrintNL.
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2710
    ^  nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2711
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2712
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2713
!XWorkstation methodsFor:'drag & drop'!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2714
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2715
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2716
    "drop something in some alien view, using the DND protocol.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2717
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2718
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2719
    |msgType dropColl dropCollSize anyFile anyDir anyText anyOther
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2720
     dropType dropTypeCode strings sz idx val|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2721
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2722
    (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2723
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2724
	"/ 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
  2725
	"/ check for this.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2726
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2727
	dropObjects isCollection ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2728
	    dropColl := Array with:dropObjects
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2729
	] ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2730
	    dropColl := dropObjects
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2731
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2732
	anyFile := anyDir := anyText := anyOther := false.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2733
	dropColl do:[:aDropObject |
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2734
	    aDropObject isFileObject ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2735
		aDropObject theObject isDirectory ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2736
		    anyDir := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2737
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2738
		    anyFile := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2739
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2740
	    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2741
		aDropObject isTextObject ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2742
		    anyText := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2743
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2744
		    anyOther := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2745
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2746
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2747
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2748
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2749
	anyOther ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2750
	    "/ DND does not support this ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2751
	    '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
  2752
	    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2753
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2754
	anyText ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2755
	    (anyFile or:[anyDir]) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2756
		"/ DND does not support mixed types
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2757
		'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
  2758
		^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2759
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2760
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2761
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2762
	dropCollSize := dropColl size.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2763
	anyFile ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2764
	    dropType := #DndFiles.
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2765
	    dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2766
		dropType := #DndFile
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2767
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2768
	] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2769
	    anyDir ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2770
		dropType := #DndFiles.
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2771
		dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2772
		    dropType := #DndDir
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2773
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2774
	    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2775
		anyText ifTrue:[
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2776
		    dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2777
			dropType := #DndText
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2778
		    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2779
			"/ can only drop a single text object
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2780
			'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
  2781
			^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2782
		    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2783
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2784
		    "/ mhmh ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2785
		    'XWorkstation [info]: DND cannot drop this' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2786
		    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2787
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2788
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2789
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2790
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2791
	dropTypeCode := self dndDropTypes indexOf:dropType.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2792
	dropTypeCode == 0 ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2793
	    'XWorkstation [info]: DND cannot drop this' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2794
	    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2795
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2796
	dropTypeCode := dropTypeCode - 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2797
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2798
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2799
	"/ place the selection inTo the DndSelection property
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2800
	"/ of the rootView ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2801
	"/ ... need a single string, with 0-terminated parts.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2802
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2803
	strings := OrderedCollection new.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2804
	sz := 0.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2805
	dropColl do:[:anObject |
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2806
	    |s o|
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2807
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2808
	    o := anObject theObject.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2809
	    anObject isFileObject ifTrue:[
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2810
		o := o pathName
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2811
	    ].
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2812
	    s := o asString.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2813
	    strings add:s.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2814
	    sz := sz + (s size) + 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2815
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2816
	val := String new:sz.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2817
	idx := 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2818
	strings do:[:aString |
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2819
	    |sz|
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2820
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2821
	    sz := aString size.
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2822
	    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
  2823
	    idx := idx + sz.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2824
	    val at:idx put:(Character value:0).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2825
	    idx := idx + 1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2826
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2827
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2828
	self
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2829
	    setProperty:(self atomIDOf:#DndSelection)
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2830
	    type:(self atomIDOf:#STRING) 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2831
	    value:val 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2832
	    for:rootId.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2833
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2834
	^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2835
	    sendClientEvent:msgType 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2836
	    format:32 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2837
	    to:destinationId 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2838
	    data1:dropTypeCode
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2839
	    data2:0
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2840
	    data3:destinationId
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2841
	    data4:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2842
	    data5:nil.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2843
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2844
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2845
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2846
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2847
    "Created: 6.4.1997 / 13:39:37 / cg"
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  2848
    "Modified: 6.4.1997 / 14:30:43 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2849
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2850
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2851
dndDropTypes
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2852
    "return the dropTypes as supported by DND"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2853
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2854
    ^ #( 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2855
	    DndUnknown      "/ 0
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2856
	    DndRawData      "/ 1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2857
	    DndFile         "/ 2
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2858
	    DndFiles        "/ 3
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2859
	    DndText         "/ 4
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2860
	    DndDir          "/ 5
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2861
	    DndLink         "/ 6
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2862
	    DndExe          "/ 7
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2863
       )
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2864
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2865
    "Created: 6.4.1997 / 12:57:56 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2866
    "Modified: 6.4.1997 / 13:38:52 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2867
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2868
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  2869
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2870
    "drop something in some alien view.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2871
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2872
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2873
    "/
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2874
    "/ see, if the display supports the DND protocol ...
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2875
    "/
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2876
    (self atomIDOf:#DndProtocol) notNil ifTrue:[
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2877
	^ self
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2878
	    dndDrop:aCollectionOfDropObjects 
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2879
	    inWindowID:destinationId 
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2880
	    position:destinationPoint 
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2881
	    rootPosition:rootPoint        
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2882
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2883
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2884
    "/ add more drag&drop protocols here.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2885
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2886
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2887
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  2888
    "Modified: 11.4.1997 / 12:44:50 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2889
! !
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2890
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2891
!XWorkstation methodsFor:'drawing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2892
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  2893
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
  2894
    "do a bit-blt; copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2895
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2896
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2897
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2898
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2899
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2900
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2901
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2902
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2903
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2904
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2905
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2906
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2907
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2908
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2909
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2910
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2911
     && __bothSmallInteger(dstX, dstY)) {
1848
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2912
	int _sX, _sY, _w, _h, _dX, _dY;
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2913
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2914
	_sX = __intVal(srcX);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2915
	_sY = __intVal(srcY);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2916
	_w = __intVal(w);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2917
	_h = __intVal(h);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2918
	_dX = __intVal(dstX);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2919
	_dY = __intVal(dstY);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2920
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2921
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2922
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2923
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2924
	ENTER_XLIB();
1848
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2925
	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
  2926
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2927
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2928
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2929
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2930
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2931
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2932
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2933
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2934
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2935
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2936
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
  2937
    "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
  2938
     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
  2939
     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
  2940
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2941
     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
  2942
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2943
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2944
%{  
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2945
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2946
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2947
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2948
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2949
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2950
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2951
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2952
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2953
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2954
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2955
     && __bothSmallInteger(dstX, dstY)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2956
	Display *dpy = myDpy;
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2957
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2958
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2959
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2960
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2961
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2962
	XSetGraphicsExposures(dpy, gc, 0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2963
	XCopyArea(dpy, source, dest, gc,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2964
				__intVal(srcX), __intVal(srcY),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2965
				__intVal(w), __intVal(h),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2966
				__intVal(dstX), __intVal(dstY));
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2967
	XSetGraphicsExposures(dpy, gc, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2968
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2969
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2970
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2971
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2972
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2973
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2974
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2975
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2976
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2977
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  2978
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
  2979
    "do a bit-blt, but only copy the low-bit plane; 
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2980
     copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2981
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2982
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2983
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2984
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2985
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2986
%{  
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2987
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2988
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2989
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2990
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2991
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2992
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2993
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2994
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2995
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2996
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2997
     && __bothSmallInteger(dstX, dstY)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2998
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2999
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3000
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3001
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3002
	XCopyPlane(myDpy, source, dest, gc,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3003
				 __intVal(srcX), __intVal(srcY),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3004
				 __intVal(w), __intVal(h),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3005
				 __intVal(dstX), __intVal(dstY), 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3006
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3007
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3008
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3009
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3010
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3011
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3012
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3013
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3014
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3015
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3016
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
  3017
    "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
  3018
     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
  3019
     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
  3020
     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
  3021
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3022
     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
  3023
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3024
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3025
%{  
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3026
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3027
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3028
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3029
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3030
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3031
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3032
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3033
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3034
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3035
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3036
     && __bothSmallInteger(dstX, dstY)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3037
	Display *dpy = myDpy;
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3038
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3039
	gc = __GCVal(dstGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3040
	source = __DrawableVal(sourceId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3041
	dest =   __DrawableVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3042
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3043
	XSetGraphicsExposures(dpy, gc, 0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3044
	XCopyPlane(dpy, source, dest, gc,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3045
				 __intVal(srcX), __intVal(srcY),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3046
				 __intVal(w), __intVal(h),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3047
				 __intVal(dstX), __intVal(dstY), 1);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3048
	XSetGraphicsExposures(dpy, gc, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3049
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3050
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3051
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3052
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3053
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3054
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3055
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3056
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3057
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3058
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  3059
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
  3060
    "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
  3061
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3062
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3063
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3064
%{  
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3065
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3066
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3067
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3068
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3069
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3070
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3071
    if (__isSmallInteger(startAngle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3072
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3073
    else if (__isFloat(startAngle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3074
	f = __floatVal(startAngle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3075
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3076
    } else if (__isShortFloat(startAngle)) {
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3077
	f = __shortFloatVal(startAngle);
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3078
	angle1 = f * 64;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3079
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3080
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3081
    if (__isSmallInteger(angle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3082
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3083
    else if (__isFloat(angle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3084
	f = __floatVal(angle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3085
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3086
    } else if (__isShortFloat(angle)) {
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3087
	f = __shortFloatVal(angle);
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3088
	angle2 = f * 64;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3089
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3090
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3091
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3092
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3093
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3094
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3095
     && __bothSmallInteger(width, height)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3096
	win = __WindowVal(aDrawableId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3097
	gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3098
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3099
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3100
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3101
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3102
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3103
	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
  3104
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3105
	    XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3106
				   w, h, angle1, angle2);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3107
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3108
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3109
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3110
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3111
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3112
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3113
    "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
  3114
     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
  3115
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3116
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3117
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3118
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3119
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
  3120
    "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
  3121
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3122
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3123
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3124
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3125
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3126
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3127
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3128
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3129
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3130
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3131
     && __bothSmallInteger(x0, y0)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3132
     && __bothSmallInteger(x1, y1)) {
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3133
	Display *dpy = myDpy;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3134
	int ix0, iy0, ix1, iy1;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3135
	gc = __GCVal(aGCId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3136
	win = __WindowVal(aDrawableId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3137
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3138
	ix0 = __intVal(x0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3139
	iy0 = __intVal(y0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3140
	ix1 = __intVal(x1);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3141
	iy1 = __intVal(y1);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3142
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3143
	/* attention: coordinates in X are shorts and wrap; clamp here. */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3144
	if (ix0 > 0x7FFF) ix0 = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3145
	else if (ix0 < -0x8000) ix0 = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3146
	if (iy0 > 0x7FFF) iy0 = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3147
	else if (iy0 < -0x8000) iy0 = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3148
	if (ix1 > 0x7FFF) ix1 = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3149
	else if (ix1 < -0x8000) ix1 = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3150
	if (iy1 > 0x7FFF) iy1 = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3151
	else if (iy1 < -0x8000) iy1 = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3152
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3153
	ENTER_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3154
	if ((ix0 == ix1) && (iy0 == iy1)) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3155
	    /* little bit shorter X-lib message (better with slow connections...) */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3156
	    XDrawPoint(dpy, win, gc, ix0, iy0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3157
	} else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3158
	    XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3159
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3160
	LEAVE_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3161
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3162
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3163
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3164
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3165
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3166
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3167
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3168
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
  3169
    "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
  3170
     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
  3171
    "
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3172
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3173
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3174
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3175
    |noY|
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3176
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3177
    (noY := yValues size) < 2 ifTrue:[
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3178
	^ self
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3179
    ].
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3180
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3181
%{
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3182
    OBJ      yA, t;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3183
    int      i, num;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3184
    float    y, x, sY, tY, step;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3185
    GC       gc;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3186
    XPoint * points;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3187
    XPoint   qPoints[200];
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3188
    int      mustFree = 0;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3189
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3190
    Window win;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3191
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3192
    if (ISCONNECTED
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3193
     && __isExternalAddress(aGCId)
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3194
     && __isExternalAddress(aDrawableId) ) {
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3195
	gc = __GCVal(aGCId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3196
	win = __WindowVal(aDrawableId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3197
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3198
	if( __isSmallInteger(scaleY) ) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3199
	    sY = (float) __intVal( scaleY );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3200
	else if (__isFloat(scaleY)) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3201
	    sY = __floatVal( scaleY );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3202
	else if (__isShortFloat(scaleY)) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3203
	    sY = __shortFloatVal( scaleY );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3204
	else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3205
	    t = __SSEND0(scaleY, @symbol(asFloat), 0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3206
	    if (! __isFloat(t)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3207
	    sY = __floatVal( t );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3208
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3209
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3210
	if( __isSmallInteger(transY) ) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3211
	    tY = (float) __intVal( transY );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3212
	else if (__isFloat(transY)) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3213
	    tY = __floatVal( transY );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3214
	else if (__isShortFloat(transY)) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3215
	    tY = __shortFloatVal( transY );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3216
	else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3217
	    t = __SSEND0(transY, @symbol(asFloat), 0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3218
	    if (! __isFloat(t)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3219
	    tY = __floatVal( t );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3220
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3221
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3222
	if( __isSmallInteger(startX) ) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3223
	    x = (float) __intVal( startX );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3224
	else if (__isFloat(startX)) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3225
	    x = __floatVal( startX );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3226
	else if (__isShortFloat(startX)) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3227
	    x = __shortFloatVal( startX );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3228
	else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3229
	    t = __SSEND0(startX, @symbol(asFloat), 0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3230
	    if (! __isFloat(t)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3231
	    x = __floatVal( t );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3232
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3233
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3234
	if( __isSmallInteger(stepX) ) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3235
	    step = (float) __intVal( stepX );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3236
	else if (__isFloat(stepX)) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3237
	    step = __floatVal( stepX );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3238
	else if (__isShortFloat(stepX)) 
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3239
	    step = __shortFloatVal( stepX );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3240
	else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3241
	    t = __SSEND0(stepX, @symbol(asFloat), 0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3242
	    if (! __isFloat(t)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3243
	    step = __floatVal( t );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3244
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3245
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3246
	num = __intVal( noY );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3247
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3248
	if( num > 200 ) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3249
	    if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3250
		goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3251
	    mustFree = 1;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3252
	} else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3253
	    points = qPoints;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3254
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3255
	for( i = 0; i < num; ++i ) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3256
	    int px, py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3257
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3258
	    yA  = __AT_(yValues, __MKSMALLINT(i+1) );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3259
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3260
	    if( __isFloat(yA) )
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3261
		y = __floatVal( yA );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3262
	    else if( __isSmallInteger(yA) )
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3263
		y = (float) __intVal( yA );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3264
	    else if( __isShortFloat( yA) )
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3265
		y = __shortFloatVal( yA );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3266
	    else {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3267
		t = __SSEND0(yA, @symbol(asFloat), 0);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3268
		if (! __isFloat(t)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3269
		y = __floatVal( t );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3270
	    }
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3271
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3272
	    px = (int) (x + 0.5);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3273
	    py = (int) ((y * sY) + tY + 0.5);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3274
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3275
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3276
	    if (px > 0x7FFF) px = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3277
	    else if (px < -0x8000) px = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3278
	    if (py > 0x7FFF) py = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3279
	    else if (py < -0x8000) py = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3280
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3281
	    points[i].x = px;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3282
	    points[i].y = py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3283
	    x = x + step;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3284
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3285
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3286
	ENTER_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3287
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3288
	LEAVE_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3289
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3290
	if( mustFree ) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3291
	    free( points );
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3292
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3293
	RETURN ( self );
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3294
    }
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3295
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3296
fail:
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3297
    if( mustFree )
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3298
	free( points );
3229
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3299
%}.
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3300
    ^ 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
  3301
2146
1c13fdc62a9f displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  3302
    "Modified: / 13.6.1998 / 13:51:39 / cg"
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3303
!
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3304
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3305
displayPointX:x y:y in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3306
    "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
  3307
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3308
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3309
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3310
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3311
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3312
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3313
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3314
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3315
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3316
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3317
     && __bothSmallInteger(x, y)) {
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3318
	int px, py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3319
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3320
	gc = __GCVal(aGCId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3321
	win = __WindowVal(aDrawableId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3322
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3323
	px = __intVal(x);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3324
	py = __intVal(y);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3325
	if (px > 0x7FFF) px = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3326
	else if (px < -0x8000) px = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3327
	if (py > 0x7FFF) py = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3328
	else if (py < -0x8000) py = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3329
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3330
	ENTER_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3331
	XDrawPoint(myDpy, win, gc, px, py);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3332
	LEAVE_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3333
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3334
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3335
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3336
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3337
    "badGC, badDrawable or x/y not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3338
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3339
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3340
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3341
displayPolygon:aPolygon in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3342
    "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
  3343
     define the polygon.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3344
     If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3345
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3346
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3347
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3348
    |numberOfPoints newPoints|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3349
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3350
    numberOfPoints := aPolygon size.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3351
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3352
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3353
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3354
    OBJ point, x, y;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3355
    int i, num;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3356
    XPoint *points;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3357
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3358
    int mustFree = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3359
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3360
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3361
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3362
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3363
     && __isSmallInteger(numberOfPoints)) {
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3364
	gc = __GCVal(aGCId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3365
	win = __WindowVal(aDrawableId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3366
	num = __intVal(numberOfPoints);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3367
	/*
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3368
	 * avoid a (slow) malloc, if the number of points is small
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3369
	 */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3370
	if (num > 100) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3371
	    points = (XPoint *)malloc(sizeof(XPoint) * num);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3372
	    if (! points) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3373
	    mustFree = 1;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3374
	} else
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3375
	    points = qPoints;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3376
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3377
	for (i=0; i<num; i++) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3378
	    int px, py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3379
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3380
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3381
	    if (! __isPoint(point)) goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3382
	    x = _point_X(point);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3383
	    y = _point_Y(point);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3384
	    if (! __bothSmallInteger(x, y))
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3385
		goto fail;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3386
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3387
	    px = __intVal(x);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3388
	    py = __intVal(y);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3389
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3390
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3391
	    if (px > 0x7FFF) px = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3392
	    else if (px < -0x8000) px = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3393
	    if (py > 0x7FFF) py = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3394
	    else if (py < -0x8000) py = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3395
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3396
	    points[i].x = px;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3397
	    points[i].y = py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3398
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3399
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3400
	ENTER_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3401
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3402
	LEAVE_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3403
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3404
	if (mustFree)
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3405
	    free(points);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3406
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3407
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3408
fail: ;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3409
    if (mustFree)
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3410
	free(points);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3411
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3412
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3413
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3414
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3415
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3416
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
  3417
    "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
  3418
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3419
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3420
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3421
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3422
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3423
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3424
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3425
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3426
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3427
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3428
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3429
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3430
     && __bothSmallInteger(width, height)) {
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3431
	int px, py;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3432
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3433
	gc = __GCVal(aGCId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3434
	win = __WindowVal(aDrawableId);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3435
	w = __intVal(width);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3436
	h = __intVal(height);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3437
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3438
	/*
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3439
	 * need this check here: some servers simply dump core with bad args
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3440
	 */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3441
	if ((w >= 0) && (h >= 0)) {
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3442
	    px = __intVal(x);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3443
	    py = __intVal(y);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3444
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3445
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3446
	    if (px > 0x7FFF) px = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3447
	    else if (px < -0x8000) px = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3448
	    if (py > 0x7FFF) py = 0x7FFF;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3449
	    else if (py < -0x8000) py = -0x8000;
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3450
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3451
	    ENTER_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3452
	    XDrawRectangle(myDpy, win, gc, px, py, w, h);
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3453
	    LEAVE_XLIB();
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3454
	}
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3455
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3456
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3457
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3458
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3459
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3460
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3461
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3462
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
  3463
    "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
  3464
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3465
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3466
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3467
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3468
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3469
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3470
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3471
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3472
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3473
    OBJ cls;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3474
    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
  3475
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3476
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3477
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3478
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3479
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3480
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3481
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3482
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3483
     && __bothSmallInteger(index1, index2)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3484
     && __bothSmallInteger(x, y)) {
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3485
        int lMax = __intVal(@global(MaxStringLength));
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3486
        Display *dpy = myDpy;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3487
        gc = __GCVal(aGCId);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3488
        win = __WindowVal(aDrawableId);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3489
        cls = __qClass(aString);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3490
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3491
        i1 = __intVal(index1) - 1;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3492
        if (i1 >= 0) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3493
            i2 = __intVal(index2) - 1;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3494
            if (i2 < i1) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3495
                RETURN (self);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3496
            }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3497
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3498
            cp = (char *) __stringVal(aString);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3499
            l = i2 - i1 + 1;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3500
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3501
            if ((cls == @global(String)) || (cls == @global(Symbol))) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3502
                n = __stringSize(aString);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3503
                if (i2 < n) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3504
                    cp += i1;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3505
                    if (l > lMax) l = lMax;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3506
                    ENTER_XLIB();
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3507
                    if (opaque == true)
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3508
                        XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3509
                    else
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3510
                        XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3511
                    LEAVE_XLIB();
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3512
                    RETURN ( self );
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3513
                }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3514
            }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3515
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3516
            nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3517
            cp += nInstBytes;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3518
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3519
            if (__isBytes(aString)) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3520
                n = __byteArraySize(aString) - nInstBytes - 1;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3521
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3522
                if (i2 < n) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3523
                    cp += i1;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3524
                    if (l > lMax) l = lMax;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3525
                    ENTER_XLIB();
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3526
                    if (opaque == true)
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3527
                        XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3528
                    else
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3529
                        XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3530
                    LEAVE_XLIB();
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3531
                    RETURN ( self );
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3532
                }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3533
            }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3534
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3535
            /* TWOBYTESTRINGS */
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3536
            if (__isWords(aString)) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3537
                n = (__byteArraySize(aString) - nInstBytes) / 2;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3538
                if (i2 < n) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3539
                    union {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3540
                        char b[2];
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3541
                        unsigned short s;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3542
                    } u;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3543
                    int i;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3544
                    XChar2b *cp2 = (XChar2b *)0;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3545
                    int mustFree = 0;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3546
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3547
                    cp += (i1 * 2);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3548
                    if (l > lMax) l = lMax;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3549
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3550
#if defined(MSBFIRST) || defined(__MSBFIRST)
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3551
		    /*
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3552
		     * chars already in correct order
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3553
		     */
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3554
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3555
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3556
                    /*
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3557
                     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3558
                     * X expects them MSB first
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3559
                     * convert as required
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3560
                     */
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3561
                    u.s = 0x1234;
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3562
                    if (u.b[0] != 0x12) 
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3563
# endif
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3564
		    {
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3565
                        if (l <= NLOCALBUFFER) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3566
                            cp2 = xlatebuffer;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3567
                        } else {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3568
                            cp2 = (XChar2b *)(malloc(l * 2));
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3569
                            mustFree = 1;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3570
                        }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3571
                        for (i=0; i<l; i++) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3572
                            cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3573
                            cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3574
                        }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3575
                        cp = (char *) cp2;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3576
                    }
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3577
#endif
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3578
                    ENTER_XLIB();  
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3579
                    if (opaque == true)
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3580
                        XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3581
                    else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3582
                        XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3583
                    LEAVE_XLIB();  
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3584
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3585
                    if (mustFree) {
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3586
                        free(cp2);
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3587
                    }
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3588
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3589
                    RETURN ( self );
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3590
                }
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3591
            }
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3592
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3593
            /* FOURBYTESTRINGS */
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3594
            if (__isLongs(aString)) {
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3595
                n = (__byteArraySize(aString) - nInstBytes) / 4;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3596
                if (i2 < n) {
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3597
                    union {
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3598
                        char b[2];
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3599
                        unsigned short s;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3600
                    } u;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3601
                    int i;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3602
                    XChar2b *cp2 = (XChar2b *)0;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3603
		    int32 *ip;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3604
                    int mustFree = 0;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3605
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3606
                    cp += (i1 * 4);
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3607
                    if (l > lMax) l = lMax;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3608
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3609
                    /*
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3610
                     * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF.
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3611
                     */
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3612
                    if (l <= NLOCALBUFFER) {
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3613
                        cp2 = xlatebuffer;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3614
                    } else {
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3615
                        cp2 = (XChar2b *)(malloc(l * 2));
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3616
                        mustFree = 1;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3617
                    }
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3618
                    for (i=0; i<l; i++) {
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3619
			int32 codePoint = ((int32 *)cp)[i];
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3620
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3621
			if (codePoint > 0xFFFF) {
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3622
			    codePoint = 0xFFFF;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3623
			}
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3624
                        cp2[i].byte1 = (codePoint >> 8) & 0xFF;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3625
                        cp2[i].byte2 = codePoint & 0xFF;
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3626
                    }
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3627
                    cp = (char *) cp2;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3628
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3629
                    ENTER_XLIB();  
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3630
                    if (opaque == true)
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3631
                        XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3632
                    else
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3633
                        XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3634
                    LEAVE_XLIB();  
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3635
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3636
                    if (mustFree) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3637
                        free(cp2);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3638
                    }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3639
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3640
                    RETURN ( self );
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3641
                }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3642
            }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3643
        }
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3644
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3645
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3646
%}.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3647
    (aString isString and:[aString bitsPerCharacter > 16]) ifTrue:[
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3648
        self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter)
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3649
             from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque.
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3650
        ^ self.
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3651
    ].
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3652
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3653
    "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
  3654
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3655
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3656
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3657
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
  3658
    "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
  3659
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3660
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3661
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3662
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3663
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3664
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3665
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3666
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3667
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3668
    int n;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3669
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3670
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3671
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3672
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3673
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3674
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3675
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3676
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3677
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3678
     && __bothSmallInteger(x, y)) {
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3679
        int lMax = __intVal(@global(MaxStringLength));
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3680
        Display *dpy = myDpy;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3681
        gc = __GCVal(aGCId);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3682
        win = __WindowVal(aDrawableId);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3683
        cls = __qClass(aString);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3684
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3685
        cp = (char *) __stringVal(aString);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3686
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3687
        if ((cls == @global(String)) || (cls == @global(Symbol))) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3688
            n = __stringSize(aString);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3689
            if (n > lMax) n = lMax;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3690
            ENTER_XLIB();
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3691
            if (opaque == true)
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3692
                XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3693
            else
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3694
                XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3695
            LEAVE_XLIB();
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3696
            RETURN ( self );
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3697
        }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3698
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3699
        nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3700
        cp += nInstBytes;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3701
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3702
        if (__isBytes(aString)) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3703
            n = __byteArraySize(aString) - nInstBytes - 1;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3704
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3705
            if (n > lMax) n = lMax;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3706
            ENTER_XLIB();
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3707
            if (opaque == true)
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3708
                XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3709
            else
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3710
                XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3711
            LEAVE_XLIB();
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3712
            RETURN ( self );
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3713
        }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3714
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3715
        /* TWOBYTESTRINGS */
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3716
        if (__isWords(aString)) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3717
            union {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3718
                char b[2];
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3719
                unsigned short s;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3720
            } u;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3721
            int i;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3722
            XChar2b *cp2;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3723
            int mustFree = 0;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3724
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3725
            n = (__byteArraySize(aString) - nInstBytes) / 2;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3726
            if (n > lMax) n = lMax;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3727
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3728
#if defined(MSBFIRST) || defined(__MSBFIRST)
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3729
	    /*
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3730
	     * chars already in correct order
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3731
	     */
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3732
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3733
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3734
            /*
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3735
             * ST/X TwoByteStrings store the asciiValue in native byteOrder;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3736
             * X expects them MSB first
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3737
             * convert as required
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3738
             */
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3739
            u.s = 0x1234;
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3740
            if (u.b[0] != 0x12) 
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3741
# endif
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3742
	    {
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3743
                if (n <= NLOCALBUFFER) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3744
                    cp2 = xlatebuffer;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3745
                } else {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3746
                    cp2 = (XChar2b *)(malloc(n * 2));
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3747
                    mustFree = 1;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3748
                }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3749
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3750
                for (i=0; i<n; i++) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3751
                    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3752
                    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3753
                }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3754
                cp = (char *) cp2;
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3755
            }
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3756
#endif
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3757
            ENTER_XLIB();
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3758
            if (opaque == true)
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3759
                XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3760
            else
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3761
                XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3762
            LEAVE_XLIB();
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3763
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3764
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3765
            if (mustFree) {
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3766
                free(cp2);
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3767
            }
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3768
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3769
            RETURN ( self );
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3770
        }
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3771
    }
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3772
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3773
%}.
3229
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3774
    ^ 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
  3775
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3776
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3777
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3778
	width:imageWidth height:imageHeight 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3779
	x:srcx y:srcy
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3780
	into:aDrawableId 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3781
	x:dstx y:dsty 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3782
	width:w height:h 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3783
	with:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3784
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3785
    "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
  3786
     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
  3787
     Individual source pixels have bitsPerPixel bits, allowing to draw
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3788
     depth and pixel-units to be different.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3789
     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
  3790
     depth - otherwise, primitive failure will be signalled.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3791
     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
  3792
     colors are allocated - otherwise the colors may be wrong."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3793
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3794
    |fmt padding bits wantedPadding|
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3795
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3796
    padding := givenPadding.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3797
    bits := givenBits.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3798
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3799
    "/ 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
  3800
    "/ 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
  3801
    "/ 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
  3802
    "/ care for that.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3803
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3804
    ((imageDepth == 4) and:[depth == 4]) ifTrue:[
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3805
	fmt := self supportedImageFormatForDepth:4.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3806
	fmt isNil ifTrue:[
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3807
	    self primitiveFailed. "/ cannot represent this image
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3808
	    ^ nil
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3809
	].
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3810
	wantedPadding := fmt at:#padding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3811
	wantedPadding > givenPadding ifTrue:[
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3812
	    bits := self 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3813
			    repadBits:givenBits 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3814
			    width:imageWidth 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3815
			    height:imageHeight
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3816
			    depth:imageDepth
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3817
			    from:givenPadding
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3818
			    to:wantedPadding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3819
	    padding := wantedPadding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3820
	]
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3821
    ].
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3822
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3823
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3824
     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
  3825
     an unlimited stack, and thus cannot send primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3826
    "
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  3827
    (self 
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3828
	primDrawBits:bits 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3829
	bitsPerPixel:bitsPerPixel 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3830
	depth:imageDepth 
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  3831
	msb:true 
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3832
	padding:padding
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3833
	width:imageWidth height:imageHeight 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3834
	x:srcx y:srcy
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3835
	into:aDrawableId 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3836
	x:dstx y:dsty 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3837
	width:w height:h 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3838
	with:aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3839
    ifFalse:[
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3840
	"
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3841
	 also happens, if a segmentation violation occurs in the 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3842
	 XPutImage ...
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3843
	"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3844
	self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3845
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3846
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3847
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  3848
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
  3849
	       in:aDrawableId with:aGCId
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3850
    "fill an arc. If any coordinate is not integer, an error is triggered.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3851
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3852
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3853
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3854
%{  
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3855
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3856
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3857
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3858
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3859
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3860
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3861
    if (__isSmallInteger(startAngle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3862
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3863
    else if (__isFloat(startAngle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3864
	f = __floatVal(startAngle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3865
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3866
    } else if (__isShortFloat(startAngle)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3867
	f = __shortFloatVal(startAngle);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3868
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3869
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3870
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3871
    if (__isSmallInteger(angle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3872
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3873
    else if (__isFloat(angle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3874
	f = __floatVal(angle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3875
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3876
    } else if (__isShortFloat(angle)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3877
	f = __shortFloatVal(angle);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3878
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3879
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3880
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3881
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3882
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3883
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3884
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3885
     && __bothSmallInteger(width, height)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3886
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3887
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3888
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3889
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3890
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3891
	 * need this check here: some servers simply dump core with bad args
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
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3894
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3895
	    XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3896
				   w, h, angle1, angle2);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3897
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3898
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3899
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3900
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3901
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3902
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3903
    "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
  3904
     or non float angle(s)"
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3905
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3906
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3907
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3908
48194c26a46c Initial revision
claus
parents:
diff changeset
  3909
fillPolygon:aPolygon in:aDrawableId with:aGCId
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3910
    "fill a polygon given by its points. 
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3911
     If any coordinate is not integer, an error is triggered."
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3912
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3913
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3914
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3915
    |numberOfPoints|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3916
48194c26a46c Initial revision
claus
parents:
diff changeset
  3917
    numberOfPoints := aPolygon size.
48194c26a46c Initial revision
claus
parents:
diff changeset
  3918
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3919
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3920
    Window win;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3921
    OBJ point, x, y;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3922
    int i, num;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3923
    XPoint *points;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3924
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3925
    int mustFree = 0;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3926
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3927
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3928
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3929
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3930
     && __isSmallInteger(numberOfPoints)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3931
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3932
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3933
	num = __intVal(numberOfPoints);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3934
	if (num < 3) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3935
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3936
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3937
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3938
	 * avoid (slow) malloc, if not many points
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3939
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3940
	if (num > 100) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3941
	    points = (XPoint *) malloc(sizeof(XPoint) * num);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3942
	    if (! points) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3943
	    mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3944
	} else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3945
	    points = qPoints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3946
	for (i=0; i<num; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3947
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3948
	    if (! __isPoint(point)) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3949
	    x = _point_X(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3950
	    y = _point_Y(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3951
	    if (! __bothSmallInteger(x, y))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3952
		goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3953
	    points[i].x = __intVal(x);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3954
	    points[i].y = __intVal(y);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3955
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3956
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3957
	XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3958
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3959
	if (mustFree)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3960
	    free(points);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3961
	RETURN ( self );
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3962
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3963
fail: ;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3964
	if (mustFree)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3965
	    free(points);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3966
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3967
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3968
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3969
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3970
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3971
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3972
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
  3973
    "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
  3974
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3975
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3976
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3977
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3978
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3979
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3980
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3981
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3982
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3983
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3984
     && __bothSmallInteger(width, height)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3985
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3986
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3987
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3988
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3989
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3990
	if ((w >= 0) && (h >= 0)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3991
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3992
	    XFillRectangle(myDpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3993
			   __DrawableVal(aDrawableId), __GCVal(aGCId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3994
			   __intVal(x), __intVal(y), w, h);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3995
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3996
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3997
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3998
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3999
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4000
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4001
    self primitiveFailedOrClosedConnection
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4002
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4003
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4004
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb masks:maskArray padding:bitPadding
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4005
			     extent:imageExtent sourceOrigin:srcOrg
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4006
			       into:aDrawableId 
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4007
		  destinationOrigin:dstOrg extent:dstExtent 
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4008
			       with:aGCId
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4009
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4010
    <context: #return>
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4011
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4012
    |imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h|
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4013
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4014
    imageWidth := imageExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4015
    imageHeight := imageExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4016
    rm := maskArray at:1.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4017
    gm := maskArray at:2.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4018
    bm := maskArray at:3.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4019
    srcx := srcOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4020
    srcy := srcOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4021
    dstx := dstOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4022
    dsty := dstOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4023
    w := dstExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4024
    h := dstExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4025
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4026
    "since XPutImage may allocate huge amount of stack space 
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4027
     (some implementations use alloca), this must run with unlimited stack."
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4028
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4029
%{  /* UNLIMITEDSTACK */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4030
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4031
    /*
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4032
     * need unlimited stack, since some Xlibs do a huge alloca in
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4033
     * XPutImage
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4034
     */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4035
    GC gc;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4036
    Window win;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4037
    XImage image;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4038
    int imgWdth;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4039
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4040
    if (ISCONNECTED
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4041
     && __isExternalAddress(aGCId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4042
     && __isExternalAddress(aDrawableId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4043
     && __bothSmallInteger(srcx, srcy)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4044
     && __bothSmallInteger(dstx, dsty)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4045
     && __bothSmallInteger(w, h)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4046
     && __bothSmallInteger(imageWidth, imageHeight)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4047
     && __bothSmallInteger(imageDepth, bitsPerPixel)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4048
     && __isSmallInteger(bitPadding)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4049
     && __bothSmallInteger(rm, gm)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4050
     && __isSmallInteger(bm)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4051
     && __isByteArray(imageBits)) {
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4052
	Display *dpy = myDpy;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4053
	int pad = __intVal(bitPadding);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4054
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4055
	gc = __GCVal(aGCId);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4056
	win = __WindowVal(aDrawableId);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4057
	if (! gc || !win) 
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4058
	    goto fail;
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4059
#ifdef ARGDEBUG
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4060
	printf("args ok\n");
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4061
#endif
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4062
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4063
	image.width = imgWdth = __intVal(imageWidth);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4064
	image.height = __intVal(imageHeight);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4065
	image.xoffset = 0;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4066
	image.format = ZPixmap;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4067
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4068
	image.bitmap_unit = 8;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4069
	image.bitmap_bit_order = MSBFirst;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4070
	image.bitmap_pad = pad;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4071
	image.depth = __intVal(imageDepth);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4072
	image.bits_per_pixel = __intVal(bitsPerPixel);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4073
	image.red_mask = __intVal(rm);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4074
	image.green_mask = __intVal(gm);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4075
	image.blue_mask = __intVal(bm);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4076
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4077
	image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4078
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4079
	switch (image.bits_per_pixel) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4080
	    case 1:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4081
	    case 2:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4082
	    case 4:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4083
	    case 8:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4084
	    case 16:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4085
	    case 24:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4086
	    case 32:
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4087
		break;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4088
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4089
	    default:
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4090
#ifdef ARGDEBUG
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4091
		printf("bits_per_pixel=%d\n",image.bits_per_pixel);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4092
#endif
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4093
		goto fail;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4094
	}
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4095
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4096
	/* ENTER_XLIB(); */
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4097
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4098
					__intVal(dstx), __intVal(dsty),
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4099
					__intVal(w), __intVal(h));
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4100
	/* LEAVE_XLIB(); */
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4101
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  4102
	RETURN ( true );
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4103
    }
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4104
#ifdef ARGDEBUG
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4105
    if (!! __isExternalAddress(aGCId)) printf("GC\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4106
    if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4107
    if (!! __isSmallInteger(srcx)) printf("srcx\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4108
    if (!! __isSmallInteger(srcy)) printf("srcy\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4109
    if (!! __isSmallInteger(dstx)) printf("dstx\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4110
    if (!! __isSmallInteger(dsty)) printf("dsty\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4111
    if (!! __isSmallInteger(w)) printf("w\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4112
    if (!! __isSmallInteger(h)) printf("h\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4113
    if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4114
    if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4115
    if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4116
    if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4117
    if (!! __isByteArray(imageBits)) printf("imageBits\n");
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4118
#endif
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4119
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4120
fail: ;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4121
%}
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4122
.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4123
    ^ false
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4124
!
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4125
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4126
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4127
			      width:imageWidth height:imageHeight 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4128
				  x:srcx y:srcy
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4129
			       into:aDrawableId 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4130
				  x:dstx y:dsty 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4131
			      width:w height:h 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4132
			       with:aGCId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4133
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4134
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4135
132
claus
parents: 129
diff changeset
  4136
    "since XPutImage may allocate huge amount of stack space 
claus
parents: 129
diff changeset
  4137
     (some implementations use alloca), this must run with unlimited stack."
claus
parents: 129
diff changeset
  4138
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4139
%{  /* UNLIMITEDSTACK */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4140
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4141
    /*
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4142
     * need unlimited stack, since some Xlibs do a huge alloca in
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4143
     * XPutImage
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4144
     */
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4145
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4146
    Window win;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4147
    XImage image;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4148
    int imgWdth;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4149
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4150
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4151
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4152
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4153
     && __bothSmallInteger(srcx, srcy)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4154
     && __bothSmallInteger(dstx, dsty)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4155
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4156
     && __bothSmallInteger(imageWidth, imageHeight)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4157
     && __bothSmallInteger(imageDepth, bitsPerPixel)
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  4158
     && __isSmallInteger(bitPadding)
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4159
     && __isByteArray(imageBits)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4160
	Display *dpy = myDpy;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4161
	int pad = __intVal(bitPadding);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4162
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4163
	gc = __GCVal(aGCId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4164
	win = __WindowVal(aDrawableId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4165
	if (! gc || !win) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4166
	    goto fail;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4167
#ifdef ARGDEBUG
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4168
	printf("args ok\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4169
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4170
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4171
	image.width = imgWdth = __intVal(imageWidth);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4172
	image.height = __intVal(imageHeight);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4173
	image.xoffset = 0;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4174
	image.format = ZPixmap;
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4175
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4176
	image.bitmap_unit = 8;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4177
	image.bitmap_bit_order = MSBFirst;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4178
	image.bitmap_pad = pad;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4179
	image.depth = __intVal(imageDepth);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4180
	image.bits_per_pixel = __intVal(bitsPerPixel);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4181
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4182
	/*
2021
67626c0fb1eb fixed image padding bug
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  4183
	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
  4184
	*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4185
	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
  4186
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4187
	switch (image.bits_per_pixel) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4188
	    case 1:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4189
	    case 2:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4190
	    case 4:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4191
	    case 8:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4192
	    case 16:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4193
	    case 24:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4194
	    case 32:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4195
		break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4196
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4197
	    default:
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4198
#ifdef ARGDEBUG
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4199
		printf("bits_per_pixel=%d\n",image.bits_per_pixel);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4200
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4201
		goto fail;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4202
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4203
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4204
	image.red_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4205
	image.green_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4206
	image.blue_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4207
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4208
	/* ENTER_XLIB(); */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4209
	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
  4210
					__intVal(dstx), __intVal(dsty),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4211
					__intVal(w), __intVal(h));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4212
	/* LEAVE_XLIB(); */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4213
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4214
	RETURN ( true );
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4215
    }
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4216
#ifdef ARGDEBUG
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4217
    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
  4218
    if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n");
193
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4219
    if (!! __isSmallInteger(srcx)) printf("srcx\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4220
    if (!! __isSmallInteger(srcy)) printf("srcy\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4221
    if (!! __isSmallInteger(dstx)) printf("dstx\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4222
    if (!! __isSmallInteger(dsty)) printf("dsty\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4223
    if (!! __isSmallInteger(w)) printf("w\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4224
    if (!! __isSmallInteger(h)) printf("h\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4225
    if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4226
    if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4227
    if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4228
    if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  4229
    if (!! __isByteArray(imageBits)) printf("imageBits\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4230
#endif
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4231
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4232
fail: ;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4233
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  4234
.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4235
    ^ false
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4236
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  4237
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4238
!XWorkstation methodsFor:'event forwarding'!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4239
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4240
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
  4241
    "forward a buttonMotion event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4242
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4243
    self buttonMotion:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4244
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4245
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4246
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
  4247
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4248
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4249
    |logicalButton nextMultiClickTime|
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4250
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4251
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4252
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4253
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4254
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4255
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4256
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4257
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4258
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4259
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4260
    logicalButton := buttonTranslation at:button ifAbsent:button.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  4261
3332
a9ada7dccdd6 Comment
Stefan Vogel <sv@exept.de>
parents: 3330
diff changeset
  4262
    "/ special for mouse-wheel implementation
3312
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  4263
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4264
      self mouseWheelMotion:state x:x y:y amount:(logicalButton == #wheelFwd ifTrue:[10] ifFalse:[-10]) deltaTime:10 view:view.
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4265
      ^ self.
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4266
    ].
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4267
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4268
    logicalButton isInteger ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4269
	buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4270
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4271
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4272
    multiClickTimeDelta notNil ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4273
	nextMultiClickTime := time + multiClickTimeDelta.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4274
	multiClickTime notNil ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4275
	    time < multiClickTime ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4276
		multiClickTime := nextMultiClickTime.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4277
		self buttonMultiPress:logicalButton x:x y:y view:view.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4278
		^ self.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4279
	    ]
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4280
	].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4281
	multiClickTime := nextMultiClickTime.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4282
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4283
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4284
    view isNil ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4285
	"/ event arrived, after I destroyed it myself
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4286
	^ self
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4287
    ].
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4288
    logicalButton == 1 ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4289
	activateOnClick == true ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4290
	    "/ dont raise above an active popup view.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4291
	    (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4292
		view topView raise.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4293
	    ]
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4294
	].
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4295
    ].
3330
85fa3a6ce50d *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3329
diff changeset
  4296
    super buttonPress:logicalButton x:x y:y view:view
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4297
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4298
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4299
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
  4300
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4301
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4302
    |logicalButton|
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4303
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4304
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4305
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4306
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4307
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4308
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4309
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4310
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4311
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4312
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4313
    logicalButton := buttonTranslation at:button ifAbsent:button.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4314
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4315
    "/ special for HPs mouse-wheel implementation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4316
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4317
      ^ self
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4318
    ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4319
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4320
    logicalButton isInteger ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4321
	buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4322
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4323
    self buttonRelease:logicalButton x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4324
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4325
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4326
clientMessage:targetView type:typeAtom format:format data:data
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4327
    |sensor|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4328
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4329
    "/ DND drag&drop protocol
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4330
    typeAtom == (self atomIDOf:#DndProtocol) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4331
	format == 32 ifTrue:[
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4332
	    self dndMessage:nil data:data view:targetView.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4333
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4334
	]
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4335
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4336
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4337
    (sensor := targetView sensor) notNil ifTrue:[
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4338
	sensor clientMessage:typeAtom format:format eventData:data view:targetView
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4339
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4340
	"
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4341
	 not posted, if there is no sensor ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4342
	"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4343
    ]
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4344
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4345
    "Created: 4.4.1997 / 17:49:26 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4346
    "Modified: 4.4.1997 / 18:00:18 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4347
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4348
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4349
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
  4350
    "forward a size-change event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4351
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  4352
    self configureX:x y:y width:w height:h view:view.
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  4353
    above notNil ifTrue:[
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4354
	|aboveView|
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4355
	aboveView := self viewFromId:above.
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4356
	aboveView notNil ifTrue:[
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4357
	    self coveredBy:aboveView view:view.
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4358
	].
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  4359
     ].
3230
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
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4362
dndMessage:event data:data view:targetView
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4363
    "handle a DND drag&drop protocol message"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4364
1553
279d9566bd83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1552
diff changeset
  4365
    |sensor dropType dropValue names i1 i2 t|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4366
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4367
    dropType := data doubleWordAt:1.
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4368
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4369
    "/ see def's in DragAndDropTypes.h
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  4370
    dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4371
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4372
    self 
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4373
	getProperty:(self atomIDOf:#DndSelection)
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4374
	from:rootId
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4375
	delete:false
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4376
	into:[:type :value |
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4377
	    t := type.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4378
	    dropValue := value
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4379
	].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4380
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4381
    "/ preconvert into a collection
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4382
    "/ of fileNames, string or byteArray
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4383
    "/ Notice: we do not yet convert into dropObjects
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4384
    "/ here, to allow arbitrary data to be handled by
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4385
    "/ redefined dropMessage methods in applications.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4386
    "/ Conversion is done for some well known types
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4387
    "/ in the default dropMessage handling of SimpleView.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4388
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4389
    dropType == #DndFiles ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4390
	"/ actually, a list of fileNames
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4391
	t ~~ stringAtom ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4392
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4393
	    ^ self
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4394
	].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4395
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4396
	names := OrderedCollection new.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4397
	i1 := 1.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4398
	[i1 ~~ 0] whileTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4399
	    i2 := dropValue indexOf:(Character value:0) startingAt:i1.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4400
	    i2 ~~ 0 ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4401
		names add:(dropValue copyFrom:i1 to:(i2-1)).
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4402
		i1 := i2 + 1.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4403
	    ] ifFalse:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4404
		i1 := i2
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4405
	    ].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4406
	].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4407
	dropValue := names.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4408
	dropValue := dropValue collect:[:nm | nm asFilename].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4409
	dropType := #files.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4410
    ] ifFalse:[ (dropType == #DndFile) ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4411
	t ~~ stringAtom ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4412
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4413
	    ^ self
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4414
	].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4415
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4416
	dropValue := dropValue asFilename.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4417
	dropType := #file.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4418
    ] ifFalse:[ (dropType == #DndDir) ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4419
	t ~~ stringAtom ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4420
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4421
	    ^ self
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4422
	].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4423
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4424
	dropValue := dropValue asFilename.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4425
	dropType := #directory.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4426
    ] ifFalse:[ (dropType == #DndText) ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4427
	t ~~ stringAtom ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4428
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4429
	    ^ self
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4430
	].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4431
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4432
	dropValue := dropValue.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4433
	dropType := #text.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4434
    ] ifFalse:[ (dropType == #DndExe) ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4435
	t ~~ stringAtom ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4436
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4437
	    ^ self
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4438
	].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4439
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4440
	dropValue := dropValue.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4441
	dropType := #executable.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4442
    ] ifFalse:[ (dropType == #DndLink) ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4443
	t ~~ stringAtom ifTrue:[
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4444
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4445
	    ^ self
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4446
	].
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4447
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4448
	dropValue := dropValue.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4449
	dropType := #link.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4450
    ] ifFalse:[ (dropType == #DndRawData) ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4451
	dropValue := dropValue.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4452
	dropType := #rawData.
1552
969fd0309d2a more drop support
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
  4453
    ] ifFalse:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4454
	'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4455
	'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR. 
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4456
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4457
	dropValue := dropValue.
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4458
	dropType := #unknown.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4459
    ]]]]]]].
1543
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
    (sensor := targetView sensor) notNil ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4462
	sensor dropMessage:dropType data:dropValue view:targetView
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4463
    ] ifFalse:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4464
	"
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4465
	 not posted, if there is no sensor ...
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4466
	"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4467
    ]
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4468
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4469
    "Created: 4.4.1997 / 17:59:37 / cg"
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4470
    "Modified: 6.4.1997 / 14:50:44 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4471
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4472
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4473
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
  4474
    "forward an expose 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 exposeX: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
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4479
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4480
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4481
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4482
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4483
focusIn:view mode:mode detail:detail
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4484
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4485
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4486
    self focusInView:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4487
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4488
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4489
focusOut:view mode:mode detail:detail
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4490
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4491
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4492
    self focusOutView:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4493
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4494
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4495
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
  4496
    "forward a graphics-expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4497
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4498
    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
  4499
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4500
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4501
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4502
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4503
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4504
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4505
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
  4506
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4507
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4508
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4509
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4510
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4511
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4512
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4513
    key isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4514
	"/ happens sometimes on some systems
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4515
	"/ (alt-graph on sun has no keysym) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4516
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4517
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4518
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4519
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4520
    self keyPress:key x:x y:y view:view.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4521
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4522
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4523
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4524
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4525
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
  4526
    "forward a key-release event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4527
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4528
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4529
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4530
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4531
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4532
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4533
    key isNil ifTrue:[
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4534
	"/ happens sometimes on some systems
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4535
	"/ (alt-graph on sun has no keysym) 
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4536
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4537
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4538
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4539
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4540
    self keyRelease:key x:x y:y view:view.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4541
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4542
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4543
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4544
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4545
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4546
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4547
mappingNotify:view request:what event:eB
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4548
    "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4549
     Tell xlib about the fact."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4550
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4551
    (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4552
	self refreshKeyboardMapping:eB.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4553
	"Maybe some of our modifiers have been changed"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4554
	self initializeModifierMappings.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4555
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4556
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4557
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4558
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4559
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
  4560
    "forward a pointer enter event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4561
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4562
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4563
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4564
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4565
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4566
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4567
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4568
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4569
    self pointerEnter:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4570
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4571
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4572
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
  4573
    "forward a pointer leave event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4574
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4575
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4576
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4577
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4578
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4579
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4580
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4581
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4582
    self pointerLeave:state view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4583
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4584
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4585
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
  4586
    "sent when an X property changes.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4587
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4588
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4589
    aView isNil ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4590
	"/ event arrived, after I destroyed it myself
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4591
	^ self
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4592
    ].
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4593
"/    aView propertyChange:atom state:aSymbol.
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4594
!
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4595
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4596
selectionClear:aView atom:selectionID time:time
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4597
    "sent when another X-client has created a selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4598
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4599
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4600
    self setCopyBuffer:nil.
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4601
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4602
    SelectionHandlers notNil ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4603
	SelectionHandlers do:[:eachHandler |
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4604
	    eachHandler selectionClear:selectionID
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4605
	]
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4606
    ].
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4607
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4608
    "/ noone is interested in that ...
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4609
    "/ aView selectionClear:selectionID
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4610
!
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4611
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4612
selectionNotify:aView selection:selectionID target:targetID property:propertyID requestor:requestorID time:time
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4613
    "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
  4614
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4615
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4616
    |clipBoardContents|
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4617
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4618
"/    Transcript show:'seletionNotify selID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4619
"/    Transcript show:selectionID; show:' ('; show:(self atomName:selectionID); show:') '. 
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4620
"/    Transcript show:' targetID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4621
"/    Transcript show:targetID; show:' ('; show:(self atomName:targetID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4622
"/    Transcript show:' propertyID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4623
"/    Transcript show:propertyID; show:' ('; show:(self atomName:propertyID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4624
"/    Transcript showCR:''.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4625
"/    Transcript endEntry.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4626
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  4627
    clipBoardContents := self getProperty:propertyID type:targetID from:requestorID.
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4628
    clipBoardContents notNil ifTrue:[
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4629
        aView sensor pasteFromClipBoard:clipBoardContents view:aView
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4630
    ]
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4631
!
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4632
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4633
selectionRequest:aView requestor:requestorID selection:selectionID target:targetID property:propertyID time:time
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4634
    "sent by some other X-client to ask for the selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4635
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4636
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4637
    |selection targetIdOut|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4638
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4639
"/'Selection: ' print. (self atomName:selectionID) print. ' TargetId: ' print. (self atomName:targetID) print.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4640
"/' Property: ' print. (self atomName:propertyID) print. ' Requestor: ' print. requestorID printCR.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4641
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4642
    selection := self selectionAs:targetID.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4643
    selection isNil ifTrue:[
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4644
"/        ('XWorkstation: unsupported selection target ', (self atomName:targetID)) errorPrintCR.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4645
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4646
	"sending property None tells client, that i cannot convert"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4647
	self 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4648
	    sendSelectionNotifySelection:selectionID 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4649
	    property:nil 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4650
	    target:targetID
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4651
	    time:time
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4652
"/            from:aView id  BAD: nobody understands this
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4653
	    from:requestorID
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4654
	    to:requestorID.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4655
	^ self
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4656
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4657
"/'Send selection: ' print. selection printCR.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4658
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4659
    targetIdOut := targetID.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4660
    selection isString ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4661
	targetIdOut := self atomIDOf:#STRING.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4662
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4663
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4664
    self sendSelection:selection 
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4665
	 selection:selectionID 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4666
	 property:propertyID 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4667
	 target:targetIdOut 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4668
	 time:time 
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4669
"/         from:aView id    BAD: nobody understands this
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4670
	 from:requestorID 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4671
	 to:requestorID.
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4672
!
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4673
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4674
visibilityNotify:aView state:how
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4675
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4676
    aView notNil ifTrue:[
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4677
	aView visibilityChange:how
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4678
    ]
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4679
! !
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4680
3886
538d4ca3a587 method category rename
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4681
!XWorkstation methodsFor:'event forwarding-ignored events'!
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4682
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4683
circulateNotify:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4684
    "sent, when the stacking order changes.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4685
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4686
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4687
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4688
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4689
circulateRequest:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4690
    "sent, when the stacking order is about to change.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4691
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4692
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4693
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4694
colorMapNotify:aView state:aBoolean
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4695
    "sent, when another colormap is installed.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4696
     This is a very X-specific mechanism."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4697
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4698
    aView isNil ifTrue:[
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4699
	"/ event arrived, after I destroyed it myself
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4700
	^ self
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4701
    ].
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4702
    "/ not yet implemented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4703
    "/ aView colorMapChange
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4704
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4705
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4706
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4707
configureRequest:view x:x y:y width:w height:h above:above detail:detail
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4708
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4709
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4710
    "/ view configureRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4711
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4712
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4713
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4714
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4715
gravityNotify:aView x:x y:y
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4716
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4717
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4718
    "/ aView gravityNotify
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4719
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4720
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4721
keymapNotify:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4722
    "ignore for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4723
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4724
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4725
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4726
mapRequest:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4727
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4728
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4729
    "/ aView mapRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4730
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4731
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4732
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4733
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4734
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4735
reparentedView:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4736
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4737
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4738
    "/ aView reparented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4739
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4740
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4741
resizeRequest:aView width:width height:height
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4742
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4743
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4744
    "/ aView resizeRequest
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4745
! !
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4746
86
032006651226 *** empty log message ***
claus
parents: 83
diff changeset
  4747
!XWorkstation methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4748
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4749
defaultEventMask
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4750
    "return a mask to enable some events by default."
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4751
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4752
%{  /* NOCONTEXT */
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4753
    RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask |
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4754
			 KeyPressMask | KeyReleaseMask |
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4755
			 PointerMotionMask |
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4756
			 EnterWindowMask | LeaveWindowMask |
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4757
			 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask |
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  4758
			 PropertyChangeMask ));
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4759
%}
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4760
!
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4761
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4762
dispatchEvent:evArray
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4763
    |viewId view evType arguments|
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4764
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4765
    viewId := evArray at:1.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4766
    viewId notNil ifTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4767
	viewId = lastId ifTrue:[
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4768
	    view := lastView
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4769
	] ifFalse:[
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4770
	    view := self viewFromId:viewId
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4771
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4772
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4773
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4774
    evType := evArray at:3.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4775
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4776
    (self respondsTo:evType) ifTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4777
	arguments := evArray copyFrom:3 to:(3 + evType numArgs - 1).
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4778
	arguments at:1 put:view.
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4779
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4780
	self perform:evType withArguments:arguments.
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4781
	^ true.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4782
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4783
'********** unhandled event:' errorPrintCR.
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4784
evType errorPrintCR. (evArray at:2) errorPrintCR.
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4785
'********** see dispatchEvent' errorPrintCR.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4786
    ^ false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4787
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4788
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4789
dispatchEventFor:aViewIdOrNil withMask:eventMask
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4790
    "central event handling method:
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4791
     get next event and send appropriate message to the sensor or view.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4792
     If the argument aViewIdOrNil is nil, events for any view are processed,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4793
     otherwise only events for the view with given id are processed.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4794
     If the argument aMask is nonNil, only events for this eventMask are
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4795
     handled.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4796
     WARNING: this may block to wait for an event - you better check for a 
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4797
	      pending event before calling this."
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4799
    |eventArray|
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4800
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4801
    eventArray := Array new:13.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4802
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4803
    (self getEventFor:aViewIdOrNil withMask:eventMask into:eventArray) ifTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4804
	AbortSignal handle:[:ex |
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4805
	    ex return
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4806
	] do:[
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4807
	    self dispatchEvent:eventArray.
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4808
	]
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4809
    ].
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4810
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4811
    "Modified: 19.8.1997 / 17:10:42 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4812
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4813
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4814
dispatchExposeEventFor:aViewIdOrNil
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4815
    "get next expose event and send appropriate message to the sensor or view.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4816
     If the argument aViewIdOrNil is nil, events for any view are processed,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4817
     otherwise only events for the view with given id are processed.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4818
     WARNING: this may block to wait for an event - you better check for a 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4819
	      pending event before calling this."
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4820
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4821
    self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4822
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4823
    "Modified: 19.8.1997 / 17:10:26 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4824
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4825
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4826
dispatchLoop
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4827
    |flushBlock|
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4828
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4829
    flushBlock := [self flush].
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4830
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4831
    Processor addPreWaitAction:flushBlock.
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4832
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4833
    [
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4834
	super dispatchLoop
3778
77a339649f30 Remove preWaitACtion if dispatchLoop is finished.
Stefan Vogel <sv@exept.de>
parents: 3758
diff changeset
  4835
    ] ensure:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4836
	Processor removePreWaitAction:flushBlock.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4837
    ].
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4838
!
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4839
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4840
dispatchPendingEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4841
    "central event handling method for modal operation.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4842
     (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
  4843
     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
  4844
     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
  4845
     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
  4846
     we only handle exposes until the graphicsExpose arrives.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4847
     Other systems may not need such a kludge"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4848
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4849
    "interested in exposes only ?"
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  4850
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  4851
    |eventArray|
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  4852
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4853
    dispatchingExpose notNil ifTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4854
	[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4855
	    self dispatchExposeEventFor:dispatchingExpose
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4856
	].
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4857
	^ self
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4858
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4859
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  4860
    eventArray := Array new:13.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4861
    [self eventPendingWithSync:false] whileTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4862
	(self getEventFor:nil withMask:nil into:eventArray) ifTrue:[
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4863
	    AbortSignal handle:[:ex |
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4864
		ex return
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4865
	    ] do:[
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4866
		self dispatchEvent:eventArray.
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4867
	    ]
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  4868
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4869
    ]
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4870
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4871
    "Modified: 19.8.1997 / 17:11:18 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4872
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4873
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4874
disposeEventsWithMask:aMask for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4875
    "dispose (throw away) specific events. If aWindowId is nil,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4876
     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
  4877
     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
  4878
     view are flushed."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4879
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4880
    <context: #return>
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  4881
%{ /* UNLIMITEDSTACK */
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4882
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4883
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4884
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4885
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4886
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4887
     && __isSmallInteger(aMask)) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4888
	Display *dpy = myDpy;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4889
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4890
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4891
	if (__isExternalAddress(aWindowIdOrNil)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4892
	    win = __WindowVal(aWindowIdOrNil);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4893
	    while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4894
	} else {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4895
	    while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4896
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4897
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  4898
	RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4899
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4900
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4901
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4902
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4903
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4904
eventMaskFor:anEventSymbol
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4905
    "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
  4906
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4907
%{  /* NOCONTEXT */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4908
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4909
    int m = 0;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4910
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4911
    if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4912
    else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4913
    else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4914
    else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4915
    else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4916
    else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4917
    else if (anEventSymbol == @symbol(expose)) m = ExposureMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4918
    else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4919
    else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4920
    else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4921
    else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4922
    else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4923
    else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4924
    else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4925
    else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4926
    else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4927
    RETURN (__MKSMALLINT(m));
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4928
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4929
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4930
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4931
eventPending
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4932
    "return true, if any event is pending. 
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4933
     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
  4934
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4935
    "/ ConservativeSync is required for some Xlib implementation,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4936
    "/ 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
  4937
    "/ (especially Win32 & Xlib)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4938
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4939
    ConservativeSync == true ifTrue:[self sync].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4940
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4941
    dispatchingExpose notNil ifTrue:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4942
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4943
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4944
    ^ self eventPendingWithSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4945
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4946
    "Modified: / 28.4.1999 / 11:08:12 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4947
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4948
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4949
eventPending:anEventSymbol for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4950
    "return true, if a specific event is pending"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4951
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4952
    ^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4953
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4954
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4955
eventPending:anEventMask for:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4956
    "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
  4957
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4958
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4959
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4960
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4961
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4962
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4963
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4964
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4965
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4966
    if (ISCONNECTED && __isSmallInteger(anEventMask)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4967
	Display *dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4968
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4969
	ENTER_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4970
	if (doSync == true) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4971
	    XSync(dpy, 0);      /* make certain everything is flushed */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4972
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4973
	if (__isExternalAddress(aWindowIdOrNil)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4974
	    win = __WindowVal(aWindowIdOrNil);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4975
	    thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4976
	} else {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4977
	    thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4978
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4979
	if (thereIsOne) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4980
	    XPutBackEvent(dpy, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4981
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4982
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4983
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4984
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4985
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4986
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4987
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4988
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4989
eventPendingWithSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4990
    "return true, if any event is pending. 
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4991
     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
  4992
     before checking."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4993
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4994
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4995
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4996
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4997
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4998
    if (ISCONNECTED) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  4999
	Display *dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5000
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5001
	if (XEventsQueued(dpy, QueuedAlready)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5002
	    RETURN (true);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5003
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5004
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5005
	ENTER_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5006
	if (doSync == true) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5007
	    XSync(dpy, 0);      /* make certain everything is flushed */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5008
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5009
	if (XPending(dpy)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5010
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5011
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5012
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5013
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5014
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5015
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5016
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5017
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5018
eventQueued
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5019
    "return true, if any event is queued"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5020
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5021
    dispatchingExpose notNil ifTrue:[
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5022
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5023
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5024
    ^ self eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5025
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5026
    "Created: 12.12.1995 / 21:43:00 / stefan"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5027
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5028
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5029
eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5030
    "return true, if any event is queued internally.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5031
     (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
  5032
      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
  5033
      the display connection)."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5034
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5035
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5036
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5037
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5038
    if (ISCONNECTED) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5039
	/* ENTER ... LEAVE not needed; XEventsQueued will not block */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5040
	/* ENTER_XLIB(); */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5041
	if (XEventsQueued(myDpy, QueuedAlready)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5042
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5043
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5044
	/* LEAVE_XLIB(); */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5045
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5046
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5047
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5048
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5049
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5050
exposeEventPendingFor:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5051
    "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
  5052
     or any view (if the arg is nil).
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5053
     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
  5054
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5055
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5056
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5057
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5058
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5059
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5060
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5061
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5062
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5063
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5064
    if (ISCONNECTED) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5065
	Display *dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5066
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5067
	ENTER_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5068
	if (doSync == true) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5069
	    XSync(dpy, 0);      /* make certain everything is flushed */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5070
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5071
	if (__isExternalAddress(aWindowIdOrNil)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5072
	    win = __WindowVal(aWindowIdOrNil);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5073
	    thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5074
	} else {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5075
	    thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5076
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5077
	if (thereIsOne) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5078
	    XPutBackEvent(dpy, &ev);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5079
	    rslt = true;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5080
	}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5081
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5082
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5083
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5084
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5085
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5086
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5087
getEventFor:aViewIdOrNil withMask:eventMask into:anEventArray
3948
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  5088
    "read next event if there is one and put events data into anEventArray. 
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5089
     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
  5090
     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
  5091
     Returns true, if there was an event, false otherwise.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5092
     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
  5093
     before calling for it.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5094
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5095
     The event fields are placed them into anEventArray (must be at least size 13):
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5096
     the fields are:
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5097
        1:      windowID
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5098
        2:      eventType-ID
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5099
        3:      eventTypeSymbol
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5100
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5101
        4..     args
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5102
3948
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  5103
     Sorry I had to split dispatch into this fetch method and a separate
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  5104
     handler method to allow UNLIMITEDSTACK here.
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  5105
     (some Xlibs do a big alloca there which cannot be done in 
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  5106
      #dispatchEvent:, since it dispatches out into ST-methods).
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5107
    "
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5108
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5109
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5110
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5111
    Display *dpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5112
    Window win, wWanted;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5113
    int evMask, returnValue;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5114
    XEvent ev;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5115
    OBJ eB;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5116
    KeySym keySym;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5117
    unsigned char buffer[10];                                               
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5118
    int i, nchars;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5119
    char *keySymString;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5120
    char keySymStringBuffer[32];
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5121
    unsigned INT nextMultiClickTime;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5122
    OBJ arg, sym, t, windowID;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5123
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5124
    if (! ISCONNECTED) {
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5125
        RETURN (false);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5126
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5127
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5128
    dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5129
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5130
    ev.type = 0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5131
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5132
    if (__isSmallInteger(eventMask)) {
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5133
        evMask = __intVal(eventMask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5134
    } else {
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5135
        evMask = ~0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5136
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5137
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5138
    if (__isExternalAddress(aViewIdOrNil)) {
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5139
        wWanted = __WindowVal(aViewIdOrNil);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5140
        returnValue = XCheckWindowEvent(dpy, wWanted, evMask, &ev);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5141
    } else {
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5142
        if (evMask == ~0) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5143
            XNextEvent(dpy, &ev);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5144
            returnValue = 1;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5145
        } else {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5146
            returnValue = XCheckMaskEvent(dpy, evMask, &ev);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5147
        }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5148
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5149
    if (!returnValue) {
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5150
        /* there is no event */
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5151
        RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5152
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5153
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5154
    if (anEventArray == nil) {
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5155
        /* sender is not interested in the event */
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5156
        RETURN(true);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5157
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5158
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5159
    if (!__isArray(anEventArray)) {
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5160
        fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5161
        RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5162
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5163
    if (__arraySize(anEventArray) < 11) {
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5164
        fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5165
        RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5166
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5167
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5168
#   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5169
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5170
#   define ae ((XAnyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5171
#   define ee ((XExposeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5172
#   define ke ((XKeyPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5173
#   define be ((XButtonPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5174
#   define ce ((XConfigureEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5175
#   define cr ((XConfigureRequestEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5176
#   define me ((XMotionEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5177
#   define ele ((XCrossingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5178
#   define de ((XDestroyWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5179
#   define ve ((XVisibilityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5180
#   define fe ((XFocusChangeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5181
#   define cre ((XCreateWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5182
#   define mape ((XMappingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5183
#   define gre ((XGravityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5184
#   define rr ((XResizeRequestEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5185
#   define cie ((XCirculateEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5186
#   define pe ((XPropertyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5187
#   define sce ((XSelectionClearEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5188
#   define cme ((XColormapEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5189
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5190
    if (((t = __INST(lastId)) != nil)
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5191
         && __isExternalAddress(t)
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5192
         && (__WindowVal(t) == ae->window)) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5193
        windowID = t;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5194
    } else {
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5195
        windowID = __MKEXTERNALADDRESS(ae->window);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5196
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5197
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5198
    __ArrayInstPtr(anEventArray)->a_element[0] = windowID; __STORE(anEventArray, windowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5199
    __ArrayInstPtr(anEventArray)->a_element[1] = __MKSMALLINT(ev.type);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5200
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5201
    switch (ev.type) {
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5202
        case KeyRelease:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5203
            sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5204
            goto keyPressAndRelease;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5205
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5206
        case KeyPress:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5207
            sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5208
            /* FALL INTO */
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5209
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5210
        keyPressAndRelease:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5211
            arg = nil;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5212
            nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5213
            if (nchars 
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5214
             && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5215
                 || (buffer[0] >= 0x80))) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5216
                arg = __MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5217
                keySymString = NULL;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5218
            } else {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5219
                keySymString = XKeysymToString(keySym);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5220
                if (keySymString) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5221
                    arg = __MKSYMBOL(keySymString, 0);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5222
                } else {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5223
                    arg = nil;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5224
                }
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5225
            }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5226
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5227
#ifdef IGNORE_UNKNOWN_KEYCODES
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5228
            if (arg == nil) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5229
                /* happens sometimes (alt-graph on sun has no keysym) */
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5230
                RETURN (false);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5231
            }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5232
#endif
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5233
            __ArrayInstPtr(anEventArray)->a_element[2] = sym;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5234
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5235
            __ArrayInstPtr(anEventArray)->a_element[3] = arg; __STORE(anEventArray, arg);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5236
            __ArrayInstPtr(anEventArray)->a_element[4] = t = __MKUINT(ke->keycode); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5237
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ke->state);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5238
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ke->x);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5239
            __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ke->y);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5240
            __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ke->x_root);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5241
            __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ke->y_root);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5242
            __ArrayInstPtr(anEventArray)->a_element[10] = t = __MKUINT(ke->time); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5243
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5244
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5245
        case ButtonPress:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5246
            sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5247
            goto buttonPressAndRelease;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5248
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5249
        case ButtonRelease:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5250
            sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5251
            /* fall into */
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5252
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5253
        buttonPressAndRelease:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5254
            __ArrayInstPtr(anEventArray)->a_element[2] = sym;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5255
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(be->button);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5256
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ke->state);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5257
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(be->x);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5258
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(be->y);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5259
            __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(be->x_root);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5260
            __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(be->y_root);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5261
            __ArrayInstPtr(anEventArray)->a_element[9] = t = __MKUINT(be->time); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5262
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5263
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5264
        case MotionNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5265
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(buttonMotion:state:x:y:rootX:rootY:time:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5266
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5267
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(me->state);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5268
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(me->x);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5269
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(me->y);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5270
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(me->x_root);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5271
            __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(me->y_root);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5272
            __ArrayInstPtr(anEventArray)->a_element[8] = t = __MKUINT(me->time); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5273
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5274
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5275
        case FocusIn:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5276
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusIn:mode:detail:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5277
            goto focusInOut;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5278
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5279
        case FocusOut:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5280
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusOut:mode:detail:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5281
            /* fall into */
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5282
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5283
        focusInOut:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5284
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(fe->mode);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5285
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(fe->detail);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5286
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5287
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5288
        case EnterNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5289
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerEnter:x:y:rootX:rootY:state:mode:detail:time:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5290
            goto enterLeave;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5291
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5292
        case LeaveNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5293
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerLeave:x:y:rootX:rootY:state:mode:detail:time:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5294
            /* fall into */
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5295
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5296
        enterLeave:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5297
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ele->x);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5298
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ele->y);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5299
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ele->x_root);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5300
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ele->y_root);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5301
            __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ele->state);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5302
            __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ele->mode);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5303
            __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ele->detail);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5304
            __ArrayInstPtr(anEventArray)->a_element[10] = t = __MKUINT(ele->time); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5305
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5306
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5307
        case Expose:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5308
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(expose:x:y:width:height:count:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5309
            goto expose;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5310
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5311
        case GraphicsExpose:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5312
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(graphicsExpose:x:y:width:height:count:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5313
            /* fall into */
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5314
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5315
        expose:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5316
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ee->x);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5317
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ee->y);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5318
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ee->width);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5319
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ee->height);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5320
            __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ee->count);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5321
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5322
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5323
        case NoExpose:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5324
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(noExposeView:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5325
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5326
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5327
        case VisibilityNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5328
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(visibilityNotify:state:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5329
            switch (ve->state) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5330
                case VisibilityUnobscured:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5331
                    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(unobscured);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5332
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5333
                case VisibilityPartiallyObscured:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5334
                    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(partiallyObscured);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5335
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5336
                case VisibilityFullyObscured:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5337
                    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(fullyObscured);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5338
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5339
                default:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5340
                    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(ve->state);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5341
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5342
            }
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5343
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5344
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5345
        case CreateNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5346
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(createWindow:x:y:width:height:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5347
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cre->x);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5348
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cre->y);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5349
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cre->width);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5350
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cre->height);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5351
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5352
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5353
        case DestroyNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5354
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(destroyedView:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5355
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5356
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5357
        case UnmapNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5358
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unmappedView:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5359
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5360
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5361
        case MapNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5362
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappedView:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5363
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5364
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5365
        case ConfigureNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5366
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configure:x:y:width:height:above:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5367
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ce->x);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5368
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ce->y);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5369
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ce->width);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5370
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ce->height);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5371
            __ArrayInstPtr(anEventArray)->a_element[7] = nil;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5372
            if (ce->above != None) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5373
                __ArrayInstPtr(anEventArray)->a_element[7] = t = __MKEXTERNALADDRESS(ce->above); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5374
            }
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5375
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5376
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5377
        case GravityNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5378
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(gravityNotify:x:y:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5379
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(gre->x);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5380
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(gre->y);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5381
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5382
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5383
        case ResizeRequest:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5384
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(resizeRequest:width:height:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5385
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(rr->width);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5386
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rr->height);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5387
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5388
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5389
        case ConfigureRequest:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5390
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configureRequest:x:y:width:height:above:detail:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5391
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cr->x);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5392
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cr->y);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5393
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cr->width);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5394
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cr->height);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5395
            __ArrayInstPtr(anEventArray)->a_element[7] = nil;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5396
            if (cr->above != None) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5397
                __ArrayInstPtr(anEventArray)->a_element[7] = t = __MKEXTERNALADDRESS(cr->above); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5398
            }
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5399
            switch (cr->detail) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5400
                case Above:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5401
                    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(above);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5402
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5403
                case Below:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5404
                    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(below);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5405
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5406
                case TopIf:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5407
                    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(topIf);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5408
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5409
                case BottomIf:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5410
                    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(bottomIf);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5411
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5412
                case Opposite:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5413
                    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(opposite);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5414
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5415
                default:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5416
                    __ArrayInstPtr(anEventArray)->a_element[8] = __MKSMALLINT(cr->detail);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5417
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5418
            }
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5419
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5420
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5421
        case CirculateNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5422
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateNotify:place:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5423
            goto circulate;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5424
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5425
        case CirculateRequest:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5426
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateRequest:place:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5427
            /* fall into */
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5428
        circulate:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5429
            switch (cie->place) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5430
                case PlaceOnTop:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5431
                    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnTop);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5432
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5433
                case PlaceOnBottom:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5434
                    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnBottom);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5435
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5436
                default:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5437
                    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(cie->place);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5438
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5439
            }
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5440
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5441
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5442
        case PropertyNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5443
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(propertyChange:atom:state:time:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5444
            __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(pe->atom);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5445
            switch (pe->state) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5446
                case PropertyNewValue:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5447
                    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(newValue);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5448
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5449
                case PropertyDelete:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5450
                    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(deleted);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5451
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5452
                default:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5453
                    __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(pe->state);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5454
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5455
            }
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5456
            __ArrayInstPtr(anEventArray)->a_element[5] = t = __MKUINT(pe->time); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5457
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5458
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5459
        case SelectionClear:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5460
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionClear:atom:time:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5461
            __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(sce->selection); 
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5462
            __ArrayInstPtr(anEventArray)->a_element[4] = t = __MKUINT(sce->time);         __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5463
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5464
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5465
        case SelectionRequest:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5466
            /*
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5467
             * someone wants the selection
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5468
             */
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5469
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5470
            __ArrayInstPtr(anEventArray)->a_element[3] = t = __MKEXTERNALADDRESS(ev.xselectionrequest.requestor); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5471
            __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselectionrequest.selection); 
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5472
            __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselectionrequest.target);    
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5473
            __ArrayInstPtr(anEventArray)->a_element[6] = __MKATOMOBJ(ev.xselectionrequest.property);  
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5474
            __ArrayInstPtr(anEventArray)->a_element[7] = t = __MKUINT(ev.xselectionrequest.time);         __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5475
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5476
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5477
        case SelectionNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5478
            /*
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5479
             * returned selection value (answer from SelectionRequest)
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5480
             */
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5481
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5482
            __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xselection.selection); 
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5483
            __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselection.target);    
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5484
            __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselection.property);  
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5485
            __ArrayInstPtr(anEventArray)->a_element[6] = t = __MKEXTERNALADDRESS(ev.xselection.requestor); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5486
            __ArrayInstPtr(anEventArray)->a_element[7] = t = __MKUINT(ev.xselection.time); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5487
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5488
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5489
        case ColormapNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5490
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(colormapNotify:state:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5491
            __ArrayInstPtr(anEventArray)->a_element[3] = cme->state == ColormapInstalled ? true : false;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5492
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5493
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5494
        case ClientMessage:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5495
            if (ev.xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5496
                if ((ev.xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom)))
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5497
                 || (ev.xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5498
                    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(terminateView:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5499
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5500
                }
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5501
                if (ev.xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5502
                    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(saveAndTerminateView:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5503
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5504
                }
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5505
            }
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5506
            /*
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5507
             * any other client message
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5508
             */
3948
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  5509
printf("clientMessage type:%d format:%d\n", ev.xclient.message_type, ev.xclient.format);
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5510
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(clientMessage:type:format:data:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5511
            __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xclient.message_type);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5512
            __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(ev.xclient.format);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5513
            __ArrayInstPtr(anEventArray)->a_element[5] = t = __MKBYTEARRAY(ev.xclient.data, sizeof(ev.xclient.data)); __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5514
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5515
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5516
        case MappingNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5517
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappingNotify:request:event:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5518
            switch(mape->request) {
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5519
                case MappingModifier:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5520
                    arg = @symbol(mappingModifier);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5521
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5522
                case MappingKeyboard:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5523
                    arg = @symbol(mappingKeyboard);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5524
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5525
                case MappingPointer:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5526
                    arg = @symbol(mappingPointer);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5527
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5528
                default:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5529
                    arg = __MKSMALLINT(mape->request);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5530
                    break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5531
            }
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5532
            __ArrayInstPtr(anEventArray)->a_element[3] = arg;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5533
            __ArrayInstPtr(anEventArray)->a_element[4] = t = __MKBYTEARRAY(&ev, sizeof(*mape));
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5534
            __STORE(anEventArray, t);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5535
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5536
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5537
        case KeymapNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5538
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(keymapNotify:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5539
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5540
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5541
        case MapRequest:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5542
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mapRequest:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5543
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5544
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5545
        case ReparentNotify:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5546
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(reparentedView:);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5547
            break;
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5548
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5549
        default:
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5550
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unknownX11Event);
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  5551
            break;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5552
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5553
#undef ae
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5554
#undef ee
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5555
#undef ke
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5556
#undef be
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5557
#undef ce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5558
#undef cr
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5559
#undef cre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5560
#undef cle
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5561
#undef gre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5562
#undef me
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5563
#undef ewe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5564
#undef ele
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5565
#undef lwe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5566
#undef de
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5567
#undef mape
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5568
#undef ve
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5569
#undef fe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5570
#undef rr
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5571
#undef pe
3799
65c6905e1250 Instvar eventbuffer no longer needed
Stefan Vogel <sv@exept.de>
parents: 3798
diff changeset
  5572
#undef cie
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5573
#undef sce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5574
#undef cme
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5575
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5576
%}.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5577
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5578
    ^ true
3319
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
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5581
handleAllEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5582
    "from now on, handle any kind of event"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5583
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5584
    dispatchingExpose := nil
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
handleExposeOnlyFor:aView
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5588
    "from now on, handle expose events only"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5589
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5590
    dispatchingExpose := aView id
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5591
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5592
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5593
setEventMask:aMask in:aWindowId
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5594
    "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
  5595
     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
  5596
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5597
    <context: #return>
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
    int mask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5601
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5602
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5603
     && __isExternalAddress(aWindowId)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5604
     && __isSmallInteger(aMask)) {
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5605
	mask = __intVal(aMask);
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5606
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5607
#ifdef OLD
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5608
	/* these may not be disabled */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5609
	mask |= ExposureMask | StructureNotifyMask |
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5610
		KeyPressMask | KeyReleaseMask |
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5611
		EnterWindowMask | LeaveWindowMask |
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5612
		ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5613
#endif
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5614
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5615
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5616
	XSelectInput(myDpy, __WindowVal(aWindowId), mask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5617
	LEAVE_XLIB();
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5618
	RETURN ( self );
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
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5621
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5622
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5623
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5624
startDispatch
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5625
    "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
  5626
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5627
    dispatching ifTrue:[^ self].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5628
    dispatchingExpose := nil.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5629
    super startDispatch
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
3885
f00086641b23 method category rename
Claus Gittinger <cg@exept.de>
parents: 3883
diff changeset
  5632
!XWorkstation methodsFor:'event handling-old dispatch'!
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5633
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5634
buttonPress:button x:x y:y view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5635
    "forward a button-press event for some view"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5636
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5637
    aView isNil ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5638
	"/ event arrived, after I destroyed it myself
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5639
	^ self
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5640
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5641
    button == 1 ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5642
	activateOnClick == true ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5643
	    "/ dont raise above an active popup view.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5644
	    (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5645
		aView topView raise.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5646
"/            ] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5647
"/                activeKeyboardGrab printCR.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5648
"/                activePointerGrab printCR.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5649
	    ]
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5650
	].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5651
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5652
    super buttonPress:button x:x y:y view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5653
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5654
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5655
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5656
! !
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5657
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5658
!XWorkstation methodsFor:'event sending'!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5659
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5660
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
  5661
    "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
  5662
     The client message gets message_type and msgFormat as specified by
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5663
     the arguments. The additional data arguments specify up to
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5664
     5 longWords of user data; each may be an integer or nil.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5665
     It is passed transparently in the events data field.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5666
     See XProtocol specification for more details."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5667
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5668
    "/ Event.xclient.type              = ClientMessage;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5669
    "/ Event.xclient.display           = dpy;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5670
    "/ Event.xclient.message_type      = msgType;
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5671
    "/ Event.xclient.format            = msgFormat;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5672
    "/ Event.xclient.window            = targetWindowID;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5673
    "/ Event.xclient.data.l[0]         = d1
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5674
    "/ Event.xclient.data.l[1]         = d2
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5675
    "/ Event.xclient.data.l[2]         = d3
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5676
    "/ Event.xclient.data.l[3]         = d4
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5677
    "/ Event.xclient.data.l[4]         = d5
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5678
    "/
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5679
    "/ XSendEvent(dpy,DispatchWindow,True,NoEventMask,&Event);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5680
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5681
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5682
%{  
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5683
    int type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5684
    int state;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5685
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5686
    if (ISCONNECTED
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5687
     && __isInteger(msgType)
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5688
     && __isInteger(msgFormat)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5689
     && (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5690
	Display *dpy = myDpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5691
	XEvent ev;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5692
	Status result;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5693
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5694
	if (__isInteger(d1)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5695
	    ev.xclient.data.l[0] = __longIntVal(d1);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5696
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5697
	    if (__isExternalAddress(d1)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5698
		ev.xclient.data.l[0] = (int)__externalAddressVal(d1);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5699
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5700
		ev.xclient.data.l[0] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5701
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5702
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5703
	if (__isInteger(d2)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5704
	    ev.xclient.data.l[1] = __longIntVal(d2);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5705
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5706
	    if (__isExternalAddress(d2)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5707
		ev.xclient.data.l[1] = (int)__externalAddressVal(d2);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5708
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5709
		ev.xclient.data.l[1] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5710
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5711
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5712
	if (__isInteger(d3)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5713
	    ev.xclient.data.l[2] = __longIntVal(d3);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5714
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5715
	    if (__isExternalAddress(d3)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5716
		ev.xclient.data.l[2] = (int)__externalAddressVal(d3);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5717
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5718
		ev.xclient.data.l[2] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5719
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5720
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5721
	if (__isInteger(d4)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5722
	    ev.xclient.data.l[3] = __longIntVal(d4);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5723
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5724
	    if (__isExternalAddress(d4)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5725
		ev.xclient.data.l[3] = (int)__externalAddressVal(d4);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5726
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5727
		ev.xclient.data.l[3] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5728
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5729
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5730
	if (__isInteger(d5)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5731
	    ev.xclient.data.l[4] = __longIntVal(d5);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5732
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5733
	    if (__isExternalAddress(d5)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5734
		ev.xclient.data.l[4] = (int)__externalAddressVal(d5);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5735
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5736
		ev.xclient.data.l[4] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5737
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5738
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5739
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5740
	if (__isExternalAddress(targetWindowID)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5741
	    ev.xclient.window = __WindowVal(targetWindowID);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5742
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5743
	    ev.xclient.window = (Window)__longIntVal(targetWindowID);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5744
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5745
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5746
	ev.xclient.type              = ClientMessage;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5747
	ev.xclient.display           = dpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5748
	ev.xclient.message_type      = __longIntVal(msgType);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5749
	ev.xclient.format            = __longIntVal(msgFormat);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5750
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5751
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5752
	result = XSendEvent(dpy, ev.xclient.window, True, NoEventMask , &ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5753
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5754
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5755
	if ((result == BadValue) || (result == BadWindow)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5756
	    DPRINTF(("bad status in sendClientEvent\n"));
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5757
	    RETURN ( false )
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5758
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5759
	RETURN (true)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5760
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5761
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5762
    self primitiveFailedOrClosedConnection.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5763
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5764
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5765
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5766
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
  5767
    "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
  5768
     TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5769
     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
  5770
     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
  5771
     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
  5772
     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
  5773
     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
  5774
     (not very user friendly)"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5775
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5776
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5777
%{ 
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5778
    int type;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5779
    int state;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5780
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5781
    if (__isSmallInteger(stateMask)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5782
	state = __intVal(stateMask);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5783
    } else {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5784
	state = 0;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5785
    }
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5786
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5787
    if (ISCONNECTED
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5788
     && __isSmallInteger(xPos) && __isSmallInteger(yPos)
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5789
     && (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr))
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5790
     && (__isExternalAddress(targetId) || __isInteger(targetId))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5791
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5792
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5793
	XEvent ev;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5794
	Window target;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5795
	Status result;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5796
	KeySym keySym, *syms;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5797
	int screen = __intVal(__INST(screen));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5798
	char s[2];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5799
	int nSyms;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5800
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5801
	if ((typeSymbol == @symbol(keyPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5802
	 || (typeSymbol == @symbol(keyRelease))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5803
	    if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5804
		keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5805
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5806
		if (__isCharacter(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5807
		    s[0] = __intVal(__characterVal(keySymCodeOrButtonNr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5808
		    s[1] = '\0';
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5809
		    keySym = XStringToKeysym(s);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5810
		} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5811
		    keySym = (KeySym) __intVal(keySymCodeOrButtonNr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5812
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5813
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5814
	    ev.xkey.keycode = XKeysymToKeycode(dpy, keySym);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5815
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5816
	    if (stateMask == nil) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5817
		/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5818
		 * get the modifier from the keySym
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5819
		 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5820
		nSyms = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5821
		syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5822
		if (syms) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5823
		    int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5824
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5825
		    for (i=0; i<nSyms; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5826
			if (syms[i] == keySym) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5827
#ifdef MODIFIERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5828
			    printf("modifier-index is %d\n", i);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5829
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5830
			    if (i) state = (1 << (i-1));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5831
			    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5832
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5833
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5834
		    XFree(syms);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5835
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5836
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5837
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5838
	    if ((typeSymbol == @symbol(buttonPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5839
	     || (typeSymbol == @symbol(buttonRelease))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5840
		if (__isSmallInteger(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5841
		    ev.xbutton.button = __intVal(keySymCodeOrButtonNr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5842
		} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5843
		    ev.xbutton.button = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5844
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5845
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5846
		DPRINTF(("invalid sendEvent typeSymbol\n"));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5847
		RETURN (false);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5848
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5849
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5850
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5851
	if (typeSymbol == @symbol(keyPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5852
	    ev.xany.type = KeyPress;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5853
	else if (typeSymbol == @symbol(keyRelease))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5854
	    ev.xany.type = KeyRelease;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5855
	else if (typeSymbol == @symbol(buttonPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5856
	    ev.xany.type = ButtonPress;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5857
	else if (typeSymbol == @symbol(buttonRelease))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5858
	    ev.xany.type = ButtonRelease;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5859
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5860
	if (__isExternalAddress(targetId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5861
	    target = __WindowVal(targetId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5862
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5863
	    target = (Window) __longIntVal(targetId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5864
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5865
	ev.xkey.window = target;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5866
	ev.xkey.same_screen = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5867
	ev.xkey.subwindow = 0;
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  5868
	ev.xkey.root = RootWindow(dpy, screen);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5869
	ev.xkey.x = __intVal(xPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5870
	ev.xkey.y = __intVal(yPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5871
	ev.xkey.state = state;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5872
	ev.xkey.time = CurrentTime;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5873
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5874
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5875
	result = XSendEvent(dpy, target, False, 0 , &ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5876
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5877
	if ((result == BadValue) || (result == BadWindow)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5878
	    DPRINTF(("bad status\n"));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5879
	    RETURN ( false )
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5880
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5881
	RETURN (true)
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5882
    }
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5883
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5884
    self primitiveFailedOrClosedConnection.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5885
    ^ false
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5886
! !
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5887
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5888
!XWorkstation methodsFor:'font stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5889
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5890
createFontFor:aFontName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5891
    "a basic method for X-font allocation; this method allows
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5892
     any font to be aquired (even those not conforming to
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5893
     standard naming conventions, such as cursor, fixed or k14)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5894
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5895
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5896
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5897
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5898
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5899
    XFontStruct *newFont;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5900
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5901
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5902
     && __isNonNilObject(aFontName)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5903
     && (__qIsString(aFontName) || __qIsSymbol(aFontName))) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5904
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5905
	ENTER_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5906
	newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5907
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  5908
#ifdef COUNT_RESOURCES
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5909
	if (newFont)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5910
	    __cnt_font++;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5911
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5912
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5913
	RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5914
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5915
%}.
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  5916
    "/ --- disabled due to UNLIMITEDSTACK -- self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5917
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5918
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5919
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5920
decomposeXFontName:aString into:aBlock
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5921
    "extract family, face, style and size from an
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5922
     X-font name
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5923
     1 2     3      4    5     6         7 8      9    10   11   12 13 14       15
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5924
      -brand-family-face-style-moreStyle- -height-size-resX-resY-??-??-registry-encoding; 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5925
     evaluate aBlock with these"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5926
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5927
    |family face style moreStyle fheight size
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5928
     resX resY registry encoding coding fields|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5929
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5930
    aString isNil ifTrue:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5931
    fields := aString asCollectionOfSubstringsSeparatedBy:$-.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5932
    fields size == 3 ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5933
	"take care of old font names: family-style-size"
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5934
	family := fields at:1.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5935
	style := fields at:2.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5936
	size := Number readFromString:(fields at:3) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5937
    ] ifFalse:[fields size == 2 ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5938
	"take care of old font names: family-size"
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5939
	family := fields at:1.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5940
	size := Number readFromString:(fields at:2) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5941
    ] ifFalse:[fields size >= 15 ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5942
	family := fields at:3.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5943
	face := fields at:4.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5944
	style := fields at:5.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5945
	style = 'o' ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5946
	    style := 'oblique'
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5947
	] ifFalse:[style = 'i' ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5948
	     style := 'italic'
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5949
	] ifFalse:[style = 'r' ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5950
	     style := 'roman'
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5951
	]]].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5952
	moreStyle := fields at:6.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5953
	(moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5954
	    style := style, '-', moreStyle.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5955
	].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5956
	fheight := fields at:8.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5957
	size := (Number readFromString:(fields at:9) onError:[^ false]) / 10.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5958
	resX := fields at:10.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5959
	resY := fields at:11.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5960
	registry := fields at:14.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5961
	encoding := fields at:15.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5962
	coding := registry , '-' , encoding.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5963
    ] ifFalse:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5964
	^ false
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5965
    ]]].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5966
    aBlock value:family value:face value:style value:size value:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5967
    ^ true
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  5968
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  5969
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  5970
encodingOf:aFontId
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  5971
    "the fonts encoding - if the font does not provide that info,
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  5972
     return nil (and assume #ascii, which is a subset of #iso8859)."
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  5973
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5974
    |props reg enc coll|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5975
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5976
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5977
    reg := props at:#'CHARSET_REGISTRY' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5978
    enc := props at:#'CHARSET_ENCODING' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5979
    coll := props at:#'CHARSET_COLLECTIONS' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5980
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5981
    reg notNil ifTrue:[ reg := self atomName:reg].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5982
    enc notNil ifTrue:[ enc := self atomName:enc].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5983
    coll notNil ifTrue:[ coll := self atomName:coll].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5984
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5985
    ^ self extractEncodingFromRegistry:reg encoding:enc charSetCollections:coll
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5986
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5987
     "
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  5988
       Screen current encodingOf:Screen current getDefaultFont 
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  5989
     "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5990
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5991
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5992
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  5993
    "given registry and encoding as returned by X11,
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  5994
     generate a single symbol naming the ST/X encoding.
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  5995
     I.e. from registry='ISO8859' and encoding='1', generate #'iso8859-1'.
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  5996
     This is pure magic ..."
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  5997
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  5998
    |enc charSets|
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  5999
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6000
    (registry size ~~ 0) ifTrue:[
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6001
        enc := registry asLowercase.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6002
        encoding size ~~ 0 ifTrue:[
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6003
           enc := enc, '-', encoding asLowercase.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6004
        ].
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6005
        enc := enc asSymbol.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6006
    ] ifFalse:[
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6007
        (encoding size ~~ 0) ifTrue:[
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6008
            enc := encoding asLowercase asSymbol
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6009
        ] ifFalse:[
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6010
            charSets := charSetCollections.    
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6011
            (charSets notNil and:[charSets notEmpty]) ifTrue:[
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6012
                charSets := charSets asUppercase asCollectionOfWords.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6013
                (charSets includes:'ISO8859-1') ifTrue:[
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6014
                    enc := #'iso8859-1'
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6015
                ] ifFalse:[
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6016
                    (charSets includes:'ISO8859') ifTrue:[
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6017
                        enc := #iso8859
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6018
                    ] ifFalse:[
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6019
                        (charSets includes:'ASCII') ifTrue:[
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6020
                            enc := #ascii
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6021
                        ] ifFalse:[
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6022
                            (charSets includes:'ADOBE-STANDARD') ifTrue:[
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6023
                                enc := #iso8859
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6024
                            ]
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6025
                        ]
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6026
                    ]
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6027
                ]
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6028
            ] 
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  6029
        ]
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6030
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6031
    ^  enc
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6032
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6033
    "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
  6034
    "Modified: 17.4.1996 / 17:22:35 / cg"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6035
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6036
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6037
flushListOfAvailableFonts
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6038
    "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
  6039
     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
  6040
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6041
    listOfXFonts := nil
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6042
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6043
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6044
     Display flushListOfAvailableFonts.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6045
     Display listOfAvailableFonts
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6046
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6047
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6048
    "Modified: 27.9.1995 / 10:54:47 / stefan"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6049
    "Created: 20.2.1996 / 22:55:52 / cg"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6050
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6051
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6052
fontDescriptionFromXFontName:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6053
    "extract family, face, style and size from an
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6054
     X-font name
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6055
     1 2     3      4    5     6         7 8      9    10   11   12 13 14       15
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6056
      -brand-family-face-style-moreStyle- -height-size-resX-resY-??-??-registry-encoding; 
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6057
     evaluate aBlock with these"
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6058
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6059
    |family face style moreStyle fheight size
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6060
     resX resY registry encoding coding fields|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6061
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6062
    aFontNameString isNil ifTrue:[^ nil].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6063
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6064
    Error handle:[:ex |
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6065
        family := nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6066
    ] do:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6067
        fields := aFontNameString asCollectionOfSubstringsSeparatedBy:$-.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6068
        fields size == 3 ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6069
            "take care of old font names: family-style-size"
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6070
            family := fields at:1.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6071
            style := fields at:2.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6072
            size := Number readFromString:(fields at:3).
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6073
        ] ifFalse:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6074
            fields size == 2 ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6075
                "take care of old font names: family-size"
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6076
                family := fields at:1.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6077
                size := Number readFromString:(fields at:2).
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6078
            ] ifFalse:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6079
                fields size >= 15 ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6080
                    family := fields at:3.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6081
                    face := fields at:4.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6082
                    style := fields at:5.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6083
                    style = 'o' ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6084
                        style := 'oblique'
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6085
                    ] ifFalse:[style = 'i' ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6086
                         style := 'italic'
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6087
                    ] ifFalse:[style = 'r' ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6088
                         style := 'roman'
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6089
                    ]]].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6090
                    moreStyle := fields at:6.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6091
                    (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6092
                        style := style, '-', moreStyle.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6093
                    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6094
                    fheight := fields at:8.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6095
                    size := (Number readFromString:(fields at:9)) / 10.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6096
                    resX := fields at:10.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6097
                    resY := fields at:11.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6098
                    registry := fields at:14.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6099
                    encoding := fields at:15.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6100
                    coding := registry , '-' , encoding.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6101
                ] ifFalse:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6102
                    "/ very old name (such as cursor, 5x7 etc)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6103
                ]
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6104
            ]
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6105
        ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6106
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6107
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6108
    family notNil ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6109
       ^ FontDescription family:family face:face style:style size:size encoding:coding.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6110
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6111
    ^ FontDescription name:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6112
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6113
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6114
     Screen current fontDescriptionFromXFontName:'-arabic-newspaper-medium-r-normal--32-246-100-100-p-137-iso10646-1'
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6115
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6116
!
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6117
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6118
fontMetricsOf:fontId 
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6119
    "return a fonts metrics info object"
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6120
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6121
    <context: #return>
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6122
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6123
    |info avgAscent avgDescent minCode maxCode dir
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6124
     maxAscent maxDescent minWidth maxWidth avgWidth|
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6125
994
7e720b29c838 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  6126
%{
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6127
    XFontStruct *f;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6128
    int len;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6129
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6130
    if (ISCONNECTED) {
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6131
        if (__isExternalAddress(fontId)) {
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6132
            f = __FontVal(fontId);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6133
            if (f) {
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6134
                minCode = __MKUINT((f->min_byte1<<8) + f->min_char_or_byte2);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6135
                maxCode = __MKUINT((f->max_byte1<<8) + f->max_char_or_byte2);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6136
                
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6137
                if (f->direction == FontLeftToRight) {
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6138
                    dir = @symbol(LeftToRight);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6139
                } else if (f->direction == FontRightToLeft) { 
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6140
                    dir = @symbol(RightToLeft);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6141
                }
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6142
                avgDescent = __MKSMALLINT(f->descent);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6143
                avgAscent = __MKSMALLINT(f->ascent);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6144
                avgDescent = __MKSMALLINT(f->descent);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6145
                maxAscent = __MKSMALLINT(f->max_bounds.ascent);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6146
                maxDescent = __MKSMALLINT(f->max_bounds.descent);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6147
                minWidth = __MKSMALLINT(f->min_bounds.width);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6148
                maxWidth = __MKSMALLINT(f->max_bounds.width);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6149
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6150
                ENTER_XLIB();
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6151
                len = XTextWidth(f, " ", 1);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6152
                LEAVE_XLIB();
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6153
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6154
                avgWidth = __MKSMALLINT( len );
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6155
            }
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6156
        }
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6157
    }
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6158
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6159
    avgAscent == nil ifTrue:[
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6160
        self primitiveFailedOrClosedConnection.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6161
        ^ nil
3670
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6162
    ].
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6163
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6164
    "DingBats font returns 0 for maxAscent/maxDescent"
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6165
    maxAscent := maxAscent max:avgAscent.
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6166
    maxDescent := maxDescent max:avgDescent.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6167
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6168
    info := DeviceWorkstation::DeviceFontMetrics new.
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6169
    info
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6170
      ascent:avgAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6171
      descent:avgDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6172
      maxAscent:maxAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6173
      maxDescent:maxDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6174
      minWidth:minWidth
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6175
      maxWidth:maxWidth
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6176
      avgWidth:avgWidth
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6177
      minCode:minCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6178
      maxCode:maxCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6179
      direction:dir.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6180
    ^ info
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6181
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6182
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6183
     Screen current fontMetricsOf:(View defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6184
     CharacterSetView openOn:(View defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6185
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6186
     Screen current fontMetricsOf:(MenuView defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6187
     CharacterSetView openOn:(MenuView defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6188
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6189
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6190
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6191
fontProperties:propertyNames of:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6192
    "Answer an array with selected property values of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6193
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6194
     PropertyNames is an array with property names (symbols or strings).
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6195
     Nonexistant properties are returned as nil"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6196
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6197
    |props|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6198
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6199
    props := self fontPropertiesOf:aFontId.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6200
    ^ propertyNames collect:[:propName | props at:propName ifAbsent:nil].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6201
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6202
    "
4012
956fc93c6381 fontName
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  6203
     Screen current 
956fc93c6381 fontName
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  6204
        fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' #'RESOLUTION' notExistant) 
956fc93c6381 fontName
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  6205
        of:Screen current getDefaultFont
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6206
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6207
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6208
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6209
fontPropertiesOf:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6210
    "Answer an array with all the properties of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6211
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6212
     Odd indices contain the property name (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6213
     Even indices contain the property value (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6214
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6215
     Answer nil, if there are no properties"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6216
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6217
    |propsArray result|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6218
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6219
%{ 
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6220
    XFontStruct *f;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6221
    XFontProp *prop;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6222
    int n, i;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6223
    OBJ x;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6224
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6225
    if (__isExternalAddress(aFontId)) {
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6226
        f = __FontVal(aFontId);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6227
        if (f && (prop = f->properties) != 0) {
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6228
            n = f->n_properties;
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6229
            propsArray = __ARRAY_NEW_INT(n*2);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6230
            for (i = 0; n; n--, prop++) {
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6231
                __ArrayInstPtr(propsArray)->a_element[i++] = x = __MKUINT(prop->name); __STORE(propsArray, x);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6232
                __ArrayInstPtr(propsArray)->a_element[i++] = x = __MKUINT(prop->card32); __STORE(propsArray, x);
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6233
            }
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6234
        }
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6235
    }
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6236
%}.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6237
    result := Dictionary new.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6238
    propsArray notNil ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6239
        propsArray pairWiseDo:[:n :v | result at:(self atomName:n) put:v].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6240
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6241
    ^ result
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6242
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6243
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6244
     Screen current fontPropertiesOf:Screen current getDefaultFont
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6245
     Dictionary withKeysAndValues:(Screen current fontPropertiesOf:Screen current getDefaultFont)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6246
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6247
     |d|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6248
     d := Dictionary new.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6249
     (Screen current fontPropertiesOf:Screen current getDefaultFont) pairWiseDo:[:name :value|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6250
          d at:((Screen current atomName:name) ? name) put:value
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6251
     ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6252
     d 
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6253
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6254
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6255
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6256
fontResolutionOf:fontId
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6257
    "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
  6258
     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
  6259
     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
  6260
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6261
    |props res resX resY|
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6262
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6263
    props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6264
    resX := props at:1.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6265
    resY := props at:2.
1046
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  6266
    (resX notNil and:[resY notNil]) ifTrue:[
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6267
        ^ resX @ resY
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6268
    ].
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6269
    res := props at:3.
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6270
    res notNil ifTrue:[
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6271
        ^ res @ res
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6272
    ].
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6273
    ^ self resolution
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6274
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6275
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6276
      Screen current fontResolutionOf:(Screen current getDefaultFont)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6277
    "
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6278
!
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6279
3417
88c4df032e94 Fix possible botch in #rootWindowId.
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  6280
fullFontNameOf:aFontId
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6281
    "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
  6282
     used for user feed-back (for example: in the fontPanel).
3417
88c4df032e94 Fix possible botch in #rootWindowId.
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  6283
     If the display/font does not provide that info, return nil."
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6284
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6285
    |props fullName|
4012
956fc93c6381 fontName
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  6286
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6287
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6288
    #('FONT' 'FONT_NAME' 'FULL_NAME' 'FULLNAME' ) do:[:try |
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6289
        |fullNameID|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6290
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6291
        fullNameID := props at:try ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6292
        fullNameID notNil ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6293
            fullName := self atomName:fullNameID.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6294
            fullName notEmptyOrNil ifTrue:[
4016
45d6f3f8e035 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4012
diff changeset
  6295
                ^ fullName
45d6f3f8e035 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4012
diff changeset
  6296
            ].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6297
        ]
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6298
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6299
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6300
    ^ nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6301
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6302
    "
4012
956fc93c6381 fontName
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  6303
     Screen current fullFontNameOf:(Screen current getDefaultFont) 
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6304
    "
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6305
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6306
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6307
getAvailableFontsMatching:pattern
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6308
    "return an Array filled with font names matching aPattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6309
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6310
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6311
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6312
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6313
3801
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6314
    int nnames = 15000;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6315
    int available = nnames + 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6316
    char **fonts;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6317
    OBJ arr, str;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6318
    int i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6319
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6320
    if (ISCONNECTED) {
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6321
	if (__isString(pattern)) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6322
	    for (;;) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6323
		ENTER_XLIB();
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6324
		fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6325
		LEAVE_XLIB();
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6326
		if (fonts == 0) RETURN(nil);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6327
		if (available < nnames) break;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6328
		XFreeFontNames(fonts);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6329
		nnames = available * 2;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6330
	    }
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6331
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6332
	    /*
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6333
	     * now, that we know the number of font names,
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6334
	     * create the array ...
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6335
	     */
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6336
	    arr = __ARRAY_NEW_INT(available);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6337
	    if (arr != nil) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6338
		/*
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6339
		 * ... and fill it
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6340
		 */
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6341
		for (i=0; i<available; i++) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6342
		    __PROTECT__(arr);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6343
		    str = __MKSTRING(fonts[i]);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6344
		    __UNPROTECT__(arr);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6345
		    __ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6346
		}
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6347
	    }
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6348
	    XFreeFontNames(fonts);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6349
	    RETURN (arr);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6350
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6351
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6352
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6353
    ^ nil
3801
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6354
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6355
    "
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6356
      Screen current getAvailableFontsMatching:'*'
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6357
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6358
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6359
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6360
getDefaultFont
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6361
    "return a default font id - used when class Font cannot
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6362
     find anything usable"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6363
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6364
     ^ self createFontFor:'fixed'
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6365
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6366
     "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6367
       Screen current getDefaultFont
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6368
     "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6369
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6370
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6371
getFontWithFamily:familyString face:faceString
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6372
            style:styleArgString size:sizeArg encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6373
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6374
    "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
  6375
     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
  6376
     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
  6377
     can be aquired that way."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6378
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6379
    |styleString theName theId xlatedStyle 
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6380
     id spacing encodingMatch idx roundedSize|
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6381
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6382
    styleString := styleArgString.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6383
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6384
    sizeArg notNil ifTrue:[
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6385
        roundedSize := sizeArg rounded asInteger.
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6386
    ].
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6387
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6388
    "special: if face is nil, allow access to X-fonts"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6389
    faceString isNil ifTrue:[
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6390
        roundedSize notNil ifTrue:[
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6391
            theName := familyString , '-' , roundedSize printString
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6392
        ] ifFalse:[
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6393
            theName := familyString
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6394
        ].
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6395
        theName isNil ifTrue:[
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6396
            "
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6397
             mhmh - fall back to the default font
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6398
            "
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6399
            theName := 'fixed'
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6400
        ].
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6401
        theId := self createFontFor:theName.
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6402
        theId isNil ifTrue:[
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6403
            theId := self getDefaultFont
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6404
        ].
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6405
        ^ theId
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6406
    ].
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6407
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6408
    "/ 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
  6409
    "/ in style
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6410
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  6411
    (styleString notNil
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  6412
     and:[(styleString endsWith:'-narrow') 
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6413
          or:[styleString endsWith:'-semicondensed']]) ifTrue:[
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6414
        |i|
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6415
        i := styleString lastIndexOf:$-.
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6416
        spacing := styleString copyFrom:(i+1).
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6417
        styleString := styleString copyTo:(i-1).
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6418
    ] ifFalse:[
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6419
        spacing := 'normal'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6420
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6421
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6422
    xlatedStyle := styleString.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6423
    xlatedStyle notNil ifTrue:[
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6424
        xlatedStyle := xlatedStyle first asString
3449
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  6425
    ].
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  6426
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6427
    encoding isNil ifTrue:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6428
        encodingMatch := '*-*'.
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6429
    ] ifFalse:[
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6430
        idx := encoding indexOf:$-.
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6431
        idx ~~ 0 ifTrue:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6432
            encodingMatch := encoding
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6433
        ] ifFalse:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6434
            encodingMatch := encoding , '-*'.
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6435
        ].
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6436
    ].
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6437
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6438
    id := self 
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6439
            getFontWithFoundry:'*'
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6440
            family:familyString asLowercase
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6441
            weight:faceString
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6442
            slant:xlatedStyle
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6443
            spacing:spacing
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6444
            pixelSize:nil
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6445
            size:roundedSize 
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6446
            encoding:encodingMatch.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6447
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6448
    id isNil ifTrue:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6449
        (encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6450
            "/ too stupid: registries come in both cases
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6451
            "/ and X does not ignore case
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6452
            "/
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6453
            id := self 
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6454
                    getFontWithFoundry:'*'
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6455
                    family:familyString asLowercase
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6456
                    weight:faceString
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6457
                    slant:xlatedStyle
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6458
                    spacing:spacing
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6459
                    pixelSize:nil
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6460
                    size:roundedSize 
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6461
                    encoding:encodingMatch asUppercase.
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6462
            id isNil ifTrue:[
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6463
                id := self 
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6464
                        getFontWithFoundry:'*'
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6465
                        family:familyString asLowercase
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6466
                        weight:faceString
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6467
                        slant:xlatedStyle
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6468
                        spacing:spacing
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6469
                        pixelSize:nil
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6470
                        size:roundedSize 
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6471
                        encoding:encodingMatch asLowercase.
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6472
            ]
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6473
        ]
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6474
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6475
    ^ id
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6476
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6477
    "Modified: 4.7.1996 / 11:38:47 / stefan"
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6478
    "Modified: 10.4.1997 / 19:20:06 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6479
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6480
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6481
getFontWithFoundry:foundry family:family weight:weight
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6482
              slant:slant spacing:spc pixelSize:pSize size:size 
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6483
              encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6484
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6485
    "get the specified font, if not available, return nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6486
     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
  6487
     use this entry.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6488
     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
  6489
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6490
     foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6491
     family:  'helvetica' 'courier' 'times' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6492
     weight:  'bold' 'medium' 'demi' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6493
     slant:   'r(oman)' 'i(talic)' 'o(blique)'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6494
     spacing: 'narrow' 'normal' semicondensed' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6495
     pixelSize: 16,18 ... usually left empty
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6496
     size:      size in point (1/72th of an inch)
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6497
     encoding:  iso8859-*, iso8859-1, iso10646-1 ... '*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6498
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6499
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6500
    |theName sizeMatch 
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6501
     foundryMatch familyMatch weightMatch slantMatch spcMatch
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6502
     pSizeMatch encodingMatch|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6503
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6504
    "this works only on 'Release >= 3' - X-servers"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6505
    "name is:
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6506
        -foundry-family    -weight -slant-
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6507
         sony    helvetica bold     r
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6508
         adobe   courier   medium   i
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6509
         msic    fixed              o
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6510
         ...     ...
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6511
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6512
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6513
    size isNil ifTrue:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6514
        sizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6515
    ] ifFalse:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6516
        sizeMatch := size printString , '0'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6517
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6518
    foundry isNil ifTrue:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6519
        foundryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6520
    ] ifFalse:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6521
        foundryMatch := foundry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6522
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6523
    family isNil ifTrue:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6524
        familyMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6525
    ] ifFalse:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6526
        familyMatch := family
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6527
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6528
    weight isNil ifTrue:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6529
        weightMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6530
    ] ifFalse:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6531
        weightMatch := weight
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6532
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6533
    slant isNil ifTrue:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6534
        slantMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6535
    ] ifFalse:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6536
        slantMatch := slant
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6537
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6538
    spc isNil ifTrue:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6539
        spcMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6540
    ] ifFalse:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6541
        spcMatch := spc
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6542
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6543
    pSize isNil ifTrue:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6544
        pSizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6545
    ] ifFalse:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6546
        pSizeMatch := pSize printString
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6547
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6548
    encoding isNil ifTrue:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6549
        encodingMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6550
    ] ifFalse:[
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6551
        encodingMatch := encoding
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6552
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6553
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6554
    theName := ('-' , foundryMatch,
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6555
                '-' , familyMatch,
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6556
                '-' , weightMatch ,
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6557
                '-' , slantMatch , 
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6558
                '-' , spcMatch ,
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6559
                '-*' ,
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6560
                '-' , pSizeMatch ,
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6561
                '-' , sizeMatch ,
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6562
                '-*-*-*-*' ,
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6563
                '-' , encodingMatch).
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6564
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 652
diff changeset
  6565
"/  Transcript showCR:theName; endEntry.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6566
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6567
    ^ self createFontFor:theName.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6568
        
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6569
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6570
    "
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6571
     Display 
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6572
        getFontWithFoundry:'*'
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6573
        family:'courier'
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6574
        weight:'medium'
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6575
        slant:'r'
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6576
        spacing:nil
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6577
        pixelSize:nil
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6578
        size:13
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6579
        encoding:'iso8859-*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6580
    "
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6581
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6582
    "Modified: 10.4.1997 / 19:15:44 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6583
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6584
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6585
listOfAvailableFonts
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6586
    "return a list with all available fonts on this display.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6587
     Since this takes some time, keep the result of the query for the
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6588
     next time. The elements of the returned collection are instances of
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6589
     FontDescription."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6590
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6591
    |names|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6592
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6593
    listOfXFonts isNil ifTrue:[
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6594
        names := self getAvailableFontsMatching:'*'.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6595
        names isNil ifTrue:[
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6596
            "no names returned ..."
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6597
            ^ nil
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6598
        ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6599
        listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6600
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6601
    ^ listOfXFonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6602
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6603
    "
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6604
     Display flushListOfAvailableFonts.
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  6605
     Display listOfAvailableFonts.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  6606
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6607
     Display getAvailableFontsMatching:'*'.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6608
     Display getAvailableFontsMatching:'fixed'.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6609
     Display fontsInFamily:'fixed' filtering:nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6610
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6611
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6612
    "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
  6613
    "Modified: 17.4.1996 / 15:27:57 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6614
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6615
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6616
releaseFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6617
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6618
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6619
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6620
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6621
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6622
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6623
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6624
	RETURN ( self );
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6625
    }
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6626
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6627
    if (__isExternalAddress(aFontId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6628
	f = __FontVal(aFontId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6629
	if (f) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6630
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6631
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6632
	    XFreeFont(myDpy, f);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6633
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  6634
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6635
	    __cnt_font--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  6636
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6637
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6638
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6639
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6640
    }
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6641
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6642
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6643
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6644
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6645
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6646
    "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
  6647
     on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6648
     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
  6649
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6650
    |sizes|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6651
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  6652
    sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6653
    (sizes notNil and:[sizes includes:0]) ifTrue:[
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  6654
	"special: in X11R5 and above, size 0 means:
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  6655
	 there are scaled versions in all sizes available"
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  6656
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  6657
	^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6658
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6659
    ^ sizes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6660
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6661
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6662
     Display sizesInFamily:'courier' face:'bold' style:'roman'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6663
    "
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  6664
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  6665
    "Created: 27.2.1996 / 01:38:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6666
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6667
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6668
widthOf:aString from:index1 to:index2 inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6669
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6670
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6671
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6672
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6673
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6674
    char *cp;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6675
    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
  6676
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6677
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6678
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  6679
    int nInstBytes;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6680
    int directionReturn, fontAscentReturn, fontDescentReturn;
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6681
    XCharStruct overAllReturn;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6682
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6683
    if (ISCONNECTED) {
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6684
	if (__bothSmallInteger(index1, index2)
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6685
	 && __isExternalAddress(aFontId)
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6686
	 && __isNonNilObject(aString)) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6687
	    int lMax = __intVal(@global(MaxStringLength));
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6688
	    f = __FontVal(aFontId);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6689
	    if (! f) goto fail;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6690
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6691
	    i1 = __intVal(index1) - 1;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6692
	    cls = __qClass(aString);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6694
	    if (i1 >= 0) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6695
		i2 = __intVal(index2) - 1;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6696
		if (i2 < i1) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6697
		    RETURN ( __MKSMALLINT(0) );
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6698
		}
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6699
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6700
		cp = (char *) __stringVal(aString);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6701
		l = i2 - i1 + 1;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6702
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6703
		if ((cls == @global(String)) || (cls == @global(Symbol))) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6704
		    n = __stringSize(aString);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6705
		    if (i2 < n) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6706
			cp += i1;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6707
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6708
#if 0
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6709
			ENTER_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6710
			len = XQueryTextExtents(myDpy, f->fid, cp, l, 
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6711
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6712
						&overAllReturn);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6713
			LEAVE_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6714
			printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6715
#endif
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6716
			ENTER_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6717
			len = XTextWidth(f, cp, l);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6718
			LEAVE_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6719
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6720
			RETURN ( __MKSMALLINT(len) );
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6721
		    }
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6722
		}
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6723
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6724
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6725
		cp += nInstBytes;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6726
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6727
		if (__isBytes(aString)) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6728
		    n = __byteArraySize(aString) - nInstBytes;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6729
		    if (i2 < n) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6730
			cp += i1;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6731
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6732
			ENTER_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6733
			len = XTextWidth(f, cp, l);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6734
			LEAVE_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6735
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6736
			RETURN ( __MKSMALLINT(len) );
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6737
		    }
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6738
		}
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6739
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6740
		/* TWOBYTESTRINGS */
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6741
		if (__isWords(aString)) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6742
		    n = (__byteArraySize(aString) - nInstBytes) / 2;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6743
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6744
		    if (i2 < n) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6745
			union {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6746
			    char b[2];
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6747
			    unsigned short s;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6748
			} u;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6749
			int i;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6750
			XChar2b *cp2 = (XChar2b *)0;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6751
			int mustFree = 0;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6752
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6753
			cp += (i1 * 2);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6754
			if (l > lMax) l = lMax;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6755
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6756
			/*
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6757
			 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6758
			 * X expects them MSB first
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6759
			 * convert as required
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6760
			 */
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6761
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6762
			u.s = 0x1234;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6763
			if (u.b[0] != 0x12) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6764
			    if (l <= NLOCALBUFFER) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6765
				cp2 = xlatebuffer;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6766
			    } else {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6767
				cp2 = (XChar2b *)(malloc(l * 2));
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6768
				mustFree = 1;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6769
			    }
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6770
			    for (i=0; i<l; i++) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6771
				cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6772
				cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6773
			    }
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6774
			    cp = (char *) cp2;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6775
			}
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6776
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6777
			ENTER_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6778
			len = XTextWidth16(f, (XChar2b *)cp, l);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6779
			LEAVE_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6780
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6781
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6782
			if (mustFree) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6783
			    free(cp2);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6784
			}
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6785
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6786
			RETURN ( __MKSMALLINT(len) );
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6787
		    }
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6788
		}
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6789
	    }
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6790
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6791
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6792
#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
  6793
fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6794
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6795
    self primitiveFailedOrClosedConnection.
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  6796
    ^ 0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6797
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6798
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6799
widthOf:aString inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6800
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6801
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6802
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6803
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6804
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6805
    char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6806
    int len, n;
447
9a58924e921b dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6807
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6808
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6809
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  6810
    int nInstBytes;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6811
    int directionReturn, fontAscentReturn, fontDescentReturn;
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6812
    XCharStruct overAllReturn;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6813
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6814
    if (ISCONNECTED) {
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6815
	if (__isExternalAddress(aFontId)
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6816
	 && __isNonNilObject(aString)) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6817
	    int lMax = __intVal(@global(MaxStringLength));
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6818
	    f = __FontVal(aFontId);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6819
	    if (! f) goto fail;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6820
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6821
	    cls = __qClass(aString);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6822
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6823
	    cp = (char *) __stringVal(aString);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6824
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6825
	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6826
		n = __stringSize(aString);
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6827
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  6828
#if 0
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6829
		ENTER_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6830
		len = XQueryTextExtents(myDpy, f->fid, cp, n, 
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6831
					&directionReturn, &fontAscentReturn, &fontDescentReturn,
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6832
					&overAllReturn);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6833
		LEAVE_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6834
		printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6835
#endif
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6836
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6837
		ENTER_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6838
		len = XTextWidth(f, cp, n);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6839
		LEAVE_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6840
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6841
		RETURN ( __MKSMALLINT(len) );
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6842
	    }
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6843
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6844
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6845
	    cp += nInstBytes;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6846
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6847
	    if (__isBytes(aString)) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6848
		n = __byteArraySize(aString) - nInstBytes;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6849
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6850
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6851
		ENTER_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6852
		len = XTextWidth(f, cp, n);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6853
		LEAVE_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6854
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6855
		RETURN ( __MKSMALLINT(len) );
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6856
	    }
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6857
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6858
	    /* TWOBYTESTRINGS */
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6859
	    if (__isWords(aString)) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6860
		union {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6861
		    char b[2];
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6862
		    unsigned short s;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6863
		} u;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6864
		int i;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6865
		XChar2b *cp2;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6866
		int mustFree = 0;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6867
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6868
		n = (__byteArraySize(aString) - nInstBytes) / 2;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6869
		if (n > lMax) n = lMax;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6870
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6871
		/*
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6872
		 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6873
		 * X expects them MSB first
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6874
		 * convert as required
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6875
		 */
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6876
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6877
		u.s = 0x1234;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6878
		if (u.b[0] != 0x12) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6879
		    if (n <= NLOCALBUFFER) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6880
			cp2 = xlatebuffer;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6881
		    } else {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6882
			cp2 = (XChar2b *)(malloc(n * 2));
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6883
			mustFree = 1;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6884
		    }
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6885
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6886
		    for (i=0; i<n; i++) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6887
			cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6888
			cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6889
		    }
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6890
		    cp = (char *) cp2;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6891
		}
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6892
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6893
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6894
		ENTER_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6895
		len = XTextWidth16(f, (XChar2b *)cp, n);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6896
		LEAVE_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6897
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6898
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6899
		if (mustFree) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6900
		    free(cp2);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6901
		}
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6902
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6903
		RETURN ( __MKSMALLINT(len) );
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6904
	    }
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  6905
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6906
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6907
#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
  6908
  fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6909
%}.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  6910
    ^ super widthOf:aString inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6911
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6912
3177
8aa3c800394a category rename
Claus Gittinger <cg@exept.de>
parents: 3146
diff changeset
  6913
!XWorkstation methodsFor:'grabbing'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6914
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6915
allowEvents:mode
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6916
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6917
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6918
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6919
    int _mode, ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6920
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6921
    if (mode == @symbol(asyncPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6922
	_mode = AsyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6923
    else if (mode == @symbol(syncPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6924
	_mode = SyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6925
    else if (mode == @symbol(asyncKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6926
	_mode = AsyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6927
    else if (mode == @symbol(syncKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6928
	_mode = SyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6929
    else if (mode == @symbol(syncBoth))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6930
	_mode = SyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6931
    else if (mode == @symbol(asyncBoth))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6932
	_mode = AsyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6933
    else if (mode == @symbol(replayPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6934
	_mode = ReplayPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6935
    else if (mode == @symbol(replayKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6936
	_mode = ReplayKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6937
    else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6938
	ok = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6939
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6940
    if (ok
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6941
     && ISCONNECTED) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6942
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6943
	XAllowEvents(myDpy, _mode, CurrentTime);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6944
	LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6945
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6946
	RETURN (self);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6947
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6948
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6949
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6950
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6951
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6952
grabKeyboardIn:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6953
    "grab the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6954
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6955
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6956
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6957
    int result, ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6958
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  6959
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6960
	if (__isExternalAddress(aWindowId)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6961
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6962
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6963
	    result = XGrabKeyboard(myDpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6964
				   __WindowVal(aWindowId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6965
				   True /* False */,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6966
				   GrabModeAsync,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6967
				   GrabModeAsync,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6968
				   CurrentTime);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6969
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6970
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6971
	    ok = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6972
	    switch(result) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6973
		case AlreadyGrabbed: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6974
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6975
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6976
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6977
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6978
		case GrabNotViewable: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6979
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6980
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6981
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6982
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6983
		case GrabInvalidTime: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6984
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6985
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6986
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6987
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6988
		case GrabFrozen: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6989
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6990
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6991
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6992
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6993
		default:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6994
		    ok = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6995
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6996
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6997
	    if (! ok) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6998
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6999
		XUngrabKeyboard(myDpy, CurrentTime);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7000
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7001
		RETURN (false);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7002
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7003
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7004
	    RETURN ( true );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7005
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7006
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  7007
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7008
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7009
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7010
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7011
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7012
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
  7013
    "grap the pointer - return true if ok"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7014
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7015
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7016
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7017
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7018
    int result, ok, evMask;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7019
    Window confineWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7020
    Cursor curs;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7021
    int pointer_mode, keyboard_mode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7022
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7023
    if (ISCONNECTED) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7024
	if (__isExternalAddress(aWindowId)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7025
	    if (__isExternalAddress(confineId)) 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7026
		confineWin = __WindowVal(confineId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7027
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7028
		confineWin = (Window) None;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7029
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7030
	    if (__isExternalAddress(aCursorId)) 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7031
		curs = __CursorVal(aCursorId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7032
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7033
		curs = (Cursor) None;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7034
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7035
	    if (pMode == @symbol(sync))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7036
		pointer_mode = GrabModeSync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7037
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7038
		pointer_mode = GrabModeAsync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7039
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7040
	    if (kMode == @symbol(sync))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7041
		keyboard_mode = GrabModeSync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7042
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7043
		keyboard_mode = GrabModeAsync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7044
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7045
	    if (__isSmallInteger(eventMask))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7046
		evMask = __intVal(eventMask);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7047
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7048
		evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7049
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7050
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7051
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7052
	    ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7053
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7054
	    result = XGrabPointer(myDpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7055
				  __WindowVal(aWindowId), 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7056
				  False, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7057
				  evMask,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7058
				  pointer_mode, keyboard_mode,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7059
				  confineWin,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7060
				  curs,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7061
				  CurrentTime);
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7062
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7063
	    LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7064
*/
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7065
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7066
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7067
	    ok = 0;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7068
	    switch (result) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7069
		case AlreadyGrabbed: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7070
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7071
			fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7072
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7073
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7074
		case GrabNotViewable: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7075
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7076
			fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7077
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7078
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7079
		case GrabInvalidTime: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7080
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7081
			fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7082
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7083
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7084
		case GrabFrozen: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7085
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7086
			fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7087
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7088
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7089
		default:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7090
		    ok = 1;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7091
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7092
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7093
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7094
	    if (! ok) {
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7095
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7096
		ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7097
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7098
		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
  7099
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7100
		LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7101
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7102
		RETURN (false);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7103
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7104
	    RETURN ( true );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7105
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7106
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  7107
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7108
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7109
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7110
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7111
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7112
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
  7113
    "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
  7114
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7115
    ^ self
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7116
	grabPointerIn:aWindowId 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7117
	withCursor:aCursorId 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7118
	eventMask:nil
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7119
	pointerMode:pMode 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7120
	keyboardMode:kMode 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7121
	confineTo:confineId
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7122
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7123
    "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
  7124
!
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7125
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7126
primUngrabKeyboard
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7127
    "release the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7128
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7129
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7130
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7131
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7132
    if (ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7133
	Display *dpy = myDpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7134
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7135
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7136
	XUngrabKeyboard(dpy, CurrentTime);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7137
	XSync(dpy, 0);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7138
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7139
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7140
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7141
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7142
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7143
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7144
primUngrabPointer
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7145
    "release the pointer"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7146
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7147
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7148
%{
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7149
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7150
    if (ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7151
	Display *dpy = myDpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7152
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7153
	ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7154
	XUngrabPointer(dpy, CurrentTime);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7155
	XSync(dpy, 0);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7156
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7157
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7158
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7159
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7160
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7161
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7162
ungrabKeyboard
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7163
    "release the keyboard"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7164
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  7165
    activeKeyboardGrab notNil ifTrue:[
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  7166
	activeKeyboardGrab := nil.
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  7167
	self primUngrabKeyboard.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  7168
    ]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7169
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7170
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7171
ungrabPointer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7172
    "release the pointer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7173
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  7174
    activePointerGrab notNil ifTrue:[
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  7175
	activePointerGrab := nil.
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  7176
	self primUngrabPointer.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  7177
    ]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7178
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7179
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7180
!XWorkstation methodsFor:'graphic context stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7181
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  7182
noClipIn:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7183
    "disable clipping rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7184
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7185
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7186
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7187
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7188
    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
  7189
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7190
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7191
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7192
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7193
	    gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7194
	    gcv.clip_mask = None;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7195
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7196
	    XChangeGC(myDpy, gc, GCClipMask, &gcv);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7197
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7198
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7199
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7200
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7201
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7202
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7203
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7204
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7205
setBackground:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7206
    "set background color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7207
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7208
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7209
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7210
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7211
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7212
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7213
	 && __isSmallInteger(bgColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7214
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7215
	    XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7216
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7217
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7218
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7219
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7220
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7221
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7222
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7223
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7224
setBitmapMask:aBitmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7225
    "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
  7226
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7227
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7228
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7229
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7230
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7231
    Pixmap bitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7232
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7233
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7234
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7235
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7236
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7237
	    gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7238
	    if (__isExternalAddress(aBitmapId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7239
		bitmap = __PixmapVal(aBitmapId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7240
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7241
		XSetStipple(dpy, gc, bitmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7242
		XSetFillStyle(dpy, gc, FillOpaqueStippled);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7243
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7244
		RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7245
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7246
	    if (aBitmapId == nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7247
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7248
		XSetFillStyle(dpy, gc, FillSolid);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7249
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7250
		RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7251
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7252
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7253
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7254
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7255
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7256
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7257
1681
069ede63fb19 pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1627
diff changeset
  7258
setClipByChildren:aBool in:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7259
    "enable/disable drawing into child views"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7260
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7261
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7262
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7263
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7264
    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
  7265
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7266
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7267
    if (ISCONNECTED) {
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7268
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7269
	    gc = __GCVal(aGCId);
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7270
	    if (aBool == true)
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7271
		gcv.subwindow_mode = ClipByChildren;
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7272
	    else
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7273
		gcv.subwindow_mode = IncludeInferiors;
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7274
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7275
	    ENTER_XLIB();
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7276
	    XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7277
	    LEAVE_XLIB();
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7278
	    RETURN ( self );
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7279
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7280
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7281
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7282
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7283
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7284
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  7285
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
  7286
    "clip to a rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7287
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7288
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7289
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7290
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7291
    XRectangle r;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7292
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7293
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7294
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7295
	 && __bothSmallInteger(clipX, clipY)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7296
	 && __bothSmallInteger(clipWidth, clipHeight)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7297
	    r.x = __intVal(clipX);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7298
	    r.y = __intVal(clipY);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7299
	    r.width = __intVal(clipWidth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7300
	    r.height = __intVal(clipHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7301
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7302
	    XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7303
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7304
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7305
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7306
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7307
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7308
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7309
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7310
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7311
setDashes:dashList dashOffset:offset in:aGCId
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7312
    "set line attributes"
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7313
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7314
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7315
%{  
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7316
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7317
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7318
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7319
	 && __isSmallInteger(offset)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7320
	 && __isByteArray(dashList)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7321
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7322
	    XSetDashes(myDpy, __GCVal(aGCId), 
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7323
		       __intVal(offset),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7324
		       __ByteArrayInstPtr(dashList)->ba_element,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7325
		       __byteArraySize(dashList));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7326
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7327
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7328
	}
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7329
    }
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7330
bad: ;
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7331
%}.
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7332
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7333
     either aGCId is invalid,
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7334
     and/or dashList is not a byteArray
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7335
     and/or offset is not a smallInteger
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7336
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7337
    self primitiveFailedOrClosedConnection
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7338
!
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7339
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7340
setFont:aFontId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7341
    "set font to be drawn in"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7342
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7343
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7344
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7345
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7346
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7347
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7348
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7349
	if (__isExternalAddress(aFontId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7350
	 && __isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7351
	    f = (XFontStruct *) __FontVal(aFontId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7352
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7353
	    XSetFont(myDpy, __GCVal(aGCId), f->fid);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7354
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7355
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7356
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7357
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7358
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7359
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7360
     aGCId and/or aFontId are invalid
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7361
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7362
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7363
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7364
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7365
setForeground:fgColorIndex background:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7366
    "set foreground and background colors to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7367
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7368
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7369
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7370
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7371
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7372
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7373
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7374
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7375
	if (__bothSmallInteger(fgColorIndex, bgColorIndex)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7376
	 && __isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7377
	    gc = __GCVal(aGCId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7378
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7379
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7380
	    XSetForeground(dpy, gc, __intVal(fgColorIndex));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7381
	    XSetBackground(dpy, gc, __intVal(bgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7382
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7383
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7384
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7385
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7386
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7387
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7388
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7389
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7390
setForeground:fgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7391
    "set foreground color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7392
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7393
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7394
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7395
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7396
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7397
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7398
	 && __isSmallInteger(fgColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7399
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7400
	    XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7401
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7402
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7403
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7404
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7405
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7406
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7407
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7408
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7409
setFunction:aFunctionSymbol in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7410
    "set alu function to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7411
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7412
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7413
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7414
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7415
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7416
    int fun = -1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7417
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7418
    if (ISCONNECTED) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7419
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7420
	    gc = __GCVal(aGCId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7421
	    if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7422
	    else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7423
	    else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7424
	    else if (aFunctionSymbol == @symbol(and)) fun = GXand;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7425
	    else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7426
	    else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7427
	    else if (aFunctionSymbol == @symbol(or)) fun = GXor;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7428
	    else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7429
	    else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7430
	    else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7431
	    else if (aFunctionSymbol == @symbol(clear)) fun = GXclear;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7432
	    else if (aFunctionSymbol == @symbol(set)) fun = GXset;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7433
	    else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7434
	    else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7435
	    else if (aFunctionSymbol == @symbol(nand)) fun = GXnand;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7436
	    if (fun != -1) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7437
		ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7438
		XSetFunction(myDpy, gc, fun);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7439
		LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7440
		RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7441
	    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7442
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7443
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7444
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7445
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7446
     either aGCId is not an integer, or an invalid symbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7447
     was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7448
     #andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7449
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7450
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7451
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7452
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7453
setGraphicsExposures:aBoolean in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7454
    "set or clear the graphics exposures flag"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7455
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7456
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7457
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7458
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7459
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7460
	if (__isExternalAddress(aGCId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7461
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7462
	    XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7463
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7464
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7465
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7466
    }
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7467
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7468
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7469
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7470
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7471
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7472
    "set line attributes; 
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7473
     lineStyle must be one of #solid, #dashed or #doubleDashed;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7474
     capStyle one of: #notLast, #butt, #round or #projecting;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7475
     joinStyle one of: #miter, #bevel or #round."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7476
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7477
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7478
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7479
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7480
    int x_style, x_cap, x_join;
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7481
    static char dashList[2] = { 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7482
    static char dotList[2]  = { 4,4 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7483
    static char dashDotList[4]    = { 4,1 , 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7484
    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
  7485
    char *x_dashes = 0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7486
    int x_nDash;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7487
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7488
    if (ISCONNECTED) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7489
	if (__isExternalAddress(aGCId)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7490
	 && __isSmallInteger(aNumber)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  7491
	    Display *dpy = myDpy;
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  7492
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7493
	    if (lineStyle == @symbol(solid)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7494
		x_dashes = (char *)0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7495
		x_style = LineSolid;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7496
	    } else if (lineStyle == @symbol(dashed)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7497
		x_dashes = dashList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7498
		x_nDash = sizeof(dashList);
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  7499
		x_style = LineOnOffDash;
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7500
	    } else if (lineStyle == @symbol(doubleDashed)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7501
		x_dashes = dashList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7502
		x_nDash = sizeof(dashList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7503
		x_style = LineDoubleDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7504
	    } else if (lineStyle == @symbol(dotted)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7505
		x_dashes = dotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7506
		x_nDash = sizeof(dotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7507
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7508
	    } else if (lineStyle == @symbol(dashDot)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7509
		x_dashes = dashDotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7510
		x_nDash = sizeof(dashDotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7511
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7512
	    } else if (lineStyle == @symbol(dashDotDot)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7513
		x_dashes = dashDotDotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7514
		x_nDash = sizeof(dashDotDotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7515
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7516
	    } else goto bad;
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7517
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7518
	    if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7519
	    else if (capStyle == @symbol(butt)) x_cap = CapButt;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7520
	    else if (capStyle == @symbol(round)) x_cap  = CapRound;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7521
	    else if (capStyle == @symbol(projecting)) x_cap  = CapProjecting;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7522
	    else goto bad;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7523
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7524
	    if (joinStyle == @symbol(miter)) x_join = JoinMiter;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7525
	    else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7526
	    else if (joinStyle == @symbol(round)) x_join  = JoinRound;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7527
	    else goto bad;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7528
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7529
	    ENTER_XLIB();
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7530
	    if (x_dashes) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7531
		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
  7532
	    }
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  7533
	    XSetLineAttributes(dpy,
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7534
			       __GCVal(aGCId), __intVal(aNumber),
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7535
			       x_style, x_cap, x_join);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7536
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7537
	    RETURN ( self );
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7538
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7539
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7540
bad: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7541
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7542
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7543
     either aGCId is invalid,
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7544
     and/or lineWidth is not a smallInteger,
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7545
     and/or lineStyle is none of #solid, #dashed, #doubleDashed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7546
     and/or capStyle is none of #notLast, #butt, #round, #projecting
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7547
     and/or joinStyle is none of #miter, #bevel, #round
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7548
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7549
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7550
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7551
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7552
setMaskOriginX:orgX y:orgY in:aGCid
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7553
    "set the mask origin"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7554
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7555
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7556
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7557
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7558
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7559
	if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7560
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7561
	    XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7562
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7563
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7564
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7565
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7566
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7567
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7568
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7569
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7570
setPixmapMask:aPixmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7571
    "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
  7572
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7573
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7574
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7575
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7576
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7577
    Pixmap pixmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7578
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7579
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7580
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7581
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7582
	if (__isExternalAddress(aGCId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7583
	    gc = __GCVal(aGCId);
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7584
	    if (__isExternalAddress(aPixmapId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7585
		pixmap = __PixmapVal(aPixmapId);
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7586
		ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7587
		XSetTile(dpy, gc, pixmap);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7588
		XSetFillStyle(dpy, gc, FillTiled);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7589
		LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7590
		RETURN ( self );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7591
	    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7592
	    if (aPixmapId == nil) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7593
		ENTER_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7594
		XSetFillStyle(dpy, gc, FillSolid);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7595
		LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7596
		RETURN ( self );
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7597
	    }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7598
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7599
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7600
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7601
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7602
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7603
3883
4e01a59afccb method category rename
Claus Gittinger <cg@exept.de>
parents: 3856
diff changeset
  7604
!XWorkstation methodsFor:'initialization & release'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7605
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7606
closeConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7607
    "close down the connection to the X-server"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7608
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7609
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7610
3061
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  7611
"/ 'closing' errorPrintCR.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  7612
"/ thisContext fullPrintAll.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  7613
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  7614
%{ /* UNLIMITEDSTACK */   /* calls XSync()! */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7615
    if (ISCONNECTED) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7616
	Display *dpy = myDpy;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7617
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7618
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7619
	__INST(displayId) = nil;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7620
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7621
	XCloseDisplay(dpy);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7622
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7623
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7624
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7625
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7626
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7627
emergencyCloseConnection
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7628
    "low level close of the displays connection (without sending any buffered
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7629
     requests to the display). Only used in case of emergency (brokenConnection)"
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7630
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7631
%{ 
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7632
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7633
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7634
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7635
	__INST(displayId) = nil;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  7636
	close(ConnectionNumber(dpy));
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7637
    }
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7638
%}
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7639
!
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7640
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7641
eventBufferSize
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7642
%{
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7643
    RETURN ( __MKSMALLINT(sizeof(XEvent) + 100) );
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7644
%}
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7645
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7646
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7647
initializeDefaultValues
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  7648
    activateOnClick := false.
2862
2f43bf146110 moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents: 2856
diff changeset
  7649
    super initializeDefaultValues.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7650
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7651
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7652
initializeDeviceSignals
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7653
    super initializeDeviceSignals.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7654
2984
6a278fd02e74 Signal init.
Stefan Vogel <sv@exept.de>
parents: 2977
diff changeset
  7655
    deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignal.
2856
95cb0ea5f7cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2855
diff changeset
  7656
    deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7657
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7658
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7659
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7660
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7661
!
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7662
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7663
initializeFor:aDisplayName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7664
    "initialize the receiver for a connection to an X-Server;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7665
     the argument, aDisplayName may be nil (for the default server from
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7666
     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
  7667
     as hostname:number"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7668
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7669
    displayId notNil ifTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7670
	"/ already connected - you bad guy try to trick me manually ?
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7671
	^ self
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  7672
    ].
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  7673
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  7674
    displayId := self openConnectionTo:aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7675
    displayId isNil ifTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7676
	"/ could not connect.
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7677
	DeviceOpenErrorSignal raiseWith:aDisplayName.
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7678
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7679
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7680
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7681
    dispatching := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7682
    dispatchingExpose := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7683
    isSlow := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7684
    shiftDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7685
    ctrlDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7686
    metaDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7687
    altDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7688
    motionEventCompression := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7689
    buttonsPressed := 0.
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  7690
    displayName := aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7691
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7692
    listOfXFonts := nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7693
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7694
    atoms := nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7695
    protocolsAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7696
    deleteWindowAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7697
    saveYourselfAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7698
    quitAppAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7699
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  7700
    self initializeDeviceResourceTables.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7701
    self initializeScreenProperties.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7702
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7703
    self initializeDefaultValues.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7704
    self initializeSpecialFlags.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7705
    self initializeKeyboardMap.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7706
    self initializeDeviceSignals.
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  7707
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  7708
    self initializeViewStyle.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7709
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7710
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7711
initializeModifierMappings
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7712
    "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
  7713
     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
  7714
     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
  7715
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7716
    |map|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7717
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7718
    super initializeModifierMappings.                                     
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7719
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  7720
    rawKeySymTranslation := RawKeySymTranslation.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  7721
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7722
    map := self modifierMapping.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  7723
    map isNil ifTrue:[
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7724
        "/
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7725
        "/ mhmh - a crippled Xlib which does not provide modifier mappings
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7726
        "/ setup some reasonable default. If that is not sufficient,
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7727
        "/ you have to change things from your display.rc file.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7728
        "/
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7729
        altModifierMask := self modifier1Mask.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7730
        metaModifierMask := self modifier2Mask.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  7731
    ] ifFalse:[
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7732
        | mod stringFromKeyCode nonNilOnes |
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7733
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7734
        altModifierMask := 0.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7735
        metaModifierMask := 0.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7736
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7737
        stringFromKeyCode := [:key | 
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7738
                                    |s| 
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7739
                                    s := self stringFromKeycode:key. 
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7740
                                    s notNil 
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7741
                                        ifTrue:[s asSymbol] 
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7742
                                        ifFalse:[nil]
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7743
                             ].
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7744
        nonNilOnes := [:str | str notNil].
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7745
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7746
        mod := map at:1.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7747
        mod notNil ifTrue:[
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7748
            shiftModifiers := mod collect:stringFromKeyCode thenSelect:nonNilOnes.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7749
        ].
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7750
        mod := map at:3.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7751
        mod notNil ifTrue:[
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7752
            ctrlModifiers  := mod collect:stringFromKeyCode thenSelect:nonNilOnes.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7753
        ].
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7754
        mod := map at:4.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7755
        mod notNil ifTrue:[
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7756
            mod := mod collect:stringFromKeyCode thenSelect:nonNilOnes.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7757
            (mod includes:'Num_Lock') ifFalse:[
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7758
                metaModifiers := mod.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7759
                metaModifierMask := 1 bitShift:(4-1).
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7760
            ].
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7761
        ].
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7762
        mod := map at:5.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7763
        mod notNil ifTrue:[
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7764
            mod := mod collect:stringFromKeyCode thenSelect:nonNilOnes.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7765
            (mod includes:'Num_Lock') ifFalse:[
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7766
                altModifiers   := mod.
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7767
                altModifierMask := 1 bitShift:(5-1).
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7768
            ].
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7769
        ]
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7770
    ].                                                          
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7771
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7772
    "
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  7773
     Display initializeModifierMappings
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7774
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7775
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7776
    "Modified: 1.12.1995 / 23:44:40 / stefan"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7777
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7778
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7779
initializeScreenProperties
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7780
    |masks|
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7781
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  7782
    super initializeScreenProperties.
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  7783
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7784
    hasShapeExtension := self queryShapeExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7785
    hasShmExtension := self querySHMExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7786
    hasDPSExtension := self queryDPSExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7787
    hasXVideoExtension := self queryXVideoExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7788
    hasMbufExtension := self queryMBUFExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7789
    hasPEXExtension := self queryPEXExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7790
    hasImageExtension := self queryXIEExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7791
    hasInputExtension := self queryXIExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7792
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7793
    primaryAtom := self atomIDOf:#PRIMARY.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  7794
    stringAtom := self atomIDOf:#STRING.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  7795
    clipboardAtom := self atomIDOf:#CLIPBOARD.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7796
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7797
    altModifierMask := self modifier2Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7798
    metaModifierMask := self modifier1Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7799
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7800
    screen := self queryDefaultScreen.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7801
    depth := self queryDepth.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7802
    ncells := self queryCells.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7803
    width := self queryWidth.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7804
    height := self queryHeight.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7805
    widthMM := self queryWidthMM.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7806
    heightMM := self queryHeightMM.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7807
    blackpixel := self queryBlackPixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7808
    whitepixel := self queryWhitePixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7809
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7810
    monitorType := #unknown.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7811
    visualType := self queryDefaultVisualType.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7812
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7813
    hasColors := hasGreyscales := true.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7814
    (visualType == #StaticGray
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7815
    or:[ visualType == #GrayScale]) ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7816
	hasColors := false.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7817
	monitorType := #monochrome.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7818
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7819
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7820
    ncells == 2 ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7821
	hasColors := hasGreyscales := false.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7822
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7823
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7824
    masks := self queryRGBMasks.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7825
    redMask := masks at:1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7826
    greenMask := masks at:2.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7827
    blueMask := masks at:3.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7828
    bitsPerRGB := masks at:4.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7829
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7830
    visualType == #TrueColor ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7831
	redShift := redMask lowBit - 1.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7832
	greenShift := greenMask lowBit - 1.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7833
	blueShift := blueMask lowBit - 1.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7834
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7835
	bitsRed := redMask highBit - redMask lowBit + 1.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7836
	bitsGreen := greenMask highBit - greenMask lowBit + 1.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7837
	bitsBlue := blueMask highBit - blueMask lowBit + 1.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7838
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7839
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  7840
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7841
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7842
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7843
    int scr;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7844
    Visual *visual;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7845
    XVisualInfo viproto;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7846
    XVisualInfo *vip;                   /* retured info */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7847
    int maxRGBDepth;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7848
    int rgbRedMask, rgbGreenMask, rgbBlueMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7849
    int rgbVisualID;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7850
    int nvi, i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7851
    char *type, *nm;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7852
    int dummy;
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
    if (ISCONNECTED) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7855
	dpy = myDpy;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7856
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7857
	/*
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7858
	 * look for RGB visual
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7859
	 */
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7860
	nvi = 0;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7861
	viproto.screen = scr;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7862
	vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7863
	maxRGBDepth = 0;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7864
	for (i = 0; i < nvi; i++) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7865
	    switch (vip[i].class) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7866
		case TrueColor:
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7867
		    if (vip[i].depth > maxRGBDepth) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7868
			maxRGBDepth = vip[i].depth;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7869
			rgbRedMask = vip[i].red_mask;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7870
			rgbGreenMask = vip[i].green_mask;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7871
			rgbBlueMask = vip[i].blue_mask;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7872
			rgbVisualID = vip[i].visualid;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7873
		    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7874
		    break;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7875
	    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7876
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7877
	if (vip) XFree ((char *) vip);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7878
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7879
	if (maxRGBDepth) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7880
	    __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  7881
	}
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  7882
    }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  7883
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7884
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7885
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7886
initializeSpecialFlags
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7887
    "perform additional special server implementation flags"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7888
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7889
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7890
    "/ assume we have it ... (should check)
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
    hasSaveUnder := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7893
    ignoreBackingStore := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7894
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7895
    (self serverVendor = 'X11/NeWS') ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7896
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7897
	"/ this is a kludge around a bug in the X11/NeWS server,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7898
	"/ which does not correctly handle saveUnder
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7899
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7900
	hasSaveUnder := false.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7901
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7902
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7903
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7904
openConnectionTo:dpyName
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7905
    "open a connection to some display;
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7906
     return displayId if ok, nil of not ok"
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7907
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  7908
%{ /* STACK:100000 */    /* XOpenDisplay() calls gethostbyname() */
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7909
    Display *dpy;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7910
    int i;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7911
    char *nm;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7912
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7913
    if (__isString(dpyName))
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7914
	nm = (char *) __stringVal(dpyName);
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7915
    else {
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7916
	nm = NULL;
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7917
    }
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7918
    dpy = XOpenDisplay(nm);
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7919
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7920
    if (dpy) {
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7921
	static int firstCall = 1;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7922
	OBJ dpyID;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7923
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7924
	dpyID = __MKEXTERNALADDRESS(dpy);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7925
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7926
	if (firstCall) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7927
	    firstCall = 0;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7928
	    XSetErrorHandler(__XErrorHandler__);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7929
	    XSetIOErrorHandler(__XIOErrorHandler__);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7930
	}
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  7931
	RETURN (dpyID);
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7932
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7933
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  7934
    ^ nil
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7935
!
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7936
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7937
queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7938
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7939
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7940
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7941
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7942
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7943
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7944
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7945
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7946
	RETURN ( __MKSMALLINT(BlackPixel(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7947
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7948
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7949
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7950
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7951
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7952
     Display queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7953
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7954
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7955
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7956
queryCells
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7957
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7958
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7959
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7960
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7961
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7962
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7963
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7964
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7965
	RETURN ( __MKSMALLINT(DisplayCells(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7966
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7967
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7968
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7969
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7970
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7971
     Display queryCells 
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7972
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7973
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7974
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7975
queryDPSExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7976
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7977
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7978
#ifdef DPS
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7979
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7980
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7981
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7982
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7983
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7984
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7985
	if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7986
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7987
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7988
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7989
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7990
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7991
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7992
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7993
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7994
     Display queryDPSExtension  
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7995
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7996
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7997
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7998
queryDefaultScreen
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  7999
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8000
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8001
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8002
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8003
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8004
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8005
	RETURN ( __MKSMALLINT(DefaultScreen(dpy)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8006
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8007
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8008
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8009
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8010
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8011
     Display queryDefaultScreen  
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8012
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8013
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8014
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8015
queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8016
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8017
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8018
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8019
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8020
	Visual *visual;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8021
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8022
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8023
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8024
	switch (visual->class) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8025
	    case StaticGray:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8026
		RETURN ( @symbol(StaticGray) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8027
	    case GrayScale:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8028
		RETURN ( @symbol(GrayScale) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8029
	    case StaticColor:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8030
		RETURN ( @symbol(StaticColor) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8031
	    case PseudoColor:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8032
		RETURN ( @symbol(PseudoColor) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8033
	    case TrueColor:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8034
		RETURN ( @symbol(TrueColor) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8035
	    case DirectColor:
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8036
		RETURN ( @symbol(DirectColor) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8037
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8038
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8039
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8040
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8041
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8042
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8043
     Display queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8044
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8045
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8046
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8047
queryDepth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8048
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8049
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8050
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8051
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8052
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8053
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8054
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8055
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8056
	RETURN ( __MKSMALLINT(DisplayPlanes(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8057
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8058
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8059
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8060
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8061
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8062
     Display queryDepth  
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8063
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8064
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8065
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8066
queryHeight
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8067
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8068
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8069
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8070
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8071
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8072
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8073
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8074
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8075
	RETURN ( __MKSMALLINT(DisplayHeight(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8076
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8077
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8078
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8079
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8080
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8081
     Display queryHeight      
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8082
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8083
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8084
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8085
queryHeightMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8086
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8087
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8088
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8089
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8090
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8091
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8092
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8093
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8094
	RETURN ( __MKSMALLINT(DisplayHeightMM(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8095
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8096
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8097
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8098
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8099
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8100
     Display queryHeightMM      
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8101
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8102
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8103
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8104
queryMBUFExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8105
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8106
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8107
#ifdef MBUF
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8108
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8109
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8110
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8111
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8112
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8113
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8114
	if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8115
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8116
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8117
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8118
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8119
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8120
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8121
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8122
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8123
     Display queryMBUFExtension  
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8124
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8125
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8126
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8127
queryPEXExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8128
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8129
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8130
#ifdef PEX5
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8131
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8132
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8133
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8134
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8135
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8136
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8137
	if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8138
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8139
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8140
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8141
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8142
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8143
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8144
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8145
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8146
     Display queryPEXExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8147
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8148
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8149
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8150
queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8151
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8152
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8153
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8154
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8155
	Visual *visual;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8156
	OBJ redMask, greenMask, blueMask, bprgb;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8157
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8158
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8159
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8160
	redMask   = __MKSMALLINT(visual->red_mask);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8161
	greenMask = __MKSMALLINT(visual->green_mask);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8162
	blueMask  = __MKSMALLINT(visual->blue_mask);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8163
	bprgb  = __MKSMALLINT(visual->bits_per_rgb);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8164
	RETURN ( __ARRAY_WITH4(redMask, greenMask, blueMask, bprgb) );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8165
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8166
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8167
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8168
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8169
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8170
     Display queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8171
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8172
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8173
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8174
querySHMExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8175
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8176
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8177
#ifdef xxSHM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8178
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8179
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8180
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8181
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8182
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8183
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8184
	if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8185
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8186
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8187
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8188
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8189
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8190
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8191
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8192
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8193
     Display querySHMExtension  
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8194
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8195
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8196
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8197
queryShapeExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8198
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8199
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8200
#ifdef SHAPE
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8201
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8202
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8203
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8204
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8205
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8206
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8207
	if (XShapeQueryExtension(dpy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8208
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8209
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8210
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8211
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8212
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8213
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8214
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8215
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8216
     Display queryShapeExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8217
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8218
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8219
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8220
queryWhitePixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8221
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8222
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8223
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8224
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8225
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8226
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8227
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8228
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8229
	RETURN ( __MKSMALLINT(WhitePixel(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8230
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8231
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8232
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8233
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8234
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8235
     Display queryWhitePixel    
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8236
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8237
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8238
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8239
queryWidth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8240
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8241
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8242
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8243
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8244
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8245
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8246
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8247
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8248
	RETURN ( __MKSMALLINT(DisplayWidth(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8249
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8250
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8251
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8252
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8253
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8254
     Display queryWidth 
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8255
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8256
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8257
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8258
queryWidthMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8259
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8260
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8261
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8262
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8263
	int scr;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8264
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8265
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8266
	scr = DefaultScreen(dpy);
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8267
	RETURN ( __MKSMALLINT(DisplayWidthMM(dpy, scr)));
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8268
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8269
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8270
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8271
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8272
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8273
     Display queryWidthMM 
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8274
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8275
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8276
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8277
queryXIEExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8278
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8279
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8280
#ifdef XIE
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8281
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8282
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8283
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8284
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8285
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8286
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8287
	if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8288
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8289
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8290
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8291
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8292
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8293
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8294
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8295
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8296
     Display queryXIEExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8297
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8298
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8299
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8300
queryXIExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8301
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8302
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8303
#ifdef XI
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8304
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8305
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8306
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8307
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8308
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8309
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8310
	if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8311
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8312
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8313
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8314
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8315
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8316
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8317
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8318
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8319
     Display queryXIExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8320
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8321
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8322
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8323
queryXVideoExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8324
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8325
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8326
#ifdef XVIDEO
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8327
    if (ISCONNECTED) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8328
	Display *dpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8329
	int dummy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8330
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8331
	dpy = myDpy;
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8332
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8333
	if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) {
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8334
	    RETURN ( true );
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8335
	}
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8336
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8337
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8338
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8339
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8340
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8341
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8342
     Display queryXVideoExtension  
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8343
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8344
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8345
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8346
reinitialize
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  8347
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8348
    virtualRootId := rootId := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8349
    super reinitialize.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8350
    dispatchingExpose := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8351
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8352
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8353
!XWorkstation methodsFor:'keyboard mapping'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8354
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8355
altModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8356
    "return the mask (in motionEvents) for the alt-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8357
     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
  8358
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8359
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8360
    ^ altModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8361
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8362
    "Created: 23.3.1996 / 12:43:22 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8363
    "Modified: 23.3.1996 / 12:44:56 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8364
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8365
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8366
altModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8367
    "define which key takes the role of an alt-key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8368
     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
  8369
     most keyboards. However, there may be exceptions to this,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8370
     and the setting can be changed with:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8371
	Display altModifierMask:(Display modifier2Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8372
     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
  8373
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8374
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8375
    altModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8376
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8377
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8378
ctrlModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8379
    "return the Xlib mask bit for the control modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8380
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8381
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8382
    RETURN (__MKSMALLINT(ControlMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8383
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8384
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8385
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8386
metaModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8387
    "return the mask (in motionEvents) for the meta-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8388
     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
  8389
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8390
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8391
    ^ metaModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8392
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8393
    "Created: 23.3.1996 / 12:43:39 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8394
    "Modified: 23.3.1996 / 12:45:09 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8395
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8396
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8397
metaModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8398
    "define which key takes the role of a meta key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8399
     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
  8400
     most keyboards (if present at all).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8401
     However, there may be exceptions to this, and the setting can
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8402
     be changed with:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8403
	Display metaModifierMask:(Display modifier1Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8404
     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
  8405
     As reported, some Xservers place the Meta-key onto NumLock,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8406
     and having NumLock enabled makes ST/X think, that meta is pressed
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8407
     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
  8408
     the mask to 0.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8409
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8410
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8411
    metaModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8412
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8413
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8414
modifier1Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8415
    "return the Xlib mask bit for the 1st modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8416
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8417
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8418
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8419
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8420
    RETURN (__MKSMALLINT(Mod1Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8421
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8422
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8423
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8424
modifier2Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8425
    "return the Xlib mask bit for the 2nd modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8426
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8427
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8428
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8429
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8430
    RETURN (__MKSMALLINT(Mod2Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8431
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8432
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8433
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8434
modifier3Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8435
    "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
  8436
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8437
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8438
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8439
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8440
    RETURN (__MKSMALLINT(Mod3Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8441
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8442
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8443
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8444
modifier4Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8445
    "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
  8446
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8447
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8448
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8449
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8450
    RETURN (__MKSMALLINT(Mod4Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8451
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8452
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8453
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8454
modifier5Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8455
    "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
  8456
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8457
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8458
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8459
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8460
    RETURN (__MKSMALLINT(Mod5Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8461
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8462
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8463
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8464
modifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8465
    "Get the Modifier Mapping.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8466
     We return an array of arrays of keycodes"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8467
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8468
    |modifierKeyMap maxKeyPerMod ret nextKey|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8469
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8470
    modifierKeyMap := self rawModifierMapping.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8471
    maxKeyPerMod := modifierKeyMap size // 8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8472
    modifierKeyMap isNil ifTrue:[^ nil].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8473
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8474
    ret := Array new:8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8475
    nextKey := 1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8476
    1 to:8 do:[ :i |
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8477
	(modifierKeyMap at:nextKey) ~= 0 ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8478
	    |mod|
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8479
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8480
	    mod := OrderedCollection new:maxKeyPerMod.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8481
	    modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8482
		key ~= 0 ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8483
		    mod add:key
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8484
		].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8485
	    ].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8486
	    ret at:i put:mod.
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8487
	].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8488
	nextKey := nextKey+maxKeyPerMod.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8489
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8490
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8491
    ^ ret
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8492
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8493
    "
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8494
     Display modifierMapping
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8495
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8496
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8497
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8498
     |mapping|
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8499
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8500
     mapping := Display modifierMapping.
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8501
     ^ mapping collect:[:eachRow | 
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8502
			     eachRow notNil ifTrue:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8503
				 eachRow collect:[ :key | Display stringFromKeycode:key ].
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8504
			     ] ifFalse:[
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8505
				 nil
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8506
			     ]
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8507
		       ].
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8508
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8509
!
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8510
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8511
rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8512
    "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
  8513
     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
  8514
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8515
    ^ rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8516
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8517
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8518
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8519
     Display rawKeySymTranslation
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8520
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8521
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8522
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8523
rawModifierMapping
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8524
    "Get the raw Modifier Mapping."
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8525
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8526
    |modifierKeyMap maxKeyPerMod |
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8527
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8528
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8529
    XModifierKeymap *modmap;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8530
    OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT();
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8531
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8532
    if (ISCONNECTED) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8533
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8534
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8535
	if ((modmap = XGetModifierMapping(dpy)) != 0) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8536
	   maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8537
	   modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8538
	   if (modifierKeyMap != nil) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8539
		memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, 
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8540
		       (char *)modmap->modifiermap, modmap->max_keypermod * 8);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8541
	   }
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8542
	   XFreeModifiermap(modmap);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8543
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8544
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8545
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8546
    ^ modifierKeyMap 
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8547
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8548
    "
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
  8549
	Display rawModifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8550
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8551
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8552
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8553
shiftModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8554
    "return the Xlib mask bit for the shift modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8555
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8556
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8557
    RETURN (__MKSMALLINT(ShiftMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8558
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8559
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8560
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8561
stringFromKeycode:code
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8562
    "Get a KeySymbol (a smalltalk symbol) from the keycode."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8563
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8564
    |str|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8565
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8566
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8567
    KeySym keysym;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8568
    char *keystring;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8569
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8570
    if (ISCONNECTED
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8571
     && __isSmallInteger(code)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8572
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8573
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  8574
	if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol &&
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8575
	    (keystring = XKeysymToString(keysym)) != 0) 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8576
	    str = __MKSTRING(keystring);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8577
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8578
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8579
    ^ str
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8580
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8581
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8582
	Display stringFromKeycode:28
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8583
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8584
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8585
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8586
superModifierMask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8587
    "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
  8588
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8589
    ^ self modifier4Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8590
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8591
2140
21ad63e0c739 allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  8592
translateKey:untranslatedKey forView:aView
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8593
    "Return the key translated via the translation table.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8594
     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
  8595
     which gets further processed in the superclasses translation method."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8596
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8597
    |key|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8598
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8599
    key := untranslatedKey.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8600
    (rawKeySymTranslation includesKey:key) ifTrue:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8601
	key := rawKeySymTranslation at:key.
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8602
    ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8603
    key isCharacter ifFalse:[
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8604
	key := key asSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8605
    ].
2140
21ad63e0c739 allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  8606
    ^ super translateKey:key forView:aView
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8607
! !
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
!XWorkstation methodsFor:'misc'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8610
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8611
beep
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8612
    "output an audible beep or bell"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8613
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  8614
    UserPreferences current beepEnabled ifTrue:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8615
	self beep:50
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8616
    ]
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  8617
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  8618
    "Modified: / 3.12.1999 / 17:13:59 / ps"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8619
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8620
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8621
beep:volumeInPercent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8622
    "output an audible beep"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8623
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8624
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8625
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8626
    int volume;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8627
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8628
    if (__isSmallInteger(volumeInPercent)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8629
     && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8630
	/* stupid: X wants -100 .. 100 and calls this percent */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8631
	volume = __intVal(volumeInPercent) * 2 - 100;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8632
	if (volume < -100) volume = -100;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8633
	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
  8634
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8635
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8636
	XBell(myDpy, volume);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8637
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8638
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8639
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8640
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8641
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8642
buffered
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8643
    "buffer drawing - do not send it immediately to the display.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8644
     This is the default anyway.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8645
     See #unBuffered for additional info."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8646
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8647
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8648
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8649
    if (ISCONNECTED) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8650
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8651
	XSynchronize(myDpy, 0);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8652
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8653
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8654
%}
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8655
    "
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8656
     Display buffered
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8657
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8658
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8659
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8660
flush
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8661
    "send all buffered drawing to the display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8662
     This may be required to make certain, that all previous operations
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8663
     are really sent to the display before continuing. For example,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8664
     after a cursor-change with a followup long computation.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8665
     (otherwise, the cursor change request may still be in the output buffer)
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8666
     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
  8667
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8668
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8669
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8670
    if (ISCONNECTED) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8671
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8672
	XFlush(myDpy);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8673
	LEAVE_XLIB();
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8674
    }
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8675
%}
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8676
!
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8677
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8678
flushDpsContext:aDPSContext
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8679
    <context: #return>
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8680
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8681
#ifdef DPS
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8682
    if (ISCONNECTED
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8683
	&& __isExternalAddress(aDPSContext)) {
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
	DPSFlushContext(__DPSContextVal(aDPSContext));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8686
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8687
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8688
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8689
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8690
#endif
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8691
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8692
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8693
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8694
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8695
primSync
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8696
    "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
  8697
     has finished drawing it.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8698
     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
  8699
     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
  8700
     to be finished. See also #flush."
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8701
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8702
    <context: #return>
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8703
%{  
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8704
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8705
    if (ISCONNECTED) {
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8706
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8707
	ENTER_XLIB();
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8708
	XSync(myDpy, 0);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  8709
	LEAVE_XLIB();
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8710
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8711
    }
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8712
%}
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8713
!
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8714
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8715
refreshKeyboardMapping:eB
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8716
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8717
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8718
    XMappingEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8719
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8720
    if (ISCONNECTED
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8721
     && __isByteArray(eB)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8722
	ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8723
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8724
	XRefreshKeyboardMapping(ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8725
	LEAVE_XLIB();
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8726
	RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8727
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8728
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8729
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8730
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8731
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8732
roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8733
    "answer the round trip time in milliSeconds.
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8734
     May be used to detect slow X11 connections"
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8735
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8736
    self sync.
3576
f9cb849dafe6 Do not use Time, compiling problems.
Stefan Vogel <sv@exept.de>
parents: 3575
diff changeset
  8737
    ^ AbsoluteTime millisecondsToRun:[ self primSync ].
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8738
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8739
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8740
     Screen current roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8741
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8742
!
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  8743
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8744
setInputFocusTo:aWindowId
2871
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  8745
    "set the focus to the view as defined by aWindowId.
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  8746
     When released, return the focus to the root window"
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  8747
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8748
"/    self setInputFocusTo:aWindowId revertTo:#parent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8749
    self setInputFocusTo:aWindowId revertTo:#root
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8750
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8751
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8752
setInputFocusTo:aWindowId revertTo:revertSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8753
    "set the focus to the view as defined by aWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8754
     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
  8755
     input until a new focus is set.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8756
     RevertSymbol specifies what should happen if the view becomes invisible;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8757
     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
  8758
     given to the parent view, the root view or no view."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8759
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8760
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8761
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8762
    int arg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8763
    Window focusWindow;
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
    if (ISCONNECTED) {
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8766
	if (__isExternalAddress(aWindowId)) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8767
	    focusWindow = __WindowVal(aWindowId);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8768
	} else if (aWindowId == nil) {
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8769
	    focusWindow = None;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8770
	} else
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8771
	    goto err;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8772
	if (revertSymbol == @symbol(parent))
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8773
	    arg = RevertToParent;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8774
	else if (revertSymbol == @symbol(root))
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8775
	    arg = RevertToPointerRoot;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8776
	else 
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8777
	    arg = RevertToNone;
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8778
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8779
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8780
	ENTER_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8781
	XSetInputFocus(myDpy, focusWindow, arg, CurrentTime);
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8782
	LEAVE_XLIB();
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8783
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
  8784
	RETURN ( self );
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  8785
    }
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  8786
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8787
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8788
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8789
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8790
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8791
sync
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8792
    "send all buffered drawing to the display AND wait until the display
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8793
     has finished drawing it.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8794
     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
  8795
     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
  8796
     to be finished. See also #flush."
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8797
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8798
    self primSync.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  8799
    self dispatchPendingEvents.
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8800
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8801
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8802
unBuffered
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8803
    "make all drawing be sent immediately to the display.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8804
     This makes all graphics synchronous and turns off any buffering
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8805
     (i.e. each individual draw-request is sent immediately without 
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8806
      packing multiple requests into a larger message buffer).
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8807
     Be prepared, that this slows down graphics considerably.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8808
     However, it allows display errors to be handled immediately and
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8809
     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
  8810
     which was responsible for it. See also #buffered."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8811
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8812
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8813
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8814
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8815
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8816
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8817
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8818
	XSynchronize(myDpy, 1);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8819
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8820
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8821
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8822
%}
1813
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  8823
    "
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  8824
     Display unBuffered
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  8825
    "
295
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
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8828
!XWorkstation methodsFor:'pointer stuff'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8829
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8830
anyButtonStateMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8831
    "return an integer for masking out any button from a
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8832
     buttonStates value."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8833
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8834
    "/ should use ``Display buttonXMotionMask bitOr:....''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8835
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8836
    ^ 256 + 512 + 1024
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8837
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8838
    "Modified: 23.3.1996 / 12:41:33 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8839
    "Created: 23.3.1996 / 12:46:35 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8840
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8841
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8842
buttonStates
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8843
    "return an integer representing the state of the pointer buttons;
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8844
     a one-bit in positions 0.. represent a pressed button.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8845
     See the button1Mask/button2Mask/button3Mask,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8846
     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
  8847
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8848
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8849
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8850
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  8851
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8852
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8853
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8854
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8855
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8856
    if (ISCONNECTED) {
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8857
	Display *dpy = myDpy;
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8858
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8859
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8860
#ifdef VIRTUAL_ROOT
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  8861
	ENTER_XLIB();
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  8862
	w = getRootWindow(dpy, screen);
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  8863
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8864
#else
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8865
	w = RootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8866
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8867
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8868
	if (w) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8869
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8870
	    ENTER_XLIB();
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8871
	    XQueryPointer(dpy, w, &rootRet, &childRet,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8872
				 &rootX, &rootY,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8873
				 &winX, &winY,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8874
				 &mask);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8875
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8876
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8877
	    RETURN (__MKSMALLINT(mask));
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8878
	}
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8879
    }
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8880
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8881
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8882
    ^ nil
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8883
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8884
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8885
     Display buttonStates     
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8886
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8887
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8888
    "is the control-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8889
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8890
     Display buttonStates bitTest:(Display controlMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8891
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8892
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8893
    "is the alt/meta-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8894
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8895
     Display buttonStates bitTest:(Display altModifierMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8896
     Display buttonStates bitTest:(Display metaModifierMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8897
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8898
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8899
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8900
leftButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8901
    "return an integer for masking out the left button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8902
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8903
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8904
    "/ should use ``Display button1MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8905
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8906
    ^ 256
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8907
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8908
    "Modified: 23.3.1996 / 12:41:33 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8909
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8910
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8911
middleButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8912
    "return an integer for masking out the middle button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8913
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8914
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8915
    "/ should use ``Display button2MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8916
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8917
    ^ 512
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8918
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8919
    "Modified: 23.3.1996 / 12:41:43 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8920
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8921
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8922
pointerPosition
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8923
    "return the current pointer position in root-window coordinates"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8924
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8925
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8926
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8927
    |xpos ypos|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8928
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8929
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8930
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  8931
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8932
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8933
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8934
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8935
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8936
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8937
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8938
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8939
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8940
#ifdef VIRTUAL_ROOT
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  8941
	ENTER_XLIB();
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  8942
	w = getRootWindow(dpy, screen);
3920
9dbbb0018f6c VIRTUAL_ROOT handling
Stefan Vogel <sv@exept.de>
parents: 3886
diff changeset
  8943
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8944
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8945
	w = RootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8946
#endif
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8947
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8948
	XQueryPointer(dpy, w, &rootRet, &childRet,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8949
			      &rootX, &rootY,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8950
			      &winX, &winY,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8951
			      &mask);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8952
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8953
	xpos = __MKSMALLINT(rootX);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8954
	ypos = __MKSMALLINT(rootY);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8955
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8956
    }
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8957
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8958
    xpos isNil ifTrue:[
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8959
	self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8960
	^ nil
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8961
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8962
    ^ xpos @ ypos
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8963
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8964
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8965
rightButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8966
    "return an integer for masking out the right button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8967
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8968
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8969
    "/ should use ``Display button3MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8970
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8971
    ^ 1024
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8972
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8973
    "Modified: 23.3.1996 / 12:41:52 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8974
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8975
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8976
rootPositionOfLastEvent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8977
    "return the position in root-window coordinates
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8978
     of the last button, key or pointer event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8979
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8980
    ^ eventRootX @ eventRootY
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8981
!
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8982
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8983
setPointerPosition:newPosition in:aWindowId
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8984
    "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
  8985
     given windows origin (which may be the rootWindow).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  8986
     Be careful with this - its usually not very ergonomically
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8987
     to change the mousePointer position.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8988
     This interface is provided for special applications (presentation
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8989
     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
  8990
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8991
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8992
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8993
    |xpos ypos|
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8994
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8995
    xpos := newPosition x.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8996
    ypos := newPosition y.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8997
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8998
%{
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8999
    if (ISCONNECTED
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9000
     && __isExternalAddress(aWindowId)
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9001
     && __bothSmallInteger(xpos, ypos)) {
3424
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9002
	Display *dpy = myDpy;
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9003
	Window w = __WindowVal(aWindowId);
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9004
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9005
	ENTER_XLIB();
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9006
	XWarpPointer(dpy, 
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9007
		     None,  /* src window */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9008
		     w,  /* dst window */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9009
		     0,  /* src_x */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9010
		     0,  /* src_y */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9011
		     0,  /* src_w */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9012
		     0,  /* src_h */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9013
		     __intVal(xpos),  /* dst_x */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9014
		     __intVal(ypos)   /* dst_y */
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9015
		    );
212a656cfdcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  9016
	LEAVE_XLIB();
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9017
    }
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9018
%}.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9019
    ^ self
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9020
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9021
    "
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9022
     Display setPointerPosition:1000@1000
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9023
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9024
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9025
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9026
!XWorkstation methodsFor:'properties'!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9027
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9028
deleteProperty:propertyID for:aWindowID
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9029
    "delete a property in the XServer"
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9030
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9031
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9032
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9033
%{
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9034
    if (ISCONNECTED && __isAtomID(propertyID)) {
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9035
	Display *dpy = myDpy;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9036
	Atom prop;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9037
	Window window;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9038
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9039
	prop = __AtomVal(propertyID);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9040
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9041
	if (__isExternalAddress(aWindowID)) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9042
	    window = __WindowVal(aWindowID);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9043
	} else if (aWindowID == nil) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9044
	    window = DefaultRootWindow(dpy);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9045
	} else if (__isInteger(aWindowID)) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9046
	    window = (Window)__unsignedLongIntVal(aWindowID);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9047
	} else {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9048
	    goto fail;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9049
	}
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9050
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9051
	ENTER_XLIB();
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9052
	XDeleteProperty(dpy, window, prop);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9053
	LEAVE_XLIB();
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9054
	RETURN(true);
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9055
    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9056
fail:;
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9057
%}.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9058
    self primitiveFailedOrClosedConnection.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9059
!
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9060
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9061
getObjectProperty:propertyID from:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9062
    "get an object property from the server; return object or nil"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9063
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9064
    self 
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9065
        getProperty:propertyID 
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9066
        from:aWindowID 
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9067
        delete:true 
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9068
        into:
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9069
            [:type :value |
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9070
                type == stringAtom ifTrue:[
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9071
                    ^ value
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9072
                ].
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9073
                (value isMemberOf:ByteArray) ifTrue:[
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9074
                    ^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil])
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9075
                ]
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9076
            ].
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9077
    ^ nil
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9078
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9079
    "Modified: 6.4.1997 / 13:27:07 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9080
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9081
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9082
getProperty:propertySymbolOrAtomID from:aWindowOrWindowIDOrNil delete:doDelete into:aTwoArgBlock
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9083
    "get a property, evaluate aTwoArgBlock with typeID and value"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9084
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9085
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9086
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9087
    |val typeID propertyID windowID|
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9088
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9089
    propertySymbolOrAtomID isString ifTrue:[
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9090
        propertyID := self atomIDOf:propertySymbolOrAtomID create:false.
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9091
        propertyID isNil ifTrue:[^ false].
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9092
    ] ifFalse:[
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9093
        propertyID := propertySymbolOrAtomID.
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9094
    ].
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9095
    aWindowOrWindowIDOrNil isView ifTrue:[
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9096
        windowID := aWindowOrWindowIDOrNil id.
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9097
    ] ifFalse:[
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9098
        windowID := aWindowOrWindowIDOrNil.
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  9099
    ].
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  9100
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9101
%{
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9102
    Window window;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9103
    Atom property;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9104
    char *cp, *cp2;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9105
    Atom actual_type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9106
    int actual_format,i;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9107
    unsigned long nitems, bytes_after, nread;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9108
    unsigned char *data;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9109
    int ok = 1;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9110
#   define PROP_SIZE    2048
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9111
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9112
    if (ISCONNECTED) {
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9113
        Display *dpy = myDpy;
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9114
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9115
        if (__isAtomID(propertyID)) {
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9116
            property = __AtomVal(propertyID);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9117
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9118
            if (__isExternalAddress(windowID)) {
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9119
                window = __WindowVal(windowID);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9120
            } else if (windowID == nil) {
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9121
                window = DefaultRootWindow(dpy);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9122
            } else
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9123
                goto fail;
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9124
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9125
            nread = 0;
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9126
            cp = 0;
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9127
#ifdef PROPERTY_DEBUG
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9128
            fprintf(stderr, "getProperty %x\n", property);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9129
#endif
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9130
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9131
            do {
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9132
                int retVal;
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9133
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9134
                ENTER_XLIB();
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9135
                retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9136
                                            doDelete == true,
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9137
                                            AnyPropertyType, &actual_type, &actual_format,
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9138
                                            &nitems, &bytes_after, (unsigned char **)&data);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9139
                LEAVE_XLIB();
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9140
                if (retVal != Success) {
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9141
#ifdef PROPERTY_DEBUG
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9142
                    fprintf(stderr, "- no success\n");
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9143
#endif
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9144
                    ok = 0;
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9145
                    break;
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9146
                }
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9147
#ifdef PROPERTY_DEBUG
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9148
                fprintf(stderr, "- type:%x\n", actual_type);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9149
#endif
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9150
                typeID = __MKATOMOBJ(actual_type);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9151
                if (! cp) {
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9152
                    cp = cp2 = (char *)malloc(nitems+1);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9153
                } else {
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9154
                    cp = (char *)realloc(cp, nread + nitems + 1);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9155
                    cp2 = cp + nread;
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9156
                }
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9157
                if (! cp) {
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9158
                    XFree(data);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9159
                    goto fail;
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9160
                }
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9161
    
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9162
                nread += nitems;
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9163
                bcopy(data, cp2, nitems);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9164
                XFree(data);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9165
#ifdef PROPERTY_DEBUG
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9166
                fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9167
#endif
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9168
            } while (bytes_after > 0);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9169
    
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9170
            if (ok) {
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9171
                if (actual_type == XA_STRING) {
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9172
                    cp[nread] = '\0';
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9173
                    val = __MKSTRING_L(cp, nread);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9174
                } else {
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9175
                    val = __MKBYTEARRAY(cp, nread);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9176
                }
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9177
            }
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9178
            if (cp)
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9179
                free(cp);
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9180
        }
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9181
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9182
fail: ;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9183
%}.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9184
    typeID isNil ifTrue:[
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9185
        ^ false
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9186
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9187
    aTwoArgBlock value:typeID value:val.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9188
    ^ true
3977
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9189
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9190
    "
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9191
     Display 
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9192
        getProperty:#'_DESKTOP_COLORS'
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9193
        from:nil
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9194
        delete:false
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9195
        into:[:a :b | self halt]
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9196
    "
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9197
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9198
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9199
getProperty:propertyID type:targetID from:aWindowID
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9200
    | value |
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9201
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9202
    targetID == (self atomIDOf:#'ST_OBJECT') ifTrue:[
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9203
        "an object"
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9204
        ^ self getObjectProperty:propertyID from:aWindowID.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9205
    ].
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9206
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9207
    (targetID == stringAtom
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9208
    or:[ targetID == (self atomIDOf:#'UTF8_STRING')
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9209
    or:[ targetID == (self atomIDOf:#'COMPOUND_TEXT')
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9210
    or:[ targetID == (self atomIDOf:#'TEXT') ]]]) ifTrue:[
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9211
        "some kind of string"
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9212
        value := self getTextProperty:propertyID from:aWindowID.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9213
        value notNil ifTrue:[
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9214
            (value endsWith:Character cr) ifTrue:[
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9215
                value := value asStringCollection copyWith:''
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9216
            ]
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9217
        ].
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9218
        ^ value.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9219
    ].
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9220
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9221
    'XWorkstation [info]: unhandled targetType: ' infoPrint.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9222
    (self atomName:targetID) infoPrintCR.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9223
    ^ nil.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9224
!
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9225
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9226
getTextProperty:propertyID from:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9227
    "get a text property; return string or nil"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9228
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9229
    self 
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9230
        getProperty:propertyID 
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9231
        from:aWindowID 
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9232
        delete:true 
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9233
        into:
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9234
            [:type :value |
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9235
                |stringClass|
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9236
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9237
                type == stringAtom ifTrue:[
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9238
                    clipBoardEncoding notNil ifTrue:[
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9239
                        ^ value decodeFrom:clipBoardEncoding
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9240
                    ].    
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9241
                    ^ value
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9242
                ].
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9243
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9244
                type == (self atomIDOf:#'UTF8_STRING') ifTrue:[
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9245
"/ Transcript show:'UTF8: '; showCR:value storeString.    
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9246
                    ^ CharacterArray fromUTF8Bytes:value
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9247
                ].
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9248
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9249
                type == (self atomIDOf:#'TEXT') ifTrue:[
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9250
"/ Transcript show:'TEXT: '; showCR:value storeString.    
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9251
                    ^ value asString
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9252
                ].
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9253
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9254
                type == (self atomIDOf:#'COMPOUND_TEXT') ifTrue:[
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9255
"/ Transcript show:'COMPOUND_TEXT: '; showCR:value storeString.    
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9256
                    ^ value asString
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9257
                ].
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9258
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9259
                type == (self atomIDOf:#INCR) ifTrue:[
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9260
                    'XWorkstation: unimplemented property type: INCR value: ' infoPrint.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9261
                    value storeString infoPrintCR.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9262
                    ^ nil
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9263
                ].
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9264
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9265
                'XWorkstation: unimplemented property type: ' infoPrint. type infoPrint.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9266
                ' ' infoPrint. (self atomName:type) infoPrint.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9267
                ' value:' infoPrint. value infoPrintCR.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9268
                ^ nil
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9269
            ].
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9270
    ^ nil
1793
5cda147b5f33 added clipboardEncoding
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
  9271
1798
fcbbdcbd5870 clipBoardEncoding
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  9272
    "Modified: 30.6.1997 / 20:54:59 / cg"
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9273
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9274
    "
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9275
     Display getTextProperty:#'_KDE_GENERAL' from:nil.   
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9276
     Display getTextProperty:#'_DESKTOP_FONTS' from:nil.   
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9277
    "
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9278
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9279
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9280
propertiesOf:aWindowOrWindowIDOrNil
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9281
    "return a collection of all properties' atomIDs of a window.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9282
     Returns the rootWindows props for a nil window argument."
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9283
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9284
    <context: #return>
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9285
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9286
    |windowID atoms|
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9287
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9288
    aWindowOrWindowIDOrNil isView ifTrue:[
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9289
        windowID := aWindowOrWindowIDOrNil id.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9290
    ] ifFalse:[
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9291
        windowID := aWindowOrWindowIDOrNil.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9292
    ].
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9293
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9294
%{
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9295
    Window window;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9296
    Atom *atomListPtr;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9297
    int i;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9298
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9299
    if (ISCONNECTED) {
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9300
        Display *dpy = myDpy;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9301
        int numProps = 0;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9302
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9303
        if (__isExternalAddress(windowID)) {
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9304
            window = __WindowVal(windowID);
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9305
        } else if (windowID == nil) {
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9306
            window = DefaultRootWindow(dpy);
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9307
        } else if (__isInteger(windowID)) {
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9308
            window = (Window)__unsignedLongIntVal(windowID);
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9309
        } else {
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9310
            goto fail;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9311
        }
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9312
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9313
        ENTER_XLIB();
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9314
        atomListPtr = XListProperties(dpy, window, &numProps);
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9315
        LEAVE_XLIB();
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9316
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9317
        if (atomListPtr == NULL) {
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9318
            RETURN (nil);
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9319
        }
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9320
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9321
        atoms = __ARRAY_NEW_INT(numProps);
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9322
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9323
        if (atoms == nil) {
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9324
            goto fail;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9325
        }
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9326
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9327
        for (i=0; i<numProps; i++) {
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9328
            OBJ atm;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9329
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9330
            atm = __MKATOMOBJ(atomListPtr[i]);
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9331
            __ArrayInstPtr(atoms)->a_element[i] = atm; __STORE(atoms, atm);
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9332
        }
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9333
        XFree(atomListPtr);
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9334
        RETURN (atoms);
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9335
    }
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9336
fail: ;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9337
%}.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9338
    ^ self primitiveFailed
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9339
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9340
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9341
     Display propertiesOf:nil
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9342
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9343
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9344
     (Display propertiesOf:nil) do:[:atm |
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9345
        |v|
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9346
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9347
        Transcript show:(atm printStringLeftPaddedTo:5).
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9348
        Transcript show:' '.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9349
        Display getProperty:atm from:nil delete:false into:[:type :val | v := type->val].
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9350
        Transcript showCR:v.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9351
     ]
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9352
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9353
!
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9354
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9355
setProperty:propertyID type:typeID value:anObject for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9356
    "set a property in the XServer"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9357
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9358
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  9359
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9360
    |retval|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9361
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9362
    retval := false.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9363
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9364
%{  /* UNLIMITEDSTACK */
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9365
    if (ISCONNECTED && __isAtomID(propertyID) && __isAtomID(typeID)) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9366
	Display *dpy = myDpy;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9367
	Atom prop, type;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9368
	Window window;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9369
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9370
	prop = __AtomVal(propertyID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9371
	type = __AtomVal(typeID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9372
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9373
	if (__isExternalAddress(aWindowID)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9374
	    window = __WindowVal(aWindowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9375
	} else if (aWindowID == nil) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9376
	    window = DefaultRootWindow(dpy);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9377
	} else if (__isInteger(aWindowID)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9378
	    window = (Window)__unsignedLongIntVal(aWindowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9379
	} else {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9380
	    RETURN(false);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9381
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9382
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9383
	retval = true;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9384
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9385
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9386
	if (__isSmallInteger(anObject)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9387
	    unsigned INT value = __intVal(anObject);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9388
	    XChangeProperty(dpy, window, prop, type, 32,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9389
			    PropModeReplace,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9390
			    (unsigned char *)&value, 1);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9391
	} else if (__isByteArray(anObject)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9392
	    XChangeProperty(dpy, window, prop, type, 8,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9393
			    PropModeReplace,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9394
			    __byteArrayVal(anObject),
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9395
			    __byteArraySize(anObject));
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9396
	} else if (__isWords(anObject)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9397
	    /* wordArray-like (16bit-string) object */
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9398
	    XChangeProperty(dpy, window, prop, type, 16,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9399
			    PropModeReplace,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9400
			    __stringVal(anObject),
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9401
			    __wordArraySize(anObject));
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9402
#ifdef __integerArrayVal
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9403
	} else if (__isIntegerArray(anObject)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9404
	    /* array of atoms */
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9405
	    XChangeProperty(dpy, window, prop, type, 32,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9406
			    PropModeReplace,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9407
			    (char *)__integerArrayVal(anObject),
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9408
			    __integerArraySize(anObject));
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9409
#endif
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9410
	} else if (__isString(anObject) || __isSymbol(anObject)) { 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9411
	    XChangeProperty(dpy, window, prop, type, 8,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9412
			    PropModeReplace,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9413
			    __stringVal(anObject),
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9414
			    __stringSize(anObject));
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9415
	} else {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9416
	    retval = false;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9417
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9418
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9419
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9420
	DPRINTF(("changeProp win=%x prop=%x type=%x\n", window, prop, type));
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9421
    }
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9422
%}.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9423
    ^ retval
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9424
! !
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9425
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9426
!XWorkstation methodsFor:'queries'!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9427
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9428
supportedClipboards
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9429
    "answer a collection of symbols with the supported clipboards.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9430
     X11 additionaly supports a buffer containing the currently selected text 
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9431
     (in xterm) - the PRIMARY selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9432
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9433
    ^ #(clipboard selection)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9434
! !
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9435
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9436
!XWorkstation methodsFor:'resources'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9437
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9438
atomIDOf:aStringOrSymbol
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9439
    "return an X11 atoms ID; dont create if not already present.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9440
     This is highly X specific and only for local use (with selections).
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9441
     The default is to create the atom, if it does not exist, in order to
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9442
     speed up future lookups"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9443
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9444
    ^ self atomIDOf:aStringOrSymbol create:true
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9445
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9446
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9447
     Display atomIDOf:#'FACE_NAME'      
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9448
     Display atomIDOf:#'FULL_NAME' 
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9449
     Display atomIDOf:#DndProtocol 
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9450
     Display atomIDOf:#DndSelection 
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9451
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9452
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  9453
    "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
  9454
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9455
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9456
atomIDOf:aStringOrSymbol create:create
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9457
    "return an Atoms ID given its name.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9458
     If it already exists, return its ID.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9459
     If not and the create argument is true, it is created.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9460
     Otherwise, nil is returned.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9461
     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
  9462
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9463
    |atomSymbol atom|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9464
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9465
    atomSymbol := aStringOrSymbol asSymbol.   
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9466
    (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:nil) notNil]) ifTrue:[
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9467
        ^ atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9468
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9469
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9470
    atom := self primAtomIDOf:atomSymbol create:create.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9471
    atom notNil ifTrue:[
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9472
        atoms isNil ifTrue:[
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9473
            atoms := IdentityDictionary new.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9474
        ].
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9475
        atoms at:atomSymbol put:atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9476
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9477
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9478
    ^ atom
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9479
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9480
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9481
     Display atomIDOf:#'VT_SELECTION' create:false
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9482
     Display atomIDOf:#CLIPBOARD create:false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9483
     Display atomIDOf:'STRING' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9484
     Display atomIDOf:'PRIMARY' create:false
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9485
     Display atomIDOf:'blabla' create:false 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9486
    "
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9487
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9488
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9489
atomName:anAtomID
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9490
    "given an AtomID, return its name.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9491
     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
  9492
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9493
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9494
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9495
%{ 
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9496
    OBJ str;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9497
    char *name;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9498
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9499
    if (ISCONNECTED && __isAtomID(anAtomID)) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9500
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9501
	name = XGetAtomName(myDpy, __AtomVal(anAtomID));
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9502
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9503
	if (name == 0) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9504
	    RETURN (nil);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9505
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9506
	str = __MKSTRING(name);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9507
	XFree(name);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9508
	RETURN ( str );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9509
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9510
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9511
    self primitiveFailedOrClosedConnection.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9512
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9513
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9514
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9515
     Display atomName:1    'PRIMARY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9516
     Display atomName:130  '_DEC_DEVICE_FONTNAMES'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9517
     Display atomName:132  'FONTNAME_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9518
     Display atomName:135 'FOUNDRY' 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9519
     Display atomName:150  'CHARSET_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9520
     Display atomName:151  'ISO8859'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9521
     Display atomName:152 'CHARSET_ENCODING'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9522
     Display atomName:154 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9523
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9524
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9525
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9526
getResource:name class:cls
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9527
    "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
  9528
     of name in a resource class.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9529
     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
  9530
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9531
     Notice: 
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9532
	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
  9533
	styles or resources. This would make porting of applications
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9534
	to different platforms much more difficult (Windows has no resource
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9535
	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
  9536
	easily transported to other platforms.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9537
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9538
     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
  9539
     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
  9540
     platforms."
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9541
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9542
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9543
    char *rslt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9544
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9545
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9546
     && __isNonNilObject(name)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9547
     && (__qIsString(name) || __qIsSymbol(name))
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9548
     && __isNonNilObject(cls)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9549
     && (__qIsString(cls) || __qIsSymbol(cls))) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9550
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  9551
	rslt = XGetDefault(myDpy, (char *) __stringVal(cls),
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  9552
				  (char *) __stringVal(name));
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9553
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9554
	RETURN (rslt ? __MKSTRING(rslt) : nil );
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9555
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9556
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9557
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9558
    ^ nil.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9559
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9560
    "if your ~/.Xdefaults contains an entry such as:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9561
	OpenWindows.Beep:       notices
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9562
     the following returns 'notices'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9563
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9564
	 Display getResource:'Beep' class:'OpenWindows'   
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9565
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9566
     if your ~/.Xdefaults contains an entry such as:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9567
	*.beNiceToColormap:       false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9568
     the following return 'false'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9569
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9570
	 Display getResource:'beNiceToColormap' class:'any'  
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9571
	 Display getResource:'beNiceToColormap' class:''  
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9572
    "
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9573
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9574
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9575
primAtomIDOf:aStringOrSymbol create:create
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9576
    "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
  9577
     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
  9578
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9579
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9580
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9581
%{ 
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9582
    Atom prop;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9583
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9584
    if (ISCONNECTED
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9585
     && __isNonNilObject(aStringOrSymbol)
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9586
     && (__qIsString(aStringOrSymbol) || __qIsSymbol(aStringOrSymbol))) {
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9587
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9588
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9589
	prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9590
				  (create == true) ? False : True);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9591
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9592
	if (prop == None) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9593
	    RETURN (nil);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9594
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9595
	RETURN ( __MKATOMOBJ(prop) );
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9596
    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9597
%}.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9598
    self primitiveFailedOrClosedConnection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9599
    ^ nil
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9600
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9601
    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9602
     Display primAtomIDOf:'VT_SELECTION' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9603
     Display primAtomIDOf:'CUT_BUFFER0' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9604
     Display primAtomIDOf:'STRING' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9605
     Display primAtomIDOf:'PRIMARY' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9606
    "
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9609
!XWorkstation methodsFor:'retrieving pixels'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9610
1462
f8b2909deb3c renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  9611
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
  9612
    "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
  9613
     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
  9614
     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
  9615
     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
  9616
     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
  9617
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  9618
    |rawInfo info|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9619
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9620
    ((w <= 0) or:[h <= 0]) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9621
	self primitiveFailed.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9622
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9623
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9624
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  9625
    rawInfo := Array new:8.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9626
		  "1 -> bit order"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9627
		  "2 -> depth"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9628
		  "3 -> bytes_per_line"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9629
		  "4 -> byte_order"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9630
		  "5 -> format"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9631
		  "6 -> bitmap_unit"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9632
		  "7 -> bitmap_pad"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9633
		  "8 -> bits_per_pixel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9634
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9635
    "/ 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
  9636
    "/ unlimitedStack (some implementations use alloca and require huge amounts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9637
    "/ of temporary stack space
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9638
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  9639
    (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
  9640
	info := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9641
	info at:#bitOrder put:(rawInfo at:1).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9642
	info at:#depth put:(rawInfo at:2).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9643
	info at:#bytesPerLine put:(rawInfo at:3).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9644
	info at:#byteOrder put:(rawInfo at:4).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9645
	info at:#format put:(rawInfo at:5).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9646
	info at:#bitmapUnit put:(rawInfo at:6).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9647
	info at:#bitmapPad put:(rawInfo at:7).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9648
	info at:#bitsPerPixel put:(rawInfo at:8).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9649
	^ info
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9650
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9651
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9652
     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
  9653
     or is too small to hold the bits
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9654
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9655
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9656
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9657
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9658
2713
1aef3acb4e04 need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
  9659
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
  9660
    "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
  9661
     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
  9662
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9663
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  9664
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9665
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9666
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  9667
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9668
    XImage *img;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9669
    int ret;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9670
    int xpos, ypos;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9671
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  9672
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  9673
     && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9674
	win = __WindowVal(aDrawableId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9675
	xpos = __intVal(x);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9676
	ypos = __intVal(y);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9677
	if ((xpos < 0) || (ypos < 0)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9678
	    RETURN ( __MKSMALLINT(0) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9679
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9680
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9681
	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
  9682
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9683
	if (img != 0) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9684
	    ret = XGetPixel(img, 0, 0);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9685
	    XDestroyImage(img);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9686
	    RETURN (  __MKSMALLINT(ret) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9687
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9688
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9689
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9690
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9691
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9692
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9693
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
  9694
    "since XGetImage may allocate huge amount of stack space 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9695
     (some implementations use alloca), this must run with unlimited stack."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9696
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9697
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  9698
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9699
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9700
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  9701
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9702
    XImage *image = (XImage *)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9703
    int pad, bytes_per_line, numBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9704
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9705
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9706
     && __isExternalAddress(aDrawableId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9707
     && __bothSmallInteger(srcx, srcy)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9708
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9709
     && __isArray(info)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9710
     && __isByteArray(imageBits)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9711
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9712
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9713
	win = __WindowVal(aDrawableId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9714
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9715
	image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9716
				    __intVal(w), __intVal(h),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9717
				    (unsigned)AllPlanes, ZPixmap);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9718
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9719
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9720
	if (! image) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9721
	    RETURN ( false );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9722
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9723
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9724
	pad = image->bitmap_pad;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9725
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9726
	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
  9727
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9728
	switch (image->depth) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9729
	    case 1:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9730
	    case 2:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9731
	    case 4:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9732
	    case 8:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9733
	    case 16:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9734
	    case 24:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9735
	    case 32:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9736
		numBytes = image->bytes_per_line * image->height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9737
		break;
1728
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  9738
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9739
	    default:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9740
		/* unsupported depth ? */
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
  9741
		fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9742
		numBytes = image->bytes_per_line * image->height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9743
		break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9744
	}
295
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
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9747
	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
  9748
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9749
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9750
	if (numBytes > __byteArraySize(imageBits)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9751
	    /* imageBits too small */
1728
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  9752
	    fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  9753
	    fprintf(stderr, "  bytes need:%d given:%d\n", numBytes, __byteArraySize(imageBits));
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  9754
	    fprintf(stderr, "  pad:%d depth:%d imgBytesPerLine:%d\n", 
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  9755
				image->bitmap_pad, image->depth, image->bytes_per_line);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9756
	    goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9757
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9758
	if (image->bitmap_bit_order == MSBFirst)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9759
	    __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9760
	else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9761
	    __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9762
	__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9763
	__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9764
	if (image->byte_order == MSBFirst)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9765
	    __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9766
	else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9767
	    __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9768
	if (image->format == XYBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9769
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9770
	else if (image->format == XYPixmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9771
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9772
	else if (image->format == ZPixmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9773
	    __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  9774
        
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9775
	__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9776
	__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9777
	__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9778
	bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9779
	XDestroyImage(image);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9780
	RETURN ( true );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9781
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9782
fail: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9783
    if (image) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9784
	XDestroyImage(image);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9785
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9786
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9787
    ^ false
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9790
!XWorkstation methodsFor:'selections'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9791
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  9792
addSelectionHandler:aHandler
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  9793
    SelectionHandlers isNil ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9794
	SelectionHandlers := IdentitySet new.
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  9795
    ].
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  9796
    SelectionHandlers add:aHandler
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  9797
!
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  9798
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9799
getSelectionFor:drawableId
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9800
    "get the object selection - either immediate, or asynchronous.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9801
     Returns nil, if async request is on its way.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9802
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9803
     Smalltalk puts ST_OBJECT only into the CLIPBOARD"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9804
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9805
    |selectionOwnerWindowId|
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9806
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9807
    selectionOwnerWindowId := self getSelectionOwnerOf:clipboardAtom.
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9808
    selectionOwnerWindowId isNil ifTrue:[
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9809
        ^ nil       "no selection"
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9810
    ].
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9811
    selectionOwnerWindowId == selectionOwner ifTrue:[
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9812
        "I still hold the selection, so return my locally buffered data"
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9813
        ^ copyBuffer
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9814
    ].
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9815
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9816
    self 
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9817
        requestSelection:clipboardAtom 
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9818
        property:(self atomIDOf:#'ST_SELECTION') 
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9819
        type:(self atomIDOf:#'ST_OBJECT') 
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9820
        for:drawableId.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9821
    ^ nil
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9822
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9823
    "Modified: / 17.6.1998 / 17:11:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9824
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9825
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9826
getTextSelection:selectionBufferSymbol for:drawableId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9827
    "get the text selection -  either immediate, or asynchronous.
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9828
     Returns nil, if async request is on its way 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9829
     or if no selection is available"
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9830
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9831
    |selectionId selectionOwnerWindowId|
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9832
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9833
    selectionBufferSymbol == #selection ifTrue:[
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9834
        selectionId := primaryAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9835
    ] ifFalse:[
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9836
        selectionId := clipboardAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9837
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9838
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9839
    selectionOwnerWindowId := self getSelectionOwnerOf:selectionId.
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9840
    selectionOwnerWindowId isNil ifTrue:[
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9841
        ^ nil       "no selection"
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9842
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9843
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9844
    selectionOwnerWindowId == selectionOwner ifTrue:[
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9845
        "I still hold the selection, so return my locally buffered data"
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9846
        ^ self selectionAsString.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9847
    ].
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9848
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9849
    self 
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9850
        requestSelection:selectionId 
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9851
        property:(self atomIDOf:#'VT_SELECTION') 
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9852
        type:(self atomIDOf:#'UTF8_STRING') "stringAtom"       
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  9853
        for:drawableId.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9854
    ^ nil.
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9855
!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9856
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9857
removeSelectionHandler:aHandler
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9858
    SelectionHandlers notNil ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9859
	SelectionHandlers remove:aHandler ifAbsent:nil.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9860
	SelectionHandlers isEmpty ifTrue:[
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9861
	    SelectionHandlers := nil
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9862
	]
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9863
    ].
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9864
!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9865
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9866
selectionAs:aTargetAtom
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9867
    "convert the current selection to the format defined by aTargetAtom.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9868
     Answer the converted selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9869
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9870
    |stream|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9871
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9872
    (aTargetAtom == (self atomIDOf:#STRING)) ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9873
	"the other view wants the selection as string"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9874
	^ self selectionAsString. 
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9875
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9876
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9877
    (aTargetAtom == (self atomIDOf:#TARGETS)) ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9878
	"the other view wants to know which targets we support"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9879
	^ self supportedTargetAtoms.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9880
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9881
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9882
    (aTargetAtom == (self atomIDOf:#'ST_OBJECT')) ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9883
	"send the selection in binaryStore format"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9884
	stream := WriteStream on:(ByteArray new:200).
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9885
	self getCopyBuffer storeBinaryOn:stream.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9886
	^ stream contents.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9887
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9888
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9889
    aTargetAtom == (self atomIDOf:#LENGTH) ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9890
	"the other one wants to know the size of our selection.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9891
	 LENGTH is deprecated, since we do not know how the selection is
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9892
	 going to be converted. The client must not rely on the length returned"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9893
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9894
	^ self selectionAsString size 
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9895
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9896
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9897
    "we do not support the requestet target"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9898
    ^ nil.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9899
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9900
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9901
sendSelection:something selection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9902
    "send the selection back from a SelectionRequest"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9903
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9904
    |property|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9905
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9906
    property := propertyID.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9907
    property == 0 ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9908
	"Support old (obsolete) clients requesting a None property.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9909
	 Set the propertyID to the targetID"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9910
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9911
	property := targetID.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9912
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9913
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9914
    self setProperty:property 
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9915
	 type:targetID 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9916
	 value:something 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9917
	 for:requestorID.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9918
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9919
    self sendSelectionNotifySelection:selectionID 
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9920
	 property:property 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9921
	 target:targetID
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9922
	 time:t 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9923
	 from:windowID 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9924
	 to:requestorID.
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9925
!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9926
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9927
setSelection:anObject owner:aWindowId
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9928
    "set the object selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9929
     This can be used by other Smalltalk(X) applications only.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9930
     We set only the CLIPBOARD selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9931
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9932
    ^ self setSelectionOwner:aWindowId of:clipboardAtom
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9933
!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9934
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9935
setTextSelection:aString owner:aWindowId
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9936
    "set the text selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9937
     This can be used by any other X application.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9938
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9939
     We set both the PRIMARY and CLIPBOARD, so that you can paste 
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9940
     into xterm."
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9941
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9942
    (self setSelectionOwner:aWindowId of:clipboardAtom) ifFalse:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  9943
	'XWorkstation [warning]: selection ownerchange failed' errorPrintCR.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9944
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9945
    self setSelectionOwner:aWindowId of:primaryAtom.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9946
    ^ true
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9947
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9948
    "Modified: / 17.6.1998 / 19:48:54 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9949
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9950
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9951
supportedTargetAtoms
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9952
    "answer an integer array containing the list of supported targets
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9953
     i.e. supported clipboard formats"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9954
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9955
    |supportedTargets numericTargetArray|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9956
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9957
    supportedTargets := #(ST_OBJECT STRING TARGETS LENGTH).
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9958
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9959
    numericTargetArray := IntegerArray new:supportedTargets size.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9960
    supportedTargets keysAndValuesDo:[:index :targetSymbol| 
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9961
	numericTargetArray at:index put:(self atomIDOf:targetSymbol)
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9962
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9963
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9964
    ^ numericTargetArray
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9965
! !
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9966
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9967
!XWorkstation methodsFor:'selections-basic'!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
  9968
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9969
getSelectionOwnerOf:selectionAtomSymbolOrID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9970
    "get the owner of a selection"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9971
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9972
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9973
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9974
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9975
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9976
    selectionAtomSymbolOrID isString ifTrue:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9977
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9978
    ] ifFalse:[
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9979
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9980
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9981
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9982
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9983
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9984
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9985
    if (__isAtomID(selectionAtomID) && ISCONNECTED) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9986
	Display *dpy = myDpy;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9987
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9988
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9989
	window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9990
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9991
	RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9992
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9993
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9994
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9995
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9996
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9997
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9998
requestSelection:selectionID property:propertyID type:typeID for:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9999
    "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
 10000
     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
 10001
     with the selections value)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10002
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10003
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10004
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10005
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10006
    Atom sel_prop;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10007
    char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10008
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 10009
    if ((__isExternalAddress(aWindowId) || (aWindowId == nil))
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10010
     && ISCONNECTED
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10011
     && __isAtomID(typeID)
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10012
     && __isAtomID(propertyID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10013
     && __isAtomID(selectionID)) {
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10014
        Display *dpy = myDpy;
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10015
        Window w;
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10016
        Window selectionOwner;
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10017
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10018
        if (__isExternalAddress(aWindowId)) {
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10019
            w = __WindowVal(aWindowId);
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10020
        } else {
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10021
            w = (Window)0;
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10022
        }
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10023
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10024
        ENTER_XLIB();
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10025
        XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID), 
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10026
                               __AtomVal(propertyID), w, CurrentTime);
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10027
        LEAVE_XLIB();
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10028
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10029
        RETURN (true);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10030
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10031
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10032
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10033
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10034
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10035
    "
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10036
     Display 
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10037
        requestSelection:(Display atomIDOf:'PRIMARY')
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10038
        property:(Display atomIDOf:'VT_SELECTION')
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10039
        type:(Display atomIDOf:'STRING')
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10040
        for:Transcript id
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10041
    "
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10042
    "
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10043
     Display 
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10044
        requestSelection:(Display atomIDOf:'PRIMARY')
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10045
        property:(Display atomIDOf:'VT_SELECTION')
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10046
        type:(Display atomIDOf:'C_STRING')
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10047
        for:Transcript id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10048
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10049
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10050
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10051
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
 10052
    "send a selectionNotify back from a SelectionRequest"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10053
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10054
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10055
%{  
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10056
    if (ISCONNECTED
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10057
	&& (__isAtomID(propertyID) || propertyID == nil)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10058
	&& __isAtomID(targetID) && __isAtomID(selectionID)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10059
	Display *dpy = myDpy;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10060
	XEvent ev;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10061
	Window requestor, originator;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10062
	Status result;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10063
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10064
	if (__isExternalAddress(requestorID)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10065
	    requestor = __WindowVal(requestorID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10066
	} else if (__isSmallInteger(requestorID)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10067
	    requestor = (Window)__smallIntegerVal(requestorID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10068
	} else if (requestorID == nil) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10069
	    requestor = DefaultRootWindow(dpy);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10070
	} else {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10071
	    requestor = (Window)__unsignedLongIntVal(requestorID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10072
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10073
	if (__isExternalAddress(windowID)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10074
	    originator = __WindowVal(windowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10075
	} else if (__isSmallInteger(windowID)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10076
	    originator = (Window)__smallIntegerVal(windowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10077
	} else if (windowID == nil) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10078
	    originator = DefaultRootWindow(dpy);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10079
	} else {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10080
	    originator = (Window)__unsignedLongIntVal(windowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10081
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10082
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10083
	ev.xselection.type = SelectionNotify;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10084
	ev.xselection.display = dpy;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10085
	ev.xselection.selection = __AtomVal(selectionID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10086
	ev.xselection.target = __AtomVal(targetID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10087
	ev.xselection.requestor = originator;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10088
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10089
	if (__isExternalAddress(t)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10090
	    ev.xselection.time = (INT)(__externalAddressVal(t));
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10091
	} else if (__isSmallInteger(t)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10092
	    ev.xselection.time = __smallIntegerVal(t);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10093
	} else if (t == nil) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10094
	    ev.xselection.time = CurrentTime;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10095
	} else {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10096
	    ev.xselection.time = (INT)__unsignedLongIntVal(t);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10097
	}
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
 10098
#if 0
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10099
	printf("ev.xselection.selection: %x\n", ev.xselection.selection);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10100
	printf("ev.xselection.target: %x\n", ev.xselection.target);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10101
	printf("ev.xselection.requestor: %x\n", ev.xselection.requestor);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10102
	printf("ev.xselection.time: %x\n", ev.xselection.time);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10103
	printf("requestor: %x\n", requestor);
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10104
#endif
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10105
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10106
	/* send nil property if selection cannot be converted */
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10107
	if (propertyID == nil)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10108
	    ev.xselection.property = None;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10109
	else 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10110
	    ev.xselection.property = __AtomVal(propertyID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10111
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10112
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10113
	DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n",
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10114
		ev.xselection.selection,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10115
		ev.xselection.property,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10116
		ev.xselection.target,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10117
		ev.xselection.requestor,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10118
		requestor));
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10119
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10120
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10121
	result = XSendEvent(dpy, requestor, False, 0 , &ev);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10122
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10123
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10124
	if ((result == BadValue) || (result == BadWindow)) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10125
	    DPRINTF(("bad status\n"));
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10126
	    RETURN (false);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10127
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10128
	ENTER_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10129
	XFlush(dpy);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10130
	LEAVE_XLIB();
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10131
	RETURN (true)
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10132
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10133
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10134
    self primitiveFailedOrClosedConnection.
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
 10135
    ^ false
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10136
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10137
    "Modified: / 17.6.1998 / 20:23:20 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10138
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10139
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10140
setSelectionOwner:aWindowId of:selectionAtomSymbolOrID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10141
    "set the owner of a selection; return false if failed"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10142
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10143
    <context: #return>
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10144
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10145
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10146
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10147
    "store the current owner of the selection.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10148
     If we still own the selection on paste,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10149
     we can avoid the X11 overhead"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10150
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10151
    selectionOwner := aWindowId.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10152
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10153
    selectionAtomSymbolOrID isString ifTrue:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10154
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10155
    ] ifFalse:[
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10156
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10157
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10158
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10159
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10160
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10161
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10162
    if (__isExternalAddress(aWindowId)
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10163
     && __isAtomID(selectionAtomID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10164
     && ISCONNECTED) {
3806
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10165
	Display *dpy = myDpy;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10166
	Window owner;
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10167
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10168
	win = __WindowVal(aWindowId);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10169
	DPRINTF(("setOwner prop=%x win=%x\n", __AtomVal(selectionAtomID), win));
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10170
	ENTER_XLIB();
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10171
	XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, CurrentTime);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10172
	owner = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10173
	LEAVE_XLIB();
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10174
	if (owner != win) {
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10175
	    RETURN (false);
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10176
	}
473cec2e5100 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
 10177
	RETURN (true);
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10178
    }
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10179
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10180
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10181
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10182
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10183
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10184
!XWorkstation methodsFor:'window stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10185
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10186
clearRectangleX:x y:y width:width height:height in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10187
    "clear a rectangular area to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10188
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10189
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10190
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10191
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10192
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10193
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10194
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10195
	if (__isExternalAddress(aWindowId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10196
	 && __bothSmallInteger(x, y)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10197
	 && __bothSmallInteger(width, height)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10198
	    w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10199
	    h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10200
	    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10201
	     * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10202
	     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10203
	    if ((w >= 0) && (h >= 0)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10204
		ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10205
		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
 10206
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10207
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10208
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10209
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10210
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10211
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10212
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10213
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10214
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10215
clearWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10216
    "clear a window to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10217
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10218
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10219
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10220
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10221
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10222
	if (__isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10223
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10224
	    XClearWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10225
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10226
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10227
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10228
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10229
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10230
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10231
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10232
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10233
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10234
    "configure stacking operation of aWindowId w.r.t siblingId"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10235
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10236
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10237
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10238
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10239
    XWindowChanges chg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10240
    int mask = CWSibling | CWStackMode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10241
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10242
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10243
	if (__isExternalAddress(aWindowId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10244
	 && __isExternalAddress(siblingId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10245
	    if (modeSymbol == @symbol(above)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10246
		chg.stack_mode = Above;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10247
	    } else if (modeSymbol == @symbol(below)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10248
		chg.stack_mode = Below;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10249
	    } else if (modeSymbol == @symbol(topIf)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10250
		chg.stack_mode = TopIf;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10251
	    } else if (modeSymbol == @symbol(bottomIf)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10252
		chg.stack_mode = BottomIf;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10253
	    } else if (modeSymbol == @symbol(opposite)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10254
		chg.stack_mode = Opposite;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10255
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10256
		mask = CWSibling;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10257
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10258
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10259
	    chg.sibling = __WindowVal(siblingId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10260
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10261
	    XConfigureWindow(myDpy, __WindowVal(aWindowId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10262
				    mask, &chg);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10263
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10264
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10265
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10266
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10267
bad: ;
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10268
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10269
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10270
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10271
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10272
getGeometryOf:aWindowId
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10273
    "get a windows geometry. 
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10274
     NOTICE: X-WindowManagers usually do wrap client topViews into their own 
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10275
     decoration views (top label, resize boundaries etc.).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10276
     Thus, the numbers returned here for topViews are the physical (real) dimensions
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10277
     relative to such a wrapper.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10278
     In contrast, the values found in the views instance variables are virtual dimensions
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10279
     (i.e. ST/X makes this decoration view transparent to the program."
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10280
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10281
    <context: #return>
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10282
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10283
    |x y width height depth borderWidth info|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10284
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10285
%{  
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10286
    int x_ret, y_ret;
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10287
    unsigned int width_ret, height_ret, 
4024
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10288
                 border_width_ret, depth_ret;
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10289
    Window root_ret;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10290
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10291
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10292
     && __isExternalAddress(aWindowId)) {
4024
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10293
        ENTER_XLIB();
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10294
        XGetGeometry(myDpy, __WindowVal(aWindowId), 
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10295
                     &root_ret, 
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10296
                     &x_ret, &y_ret, 
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10297
                     &width_ret, &height_ret, &border_width_ret,
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10298
                     &depth_ret);
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10299
        LEAVE_XLIB();
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10300
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10301
        x = __MKSMALLINT(x_ret);
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10302
        y = __MKSMALLINT(y_ret);
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10303
        width = __MKSMALLINT(width_ret);
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10304
        height = __MKSMALLINT(height_ret);
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10305
        depth = __MKSMALLINT(depth_ret);
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10306
        borderWidth = __MKSMALLINT(border_width_ret);
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10307
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10308
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10309
    borderWidth isNil ifTrue:[
4024
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10310
        self primitiveFailedOrClosedConnection.
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10311
        ^ nil
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10312
    ].
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10313
    info := Dictionary new.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10314
    info at:#origin put:(x @ y).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10315
    info at:#extent put:(width @ height).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10316
    info at:#depth  put:depth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10317
    info at:#borderWidth put:borderWidth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10318
    ^ info
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10319
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10320
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10321
     Transcript topView device
4024
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10322
        getGeometryOf:(Transcript id)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10323
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10324
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10325
     Transcript topView device
4024
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10326
        getGeometryOf:(Transcript topView id)
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10327
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10328
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10329
     Display
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 10330
        getGeometryOf:(Display viewIdFromUser)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10331
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10332
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10333
     |d|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10334
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10335
     d := Transcript topView device.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10336
     d getGeometryOf:(d parentWindowIdOf:Transcript topView id)
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10337
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10338
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10339
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10340
isValidWindowId:aWindowId
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10341
    "return true, if the given window ID is (still) valid.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10342
     Especially useful, if the passed windowID is 
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10343
     an alien (external) windows id."
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10344
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10345
    |ret|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10346
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10347
%{ 
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10348
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10349
    if (ISCONNECTED
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10350
     && __isExternalAddress(aWindowId)) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10351
	char *name = NULL;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10352
	Status ok;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10353
	Window root, parent, *children = NULL;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10354
	int nChildren;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10355
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10356
/*        ENTER_XLIB(); */
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10357
	ok = XQueryTree(myDpy, __WindowVal(aWindowId), 
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10358
			&root, &parent, &children, &nChildren);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10359
	if (children) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10360
	    XFree(children);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10361
	}
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10362
/*        LEAVE_XLIB();   */
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10363
	if (ok) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10364
	    RETURN (true);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10365
	}
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10366
	RETURN (false);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10367
    }
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10368
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10369
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10370
    ^ false
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10371
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10372
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10373
     |v aWindowId ok|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10374
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10375
     v := StandardSystemView new.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10376
     v label:'hello'.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10377
     v openAndWait.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10378
     aWindowId := v id.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10379
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10380
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10381
     Delay waitForSeconds:1.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10382
     v destroy.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10383
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10384
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10385
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10386
!
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 10387
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10388
lowerWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10389
    "bring a window to back"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10390
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10391
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10392
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10393
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10394
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10395
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10396
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10397
	XLowerWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10398
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10399
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10400
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10401
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10402
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10403
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10404
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10405
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
 10406
	      width:w height:h minExtent:minExt maxExtent:maxExt
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10407
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10408
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10409
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10410
    "make a window visible - either as icon or as a real view 
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10411
     in addition, allow change of extend, position, minExtend and maxExtent.
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10412
     Needed for restart, to allow recreating a view as iconified,
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 10413
     and to collaps/expand windows."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10414
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10415
    |wicon wiconId wiconView wiconViewId wlabel minW minH maxW maxH|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10416
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10417
    aBoolean ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10418
	wicon := aView icon.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10419
	wicon notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10420
	    wiconId := wicon id
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10421
	].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10422
	wiconView := aView iconView.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10423
	wiconView notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10424
	    wiconViewId := wiconView id
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10425
	].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10426
	wlabel := aView label.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10427
    ].
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10428
    minExt notNil ifTrue:[
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10429
	minW := minExt x.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10430
	minH := minExt y.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10431
    ].
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10432
    maxExt notNil ifTrue:[
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10433
	maxW := maxExt x.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10434
	maxH := maxExt y.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 10435
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10436
%{  
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10437
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10438
    XWMHints wmhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10439
    XSizeHints szhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10440
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10441
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10442
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10443
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10444
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10445
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10446
	win = __WindowVal(aWindowId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10447
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10448
	szhints.flags = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10449
	if (__bothSmallInteger(xPos, yPos)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10450
	    szhints.x = __intVal(xPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10451
	    szhints.y = __intVal(yPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10452
	    szhints.flags |= USPosition;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10453
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10454
	if (__bothSmallInteger(w, h)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10455
	    szhints.width = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10456
	    szhints.height = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10457
	    szhints.flags |= USSize;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10458
	}
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10459
	if (__bothSmallInteger(minW, minH)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10460
	    szhints.flags |= PMinSize;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10461
	    szhints.min_width = __intVal(minW);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10462
	    szhints.min_height = __intVal(minH);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10463
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10464
	if (__bothSmallInteger(maxW, maxH)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10465
	    szhints.flags |= PMaxSize;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10466
	    szhints.max_width = __intVal(maxW);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10467
	    szhints.max_height = __intVal(maxH);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10468
	}
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10469
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10470
	if (aBoolean == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10471
	    char *windowName;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10472
	    Pixmap iconBitmap = (Pixmap)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10473
	    Window iconWindow;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10474
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10475
	    if (__isExternalAddress(wiconId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10476
		iconBitmap = __PixmapVal(wiconId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10477
	    else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10478
		iconBitmap = (Pixmap)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10479
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10480
	    if (__isExternalAddress(wiconViewId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10481
		iconWindow = __WindowVal(wiconViewId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10482
	    else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10483
		iconWindow = (Window)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10484
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10485
	    if (__isString(wlabel) || __isSymbol(wlabel))
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
 10486
		windowName = (char *) __stringVal(wlabel);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10487
	    else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10488
		windowName = "";
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10489
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10490
	    if (iconBitmap || windowName) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10491
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10492
		XSetStandardProperties(dpy, win,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10493
					windowName, windowName,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10494
					iconBitmap,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10495
					0, 0, &szhints);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
 10496
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10497
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10498
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10499
	    wmhints.flags = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10500
	    if (iconBitmap) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10501
		wmhints.flags |= IconPixmapHint;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10502
		wmhints.icon_pixmap = iconBitmap;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10503
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10504
	    if (iconWindow) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10505
		wmhints.flags |= IconWindowHint;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10506
		wmhints.icon_window = iconWindow;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10507
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10508
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10509
	    wmhints.initial_state = IconicState;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10510
	    wmhints.flags |= StateHint;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10511
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10512
	    XSetWMHints(dpy, win, &wmhints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10513
	    LEAVE_XLIB();
1344
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
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10516
	if (szhints.flags) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10517
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10518
	    XSetNormalHints(dpy, win, &szhints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10519
	    LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10520
	}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10521
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10522
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10523
	XMapWindow(dpy, win);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10524
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10525
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10526
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10527
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10528
    self primitiveFailedOrClosedConnection
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10531
mapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10532
    "make a window visible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10533
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10534
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10535
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10536
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10537
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10538
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10539
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10540
	XMapWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10541
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10542
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10543
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10544
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10545
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10546
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10547
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10548
moveResizeWindow:aWindowId x:x y:y width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10549
    "move and resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10550
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10551
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10552
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10553
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10554
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10555
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10556
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10557
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10558
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10559
     && __bothSmallInteger(x, y)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10560
	newWidth = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10561
	newHeight = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10562
	if (newWidth < 1) newWidth = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10563
	if (newHeight < 1) newHeight = 1;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10564
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10565
	XMoveResizeWindow(myDpy, __WindowVal(aWindowId),
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10566
			      __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10567
			      newWidth, newHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10568
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10569
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10570
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10571
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10572
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10573
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10574
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10575
moveWindow:aWindowId x:x y:y
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10576
    "move a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10577
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10578
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10579
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10580
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10581
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10582
     && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10583
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10584
	XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10585
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10586
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10587
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10588
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10589
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10590
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10591
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10592
parentWindowIdOf:aWindowId
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10593
    "return a windows parent-window id.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10594
     Useful with getGeometryOf:, to compute information about the decoration."
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10595
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10596
%{ 
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10597
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10598
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10599
     && __isExternalAddress(aWindowId)) {
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10600
	Status ok;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10601
	Window root, parent, *children = NULL;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10602
	int nChildren;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10603
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10604
/*        ENTER_XLIB(); */
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10605
	ok = XQueryTree(myDpy, __WindowVal(aWindowId), 
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10606
			&root, &parent, &children, &nChildren);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10607
	if (children) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10608
	    XFree(children);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10609
	}
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10610
/*        LEAVE_XLIB();   */
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10611
	if (! ok) {
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10612
	    RETURN ( nil );
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10613
	}
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10614
	RETURN ( __MKEXTERNALADDRESS(parent) );
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10615
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10616
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10617
    self primitiveFailedOrClosedConnection.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10618
    ^ false
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10619
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10620
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10621
     |id|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10622
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10623
     id := Transcript device parentWindowIdOf:(Transcript id).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10624
     self assert: ( Transcript container id = id ).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10625
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10626
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 10627
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10628
raiseWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10629
    "bring a window to front"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10630
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10631
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10632
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10633
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10634
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10635
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10636
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10637
	XRaiseWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10638
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10639
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10640
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10641
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10642
    self primitiveFailedOrClosedConnection
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10643
!
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10644
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10645
reparentWindow:windowId to:newParentWindowId
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10646
    "change a windows parent (an optional interface)"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10647
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10648
    <context: #return>
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10649
%{
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10650
    if (ISCONNECTED
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10651
     && __isExternalAddress(windowId)
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10652
     && __isExternalAddress(newParentWindowId)) {
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10653
	Display *dpy = myDpy;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10654
	Window _child, _newParent;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10655
	int i;
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10656
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10657
	_child = __WindowVal(windowId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10658
	_newParent = __WindowVal(newParentWindowId);
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10659
	ENTER_XLIB();
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10660
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 10661
#if 0
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10662
	XWithdrawWindow (dpy, _child, DefaultScreen(dpy));
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10663
	XSync (dpy, 0);
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 10664
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10665
	/*
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10666
	 * Code 'stolen' from xswallow source ...
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10667
	 * ... mhmh - what is this loop for ?
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10668
	 */
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10669
	for (i=0; i<5; i++) {
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10670
	    XReparentWindow (dpy, _child, _newParent, 0, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10671
	    XSync (dpy, 0);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10672
	}
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 10673
#if 0
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10674
	XMapWindow (dpy, _child);
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10675
	XSync (dpy, 0);
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 10676
#endif
3222
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10677
	LEAVE_XLIB();
0bb571e07c0e moved screen instance variable
Claus Gittinger <cg@exept.de>
parents: 3220
diff changeset
 10678
	RETURN ( true );
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10679
    }
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10680
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10681
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10682
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10683
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10684
resizeWindow:aWindowId width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10685
    "resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10686
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10687
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10688
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10689
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10690
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10691
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10692
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10693
     && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10694
	newWidth = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10695
	newHeight = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10696
	if (newWidth < 1) newWidth = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10697
	if (newHeight < 1) newHeight = 1;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10698
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10699
	XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10700
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10701
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10702
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10703
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10704
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10705
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10706
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10707
setBackingStore:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10708
    "turn on/off backing-store for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10709
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10710
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10711
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10712
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10713
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10714
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10715
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10716
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10717
	if (__INST(ignoreBackingStore) != true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10718
	    if (how == @symbol(always)) wa.backing_store = Always;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10719
	    else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10720
	    else if (how == true) wa.backing_store = Always;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10721
	    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
 10722
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10723
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10724
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10725
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10726
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10727
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10728
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10729
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
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
setBitGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10735
    "set bit gravity for a window"
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10740
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10741
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10742
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10743
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10744
	if (how == @symbol(NorthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10745
	    wa.bit_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10746
	} else if (how == @symbol(NorthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10747
	    wa.bit_gravity = NorthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10748
	} else if (how == @symbol(SouthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10749
	    wa.bit_gravity = SouthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10750
	} else if (how == @symbol(SouthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10751
	    wa.bit_gravity = SouthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10752
	} else if (how == @symbol(Center)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10753
	    wa.bit_gravity = CenterGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10754
	} else if (how == @symbol(North)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10755
	    wa.bit_gravity = NorthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10756
	} else if (how == @symbol(South)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10757
	    wa.bit_gravity = SouthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10758
	} else if (how == @symbol(West)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10759
	    wa.bit_gravity = WestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10760
	} else if (how == @symbol(East)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10761
	    wa.bit_gravity = EastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10762
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10763
	    wa.bit_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10764
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10765
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10766
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10767
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10768
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10769
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10770
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10771
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10772
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10773
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10774
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10775
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10776
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10777
setCursor:aCursorId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10778
    "define a windows cursor"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10779
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10780
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10781
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10782
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10783
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10784
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10785
     && __isExternalAddress(aCursorId)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10786
	Display *dpy = myDpy;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10787
	Window w = __WindowVal(aWindowId);
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10788
	Cursor c = __CursorVal(aCursorId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10789
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10790
	if (w && c) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10791
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10792
	    XDefineCursor(dpy, w, c);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10793
	    LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10794
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10795
	RETURN ( self );
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10796
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10797
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10798
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10799
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10800
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10801
setIconName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10802
    "define a windows iconname"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10803
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10804
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10805
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10806
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10807
    if (ISCONNECTED
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10808
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10809
     && (__qIsString(aString) || __qIsSymbol(aString))
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10810
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10811
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10812
	XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10813
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10814
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10815
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10816
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10817
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10818
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10819
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10820
setSaveUnder:yesOrNo in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10821
    "turn on/off save-under for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10822
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10823
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10824
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10825
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10826
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10827
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10828
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10829
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10830
	if (__INST(hasSaveUnder) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10831
	    wa.save_under = (yesOrNo == true) ? 1 : 0;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10832
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10833
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10834
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10835
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10836
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10837
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10838
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10839
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10840
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10841
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10842
setTransient:aWindowId for:aMainWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10843
    "set aWindowId to be a transient of aMainWindow"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10844
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10845
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10846
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10847
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10848
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10849
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10850
	Window w;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10851
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10852
	if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10853
	    w = (Window) 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10854
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10855
	    if (__isExternalAddress(aMainWindowId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10856
		w = __WindowVal(aMainWindowId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10857
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10858
		goto getOutOfHere;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10859
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10860
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10861
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10862
	XSetTransientForHint(myDpy, __WindowVal(aWindowId), w);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10863
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10864
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10865
    }
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
 10866
 getOutOfHere: ;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10867
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10868
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10869
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10870
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10871
setWindowBackground:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10872
    "set the windows background color. This is the color with which
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10873
     the view is filled whenever exposed. Do not confuse this with
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10874
     the background drawing color, which is used with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10875
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10876
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10877
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10878
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10879
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10880
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10881
     && __isSmallInteger(aColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10882
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10883
	XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10884
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10885
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10886
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10887
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10888
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10889
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10890
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10891
setWindowBackgroundPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10892
    "set the windows background pattern to be a form.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10893
     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
 10894
     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
 10895
     with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10896
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10897
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10898
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10899
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10900
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10901
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10902
     && __isExternalAddress(aPixmapId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10903
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10904
	XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10905
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10906
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10907
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10908
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10909
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10910
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10911
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10912
setWindowBorderColor:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10913
    "set the windows border color"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10914
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10915
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10916
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10917
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10918
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10919
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10920
     && __isSmallInteger(aColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10921
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10922
	XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10923
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10924
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10925
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10926
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10927
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10928
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10929
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10930
setWindowBorderPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10931
    "set the windows border pattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10932
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10933
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10934
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10935
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10936
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10937
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10938
     && __isExternalAddress(aPixmapId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10939
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10940
	XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10941
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10942
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10943
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 10944
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10945
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10946
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10947
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10948
setWindowBorderShape:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10949
    "set the windows border shape"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10950
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10951
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10952
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10953
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10954
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10955
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10956
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10957
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10958
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10959
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10960
    if (__isExternalAddress(aPixmapId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10961
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10962
    else
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10963
	shapeBitmap = (Pixmap)0;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10964
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10965
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10966
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10967
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10968
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding,
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10969
			  0, 0, shapeBitmap, ShapeSet);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10970
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10971
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10972
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10973
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10974
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10975
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10976
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10977
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10978
setWindowBorderWidth:aNumber in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10979
    "set the windows border width"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10980
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10981
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10982
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10983
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10984
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10985
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10986
     && __isSmallInteger(aNumber)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10987
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10988
	XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10989
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10990
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10991
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10992
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10993
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10994
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10995
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10996
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
 10997
    "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
 10998
     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
 10999
     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
 11000
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11001
    <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
 11002
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11003
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11004
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11005
	XClassHint classhint;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11006
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11007
	classhint.res_class = classhint.res_name = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11008
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11009
	if (__isString(wClass) || __isSymbol(wClass)) {
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
 11010
	    classhint.res_class = (char *) __stringVal(wClass);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11011
	} else if (wClass != nil)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11012
	    goto error;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11013
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11014
	if (__isString(wName) || __isSymbol(wName)) {
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
 11015
	    classhint.res_name = (char *) __stringVal(wName);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11016
	} else if (wName != nil)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11017
	    goto error;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11018
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11019
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11020
	XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11021
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11022
	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
 11023
error:;
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11024
    }
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11025
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11026
    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
 11027
!
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11028
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11029
setWindowGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11030
    "set window gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11031
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11032
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11033
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11034
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11035
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11036
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11037
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11038
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11039
	if (how == @symbol(NorthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11040
	    wa.win_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11041
	} else if (how == @symbol(NorthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11042
	    wa.win_gravity = NorthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11043
	} else if (how == @symbol(SouthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11044
	    wa.win_gravity = SouthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11045
	} else if (how == @symbol(SouthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11046
	    wa.win_gravity = SouthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11047
	} else if (how == @symbol(Center)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11048
	    wa.win_gravity = CenterGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11049
	} else if (how == @symbol(North)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11050
	    wa.win_gravity = NorthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11051
	} else if (how == @symbol(South)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11052
	    wa.win_gravity = SouthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11053
	} else if (how == @symbol(West)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11054
	    wa.win_gravity = WestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11055
	} else if (how == @symbol(East)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11056
	    wa.win_gravity = EastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11057
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11058
	    wa.win_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11059
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11060
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11061
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11062
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11063
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11064
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11065
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11066
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11067
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11068
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11069
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11070
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11071
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11072
setWindowIcon:aForm in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11073
    "define a bitmap to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11074
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11075
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11076
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11077
    |iconId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11078
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11079
    aForm notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11080
	iconId := aForm id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11081
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11082
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11083
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11084
     && __isExternalAddress(iconId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11085
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11086
	XWMHints hints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11087
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11088
	hints.icon_pixmap = __PixmapVal(iconId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11089
	hints.flags = IconPixmapHint;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11090
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11091
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11092
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11093
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11094
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
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
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11099
setWindowIcon:aForm mask:aMaskForm in:aWindowId
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11100
    "define a windows icon and (optional) iconMask."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
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
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11104
    |iconId maskId|
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11105
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11106
    aForm notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11107
	iconId := aForm id
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11108
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11109
    aMaskForm notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11110
	maskId := aMaskForm id.
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11111
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11112
%{
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11113
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11114
     && __isExternalAddress(iconId)
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11115
     && __isExternalAddress(aWindowId)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11116
	XWMHints hints;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11117
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11118
	hints.icon_pixmap = __PixmapVal(iconId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11119
	hints.flags = IconPixmapHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11120
	if ((maskId != nil)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11121
	 && __isExternalAddress(maskId)) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11122
	    hints.icon_mask = __PixmapVal(maskId);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11123
	    hints.flags |= IconMaskHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11124
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11125
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11126
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11127
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11128
	RETURN ( self );
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11129
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11130
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11131
    self primitiveFailedOrClosedConnection
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11132
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11133
!
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11134
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11135
setWindowIconWindow:aView in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11136
    "define a window to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11137
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11138
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11139
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11140
    |iconWindowId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11141
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11142
    aView notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11143
	iconWindowId := aView id
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
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11146
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11147
     && __isExternalAddress(iconWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11148
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11149
	XWMHints wmhints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11150
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11151
	wmhints.icon_window = __WindowVal(iconWindowId);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11152
	wmhints.flags = IconWindowHint;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11153
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11154
	XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11155
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11156
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11157
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11158
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11159
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11160
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11161
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
 11162
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
 11163
    "set a windows minimum & max extents.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11164
     nil arguments are ignored."
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11165
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11166
    <context: #return>
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11167
%{  
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11168
    if (ISCONNECTED
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11169
     && __isExternalAddress(aWindowId)) {
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11170
	Display *dpy = myDpy;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11171
	XSizeHints szhints;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11172
	Window win;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11173
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11174
	win = __WindowVal(aWindowId);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11175
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11176
	szhints.flags = 0;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11177
	if (__bothSmallInteger(minW, minH)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11178
	    szhints.flags |= PMinSize;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11179
	    szhints.min_width = __intVal(minW);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11180
	    szhints.min_height = __intVal(minH);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11181
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11182
	if (__bothSmallInteger(maxW, maxH)) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11183
	    szhints.flags |= PMaxSize;
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11184
	    szhints.max_width = __intVal(maxW);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11185
	    szhints.max_height = __intVal(maxH);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11186
	}
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11187
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11188
	if (szhints.flags) {
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11189
	    ENTER_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11190
	    XSetNormalHints(dpy, win, &szhints);
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11191
	    LEAVE_XLIB();
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11192
	}
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11193
    }
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11194
%}.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11195
!
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11196
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11197
setWindowName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11198
    "define a windows name"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11199
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11200
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11201
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11202
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11203
    if (ISCONNECTED
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11204
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11205
     && (__qIsString(aString) || __qIsSymbol(aString))
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11206
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11207
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11208
	XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11209
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11210
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11211
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11212
%}.
3303
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
setWindowShape:aPixmapId in:aWindowId
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11217
    "set the windows shape.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11218
     Returns false, if the display does not support the
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 11219
     X shape extension."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11220
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11221
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11222
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11223
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11224
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11225
%{ 
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11226
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11227
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11228
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11229
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11230
    if (__isExternalAddress(aPixmapId))
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11231
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11232
    else
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11233
	shapeBitmap = (Pixmap)0;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11234
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11235
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11236
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11237
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11238
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip,
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11239
			  0, 0,
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11240
			  shapeBitmap, ShapeSet);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11241
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11242
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11243
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11244
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11245
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11246
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11247
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11248
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11249
unmapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11250
    "make a window invisible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11251
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11252
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11253
%{  
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11254
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 11255
    if (!ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11256
	RETURN ( self );
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 11257
    }
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 11258
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 11259
    if (__isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11260
	ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11261
	XUnmapWindow(myDpy, __WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11262
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11263
	RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11264
    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11265
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11266
    self primitiveFailedOrClosedConnection
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11267
!
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11268
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11269
windowIsIconified:aWindowId
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11270
    "return true, if some window is iconified.
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11271
     The passed windowID may be an alien windows id."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11272
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11273
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11274
%{  
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11275
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11276
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11277
     && __isExternalAddress(aWindowId)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11278
	Atom JunkAtom;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11279
	int JunkInt;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11280
	unsigned long WinState,JunkLong;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11281
	unsigned char *Property;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11282
	Atom WM_STATE_Atom;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11283
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11284
	if (__INST(wmStateAtom) != nil) {
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11285
	    WM_STATE_Atom = __AtomVal(__INST(wmStateAtom));
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11286
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11287
	    ENTER_XLIB();
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11288
	    XGetWindowProperty(myDpy, __WindowVal(aWindowId),
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11289
			       WM_STATE_Atom,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11290
			       0L, 2L, False, AnyPropertyType,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11291
			       &JunkAtom,&JunkInt,&WinState,&JunkLong,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11292
			       &Property);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 11293
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11294
	    WinState=(unsigned long)(*((long*)Property));
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11295
	    if (WinState==3) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11296
		RETURN (true);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11297
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11298
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 11299
	RETURN (false);
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11300
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11301
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11302
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11303
    ^ false "/ or true or what ?
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
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
 11306
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11307
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11308
version
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
 11309
    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.450 2004-03-05 11:12:16 cg Exp $'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11310
! !
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 11311
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11312
XWorkstation initialize!