11 " |
11 " |
12 |
12 |
13 DeviceWorkstation subclass:#XWorkstation |
13 DeviceWorkstation subclass:#XWorkstation |
14 instanceVariableNames:'screen |
14 instanceVariableNames:'screen |
15 hasShapeExtension hasFaxExtension hasShmExtension |
15 hasShapeExtension hasFaxExtension hasShmExtension |
16 hasDPSExtension hasSaveUnder ignoreBackingStore |
16 hasDPSExtension hasMbufExtension hasXVideoExtension |
|
17 hasSaveUnder ignoreBackingStore |
17 blackpixel whitepixel redMask greenMask blueMask |
18 blackpixel whitepixel redMask greenMask blueMask |
18 protocolsAtom deleteWindowAtom saveYourselfAtom |
19 protocolsAtom deleteWindowAtom saveYourselfAtom |
19 quitAppAtom |
20 quitAppAtom |
20 primaryAtom secondaryAtom cutBuffer0Atom |
21 primaryAtom secondaryAtom cutBuffer0Atom |
21 stringAtom lengthAtom |
22 stringAtom lengthAtom |
22 listOfXFonts buttonsPressed |
23 listOfXFonts buttonsPressed |
23 eventRootX eventRootY |
24 eventRootX eventRootY |
24 displayName eventTrace |
25 displayName eventTrace |
25 dispatchingExpose |
26 dispatchingExpose |
26 rgbVisual virtualRootId |
27 rgbVisual virtualRootId rootId |
27 eventBuffer' |
28 eventBuffer' |
28 classVariableNames: '' |
29 classVariableNames: '' |
29 poolDictionaries:'' |
30 poolDictionaries:'' |
30 category:'Interface-Graphics' |
31 category:'Interface-Graphics' |
31 ! |
32 ! |
32 |
33 |
33 XWorkstation comment:' |
34 XWorkstation comment:' |
34 COPYRIGHT (c) 1989 by Claus Gittinger |
35 COPYRIGHT (c) 1989 by Claus Gittinger |
35 All Rights Reserved |
36 All Rights Reserved |
36 |
37 |
37 $Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.45 1995-05-18 15:40:16 claus Exp $ |
38 $Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.46 1995-06-04 16:38:31 claus Exp $ |
38 '! |
39 '! |
39 |
40 |
40 !XWorkstation class methodsFor:'documentation'! |
41 !XWorkstation class methodsFor:'documentation'! |
41 |
42 |
42 copyright |
43 copyright |
67 simultanously. However, the default setup is for one display only. |
68 simultanously. However, the default setup is for one display only. |
68 To support multiple displays, you will have to start another event dispatcher |
69 To support multiple displays, you will have to start another event dispatcher |
69 process for the other display(s) and create the other views with a slightly |
70 process for the other display(s) and create the other views with a slightly |
70 different protocol. However, 'normal' applications do not have to care for |
71 different protocol. However, 'normal' applications do not have to care for |
71 all of this ... |
72 all of this ... |
|
73 |
|
74 See more documentation in my superclass, DeviceWorkstation. |
72 " |
75 " |
73 ! ! |
76 ! ! |
74 |
77 |
75 !XWorkstation primitiveDefinitions! |
78 !XWorkstation primitiveDefinitions! |
76 |
79 |
86 |
89 |
87 #include <stdio.h> |
90 #include <stdio.h> |
88 #include <X11/Xlib.h> |
91 #include <X11/Xlib.h> |
89 #include <X11/Xutil.h> |
92 #include <X11/Xutil.h> |
90 #include <X11/Xatom.h> |
93 #include <X11/Xatom.h> |
|
94 |
|
95 #define XK_MISCELLANY |
|
96 #include <X11/keysymdef.h> |
91 |
97 |
92 /* |
98 /* |
93 * this define adds support for two-byte-strings. |
99 * this define adds support for two-byte-strings. |
94 * leaving it undefined does not really save you much |
100 * leaving it undefined does not really save you much |
95 * (the define will vanish) |
101 * (the define will vanish) |
103 #ifdef SHAPE |
109 #ifdef SHAPE |
104 # include <X11/extensions/shape.h> |
110 # include <X11/extensions/shape.h> |
105 #endif |
111 #endif |
106 |
112 |
107 /* |
113 /* |
108 * shared memory extension currently not supported |
114 * shared memory extension access is currently not supported |
109 * (only query is implemented) |
115 * (only query is implemented) |
110 */ |
116 */ |
111 #ifdef SHM |
117 #ifdef SHM |
112 # include <X11/extensions/XShm.h> |
118 # include <X11/extensions/XShm.h> |
|
119 #endif |
|
120 |
|
121 /* |
|
122 * multiBuffer extension access is currently not supported |
|
123 * (only query is implemented) |
|
124 */ |
|
125 #ifdef MBUF |
|
126 # include <X11/extensions/multibuf.h> |
|
127 #endif |
|
128 |
|
129 /* |
|
130 * XVideo extension access is currently not supported |
|
131 * (only query is implemented) |
|
132 */ |
|
133 #ifdef XVIDEO |
|
134 # include <X11/extensions/Xv.h> |
113 #endif |
135 #endif |
114 |
136 |
115 /* |
137 /* |
116 * this is a non-standard fax-image decompression extension |
138 * this is a non-standard fax-image decompression extension |
117 * (only found in megascan servers ported by myself) |
139 * (only found in megascan servers ported by myself) |
163 #define _FontVal(o) (XFontStruct *)(MKCP(o)) |
185 #define _FontVal(o) (XFontStruct *)(MKCP(o)) |
164 #define _AtomVal(o) (Atom)(MKCP(o)) |
186 #define _AtomVal(o) (Atom)(MKCP(o)) |
165 #define _DPSContextVal(o) (DPSContext)(MKCP(o)) |
187 #define _DPSContextVal(o) (DPSContext)(MKCP(o)) |
166 |
188 |
167 #define myDpy _DisplayVal(_INST(displayId)) |
189 #define myDpy _DisplayVal(_INST(displayId)) |
|
190 #define ISCONNECTED (_INST(displayId) != nil) |
168 |
191 |
169 #ifndef THISCONTEXT_IN_REGISTER |
192 #ifndef THISCONTEXT_IN_REGISTER |
170 # define BLOCKINTERRUPTS() /* */ |
193 # define BLOCKINTERRUPTS() /* */ |
171 # define UNBLOCKINTERRUPTS() /* */ |
194 # define UNBLOCKINTERRUPTS() /* */ |
172 # define BEGIN_INTERRUPTSBLOCKED /* */ |
195 # define BEGIN_INTERRUPTSBLOCKED /* */ |
178 int needUnblock = 0; \ |
201 int needUnblock = 0; \ |
179 extern OBJ __thisContext__; \ |
202 extern OBJ __thisContext__; \ |
180 \ |
203 \ |
181 __thisContext__ = __thisContext;\ |
204 __thisContext__ = __thisContext;\ |
182 if (!__interruptsBlocked) { \ |
205 if (!__interruptsBlocked) { \ |
183 BLOCKINTERRUPTS(); \ |
206 __BLOCKINTERRUPTS(); \ |
184 needUnblock = 1; \ |
207 needUnblock = 1; \ |
185 } |
208 } |
186 |
209 |
187 # define END_INTERRUPTSBLOCKED \ |
210 # define END_INTERRUPTSBLOCKED \ |
188 if (needUnblock) { \ |
211 if (needUnblock) { \ |
189 UNBLOCKINTERRUPTS(); \ |
212 __UNBLOCKINTERRUPTS(); \ |
190 } \ |
213 } \ |
191 __thisContext__ = 0; \ |
214 __thisContext__ = 0; \ |
192 } |
215 } |
193 |
216 |
194 #endif |
217 #endif |
420 #ifdef SHAPE |
443 #ifdef SHAPE |
421 if (XShapeQueryExtension(dpy, &shapeEventBase, &shapeErrorBase)) |
444 if (XShapeQueryExtension(dpy, &shapeEventBase, &shapeErrorBase)) |
422 _INST(hasShapeExtension) = true; |
445 _INST(hasShapeExtension) = true; |
423 else |
446 else |
424 #endif |
447 #endif |
425 _INST(hasShapeExtension) = false; |
448 _INST(hasShapeExtension) = false; |
426 |
449 |
427 #ifdef SHM |
450 #ifdef SHM |
428 if (XShmQueryExtension(dpy, &shmEventBase, &shmErrorBase)) |
451 if (XShmQueryExtension(dpy, &shmEventBase, &shmErrorBase)) |
429 _INST(hasShmExtension) = true; |
452 _INST(hasShmExtension) = true; |
430 else |
453 else |
431 #endif |
454 #endif |
432 _INST(hasShmExtension) = false; |
455 _INST(hasShmExtension) = false; |
433 |
456 |
434 #ifdef FAX |
457 #ifdef FAX |
435 if (XFAXImageQueryExtension(dpy, &faxEventBase, &faxErrorBase)) |
458 if (XFAXImageQueryExtension(dpy, &faxEventBase, &faxErrorBase)) |
436 _INST(hasFaxExtension) = true; |
459 _INST(hasFaxExtension) = true; |
437 else |
460 else |
438 #endif |
461 #endif |
439 _INST(hasFaxExtension) = false; |
462 _INST(hasFaxExtension) = false; |
440 |
463 |
441 #ifdef DPS |
464 #ifdef DPS |
442 if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) |
465 if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) |
443 _INST(hasDPSExtension) = true; |
466 _INST(hasDPSExtension) = true; |
444 else |
467 else |
445 #endif |
468 #endif |
446 _INST(hasDPSExtension) = false; |
469 _INST(hasDPSExtension) = false; |
|
470 |
|
471 #ifdef XVIDEO |
|
472 if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) |
|
473 _INST(hasXVideoExtension) = true; |
|
474 else |
|
475 #endif |
|
476 _INST(hasXVideoExtension) = false; |
|
477 |
|
478 #ifdef MBUF |
|
479 if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) |
|
480 _INST(hasMbufExtension) = true; |
|
481 else |
|
482 #endif |
|
483 _INST(hasMbufExtension) = false; |
447 |
484 |
448 /* |
485 /* |
449 * look for RGB visual |
486 * look for RGB visual |
450 */ |
487 */ |
451 nvi = 0; |
488 nvi = 0; |
611 close |
650 close |
612 "close down the connection to the X-server" |
651 "close down the connection to the X-server" |
613 |
652 |
614 %{ /* NOCONTEXT */ |
653 %{ /* NOCONTEXT */ |
615 |
654 |
616 if (_INST(displayId) != nil) { |
655 if (ISCONNECTED) { |
617 BEGIN_INTERRUPTSBLOCKED |
656 BEGIN_INTERRUPTSBLOCKED |
618 XCloseDisplay(myDpy); |
657 XCloseDisplay(myDpy); |
619 _INST(displayId) = nil; |
658 _INST(displayId) = nil; |
620 END_INTERRUPTSBLOCKED |
659 END_INTERRUPTSBLOCKED |
621 } |
660 } |
622 %} |
661 %} |
623 ! |
662 ! |
624 |
663 |
625 reinitialize |
664 reinitialize |
626 virtualRootId := nil. |
665 virtualRootId := rootId := nil. |
627 super reinitialize. |
666 super reinitialize. |
628 dispatchingExpose := nil |
667 dispatchingExpose := nil |
629 ! ! |
668 ! ! |
630 |
669 |
631 !XWorkstation methodsFor:'misc'! |
670 !XWorkstation methodsFor:'misc'! |
638 setInputFocusTo:aWindowId revertTo:revertSymbol |
677 setInputFocusTo:aWindowId revertTo:revertSymbol |
639 |
678 |
640 %{ /* NOCONTEXT */ |
679 %{ /* NOCONTEXT */ |
641 int arg; |
680 int arg; |
642 |
681 |
643 if (__isSmallInteger(aWindowId)) { |
682 if (__isSmallInteger(aWindowId) && ISCONNECTED) { |
644 if (revertSymbol == @symbol(parent)) |
683 if (revertSymbol == @symbol(parent)) |
645 arg = RevertToParent; |
684 arg = RevertToParent; |
646 else if (revertSymbol == @symbol(root)) |
685 else if (revertSymbol == @symbol(root)) |
647 arg = RevertToPointerRoot; |
686 arg = RevertToPointerRoot; |
648 else |
687 else |
660 unBuffered |
699 unBuffered |
661 "make all drawing be sent immediately to the display" |
700 "make all drawing be sent immediately to the display" |
662 |
701 |
663 %{ /* NOCONTEXT */ |
702 %{ /* NOCONTEXT */ |
664 |
703 |
665 BEGIN_INTERRUPTSBLOCKED |
704 if (ISCONNECTED) { |
666 XSynchronize(myDpy, 1); |
705 BEGIN_INTERRUPTSBLOCKED |
667 END_INTERRUPTSBLOCKED |
706 XSynchronize(myDpy, 1); |
|
707 END_INTERRUPTSBLOCKED |
|
708 } |
668 %} |
709 %} |
669 "Display unbuffered" |
710 "Display unbuffered" |
670 ! |
711 ! |
671 |
712 |
672 buffered |
713 buffered |
673 "buffer drawing - do not send it immediately to the display" |
714 "buffer drawing - do not send it immediately to the display" |
674 |
715 |
675 %{ /* NOCONTEXT */ |
716 %{ /* NOCONTEXT */ |
676 |
717 |
677 BEGIN_INTERRUPTSBLOCKED |
718 if (ISCONNECTED) { |
678 XSynchronize(myDpy, 0); |
719 BEGIN_INTERRUPTSBLOCKED |
679 END_INTERRUPTSBLOCKED |
720 XSynchronize(myDpy, 0); |
|
721 END_INTERRUPTSBLOCKED |
|
722 } |
680 %} |
723 %} |
681 "Display buffered" |
724 "Display buffered" |
682 ! |
725 ! |
683 |
726 |
684 synchronizeOutput |
727 synchronizeOutput |
685 "send all buffered drawing to the display" |
728 "send all buffered drawing to the display" |
686 |
729 |
687 %{ /* NOCONTEXT */ |
730 %{ /* NOCONTEXT */ |
688 |
731 |
689 BEGIN_INTERRUPTSBLOCKED |
732 if (ISCONNECTED) { |
690 XSync(myDpy, 0); |
733 BEGIN_INTERRUPTSBLOCKED |
691 END_INTERRUPTSBLOCKED |
734 XSync(myDpy, 0); |
|
735 END_INTERRUPTSBLOCKED |
|
736 } |
692 %} |
737 %} |
693 ! |
738 ! |
694 |
739 |
695 flushDpsContext:aDPSContext |
740 flushDpsContext:aDPSContext |
696 |
741 |
711 beep:volumeInPercent |
756 beep:volumeInPercent |
712 "output an audible beep" |
757 "output an audible beep" |
713 %{ |
758 %{ |
714 int volume; |
759 int volume; |
715 |
760 |
716 if (__isSmallInteger(volumeInPercent)) { |
761 if (__isSmallInteger(volumeInPercent) && ISCONNECTED) { |
717 /* stupid: X wants -100 .. 100 and calls this percent */ |
762 /* stupid: X wants -100 .. 100 and calls this percent */ |
718 volume = _intVal(volumeInPercent) * 2 - 100; |
763 volume = _intVal(volumeInPercent) * 2 - 100; |
719 if (volume < -100) volume = -100; |
764 if (volume < -100) volume = -100; |
720 else if (volume > 100) volume = 100; |
765 else if (volume > 100) volume = 100; |
721 BEGIN_INTERRUPTSBLOCKED |
766 BEGIN_INTERRUPTSBLOCKED |
771 serverVendor |
819 serverVendor |
772 "return the X-server vendor string - this should normally not be of |
820 "return the X-server vendor string - this should normally not be of |
773 any interrest, but can be for special cases |
821 any interrest, but can be for special cases |
774 (to avoid bugs in certain implementations)" |
822 (to avoid bugs in certain implementations)" |
775 %{ |
823 %{ |
776 RETURN ( _MKSTRING(XServerVendor(myDpy), __context) ); |
824 if (ISCONNECTED) { |
|
825 RETURN ( _MKSTRING(XServerVendor(myDpy), __context) ); |
|
826 } |
|
827 RETURN (nil); |
777 %} |
828 %} |
778 |
829 |
779 " |
830 " |
780 Display serverVendor |
831 Display serverVendor |
781 " |
832 " |
785 "return the X-servers vendor release - should normally not be of |
836 "return the X-servers vendor release - should normally not be of |
786 any interrest, but can be for special cases. |
837 any interrest, but can be for special cases. |
787 (to avoid bugs in certain implementations)" |
838 (to avoid bugs in certain implementations)" |
788 |
839 |
789 %{ /* NOCONTEXT */ |
840 %{ /* NOCONTEXT */ |
790 RETURN ( _MKSMALLINT(XVendorRelease(myDpy)) ); |
841 if (ISCONNECTED) { |
|
842 RETURN ( _MKSMALLINT(XVendorRelease(myDpy)) ); |
|
843 } |
|
844 RETURN (nil); |
791 %} |
845 %} |
792 |
846 |
793 " |
847 " |
794 Display vendorRelease |
848 Display vendorRelease |
795 " |
849 " |
832 |
889 |
833 hasDPS |
890 hasDPS |
834 "return true, if this workstation supports display postscript" |
891 "return true, if this workstation supports display postscript" |
835 |
892 |
836 ^ hasDPSExtension |
893 ^ hasDPSExtension |
|
894 ! |
|
895 |
|
896 hasMultibuffer |
|
897 "return true, if this workstation supports the multibuffer extension" |
|
898 |
|
899 ^ hasMbufExtension |
|
900 ! |
|
901 |
|
902 hasXVideo |
|
903 "return true, if this workstation supports the XVideo extension" |
|
904 |
|
905 ^ hasXVideoExtension |
|
906 ! |
|
907 |
|
908 hasExtension:extensionString |
|
909 "query for an X extension. The argument, extensionString |
|
910 should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc). |
|
911 Return true, if that extension is available." |
|
912 |
|
913 %{ |
|
914 int dummy; |
|
915 |
|
916 if (__isString(extensionString) && ISCONNECTED) { |
|
917 if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) { |
|
918 RETURN ( true ); |
|
919 } |
|
920 } |
|
921 %}. |
|
922 ^ false |
837 ! |
923 ! |
838 |
924 |
839 supportedImageFormats |
925 supportedImageFormats |
840 "return an array with supported image formats; each array entry |
926 "return an array with supported image formats; each array entry |
841 is another array, consisting of depth and bitsPerPixel values." |
927 is another array, consisting of depth and bitsPerPixel values." |
842 |
928 |
843 |nFormats formatArray| |
929 |nFormats "{ Class: SmallInteger }" |
|
930 formatArray| |
844 %{ |
931 %{ |
845 Display *dpy = myDpy; |
932 Display *dpy = myDpy; |
|
933 |
|
934 if (! ISCONNECTED) { |
|
935 RETURN (nil); |
|
936 } |
846 nFormats = _MKSMALLINT(DISPLAYACCESS(dpy)->nformats); |
937 nFormats = _MKSMALLINT(DISPLAYACCESS(dpy)->nformats); |
847 %}. |
938 %}. |
848 formatArray := Array new:nFormats. |
939 formatArray := Array new:nFormats. |
849 1 to:nFormats do:[:i | |
940 1 to:nFormats do:[:index | |
850 |bitsPerPixelInfo depthInfo| |
941 |bitsPerPixelInfo depthInfo i| |
|
942 |
|
943 i := index. |
851 %{ |
944 %{ |
852 ScreenFormat *format; |
945 ScreenFormat *format; |
853 Display *dpy = myDpy; |
946 Display *dpy = myDpy; |
854 |
947 |
855 format = DISPLAYACCESS(dpy)->pixmap_format; |
948 format = DISPLAYACCESS(dpy)->pixmap_format; |
856 format += (_intVal(i)-1); |
949 format += (_intVal(i)-1); |
857 bitsPerPixelInfo = _MKSMALLINT(format->bits_per_pixel); |
950 bitsPerPixelInfo = _MKSMALLINT(format->bits_per_pixel); |
858 depthInfo = _MKSMALLINT(format->depth); |
951 depthInfo = _MKSMALLINT(format->depth); |
859 %}. |
952 %}. |
860 formatArray at:i put:(Array with:depthInfo with:bitsPerPixelInfo). |
953 formatArray at:index put:(Array with:depthInfo with:bitsPerPixelInfo). |
861 ]. |
954 ]. |
862 ^ formatArray |
955 ^ formatArray |
863 |
956 |
864 " |
957 " |
865 Display supportedImageFormats |
958 Display supportedImageFormats |
943 "return a mask to enable some events by default." |
1036 "return a mask to enable some events by default." |
944 |
1037 |
945 %{ /* NOCONTEXT */ |
1038 %{ /* NOCONTEXT */ |
946 RETURN (_MKSMALLINT( ExposureMask | StructureNotifyMask | |
1039 RETURN (_MKSMALLINT( ExposureMask | StructureNotifyMask | |
947 KeyPressMask | KeyReleaseMask | |
1040 KeyPressMask | KeyReleaseMask | |
|
1041 EnterWindowMask | LeaveWindowMask | |
948 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask )); |
1042 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask )); |
949 %} |
1043 %} |
950 ! |
1044 ! |
951 |
1045 |
952 viewIdFromPoint:aPoint in:windowId |
1046 viewIdFromPoint:aPoint in:windowId |
1113 |
1207 |
1114 Display *dpy = myDpy; |
1208 Display *dpy = myDpy; |
1115 int screen = _intVal(_INST(screen)); |
1209 int screen = _intVal(_INST(screen)); |
1116 Pixmap newBitmap; |
1210 Pixmap newBitmap; |
1117 |
1211 |
1118 if (__bothSmallInteger(w, h)) { |
1212 if (__bothSmallInteger(w, h) && ISCONNECTED) { |
1119 BEGIN_INTERRUPTSBLOCKED |
1213 BEGIN_INTERRUPTSBLOCKED |
1120 newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1214 newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1121 _intVal(w), _intVal(h), 1); |
1215 _intVal(w), _intVal(h), 1); |
1122 END_INTERRUPTSBLOCKED |
1216 END_INTERRUPTSBLOCKED |
1123 RETURN ( (newBitmap != (Pixmap)0) ? MKOBJ(newBitmap) : nil ); |
1217 RETURN ( (newBitmap != (Pixmap)0) ? MKOBJ(newBitmap) : nil ); |
1136 |
1230 |
1137 Display *dpy = myDpy; |
1231 Display *dpy = myDpy; |
1138 int screen = _intVal(_INST(screen)); |
1232 int screen = _intVal(_INST(screen)); |
1139 Pixmap newBitmap; |
1233 Pixmap newBitmap; |
1140 |
1234 |
1141 if (__bothSmallInteger(w, h)) { |
1235 if (__bothSmallInteger(w, h) && ISCONNECTED) { |
1142 BEGIN_INTERRUPTSBLOCKED |
1236 BEGIN_INTERRUPTSBLOCKED |
1143 newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1237 newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1144 _intVal(w), _intVal(h), _intVal(d)); |
1238 _intVal(w), _intVal(h), _intVal(d)); |
1145 END_INTERRUPTSBLOCKED |
1239 END_INTERRUPTSBLOCKED |
1146 RETURN ( (newBitmap != (Pixmap)0) ? MKOBJ(newBitmap) : nil ); |
1240 RETURN ( (newBitmap != (Pixmap)0) ? MKOBJ(newBitmap) : nil ); |
1161 char *filename; |
1255 char *filename; |
1162 unsigned b_width, b_height; |
1256 unsigned b_width, b_height; |
1163 int b_x_hot, b_y_hot; |
1257 int b_x_hot, b_y_hot; |
1164 int status; |
1258 int status; |
1165 |
1259 |
1166 if (__isString(aString) || __isSymbol(aString)) { |
1260 if (ISCONNECTED) { |
1167 filename = (char *)_stringVal(aString); |
1261 if (__isString(aString) || __isSymbol(aString)) { |
1168 |
1262 filename = (char *)_stringVal(aString); |
1169 BEGIN_INTERRUPTSBLOCKED |
1263 |
1170 status = XReadBitmapFile(dpy, RootWindow(dpy, screen), |
1264 BEGIN_INTERRUPTSBLOCKED |
1171 filename, &b_width, &b_height, &newBitmap, |
1265 status = XReadBitmapFile(dpy, RootWindow(dpy, screen), |
1172 &b_x_hot, &b_y_hot); |
1266 filename, &b_width, &b_height, &newBitmap, |
1173 END_INTERRUPTSBLOCKED |
1267 &b_x_hot, &b_y_hot); |
1174 |
1268 END_INTERRUPTSBLOCKED |
1175 if (status == BitmapSuccess) { |
1269 |
1176 w = _MKSMALLINT(b_width); |
1270 if (status == BitmapSuccess) { |
1177 h = _MKSMALLINT(b_height); |
1271 w = _MKSMALLINT(b_width); |
1178 id = MKOBJ(newBitmap); |
1272 h = _MKSMALLINT(b_height); |
|
1273 id = MKOBJ(newBitmap); |
|
1274 } |
1179 } |
1275 } |
1180 } |
1276 } |
1181 %} |
1277 %} |
1182 . |
1278 . |
1183 id notNil ifTrue:[ |
1279 id notNil ifTrue:[ |
1283 |
1379 |
1284 destroyPixmap:aDrawableId |
1380 destroyPixmap:aDrawableId |
1285 |
1381 |
1286 %{ /* NOCONTEXT */ |
1382 %{ /* NOCONTEXT */ |
1287 |
1383 |
1288 if (__isSmallInteger(aDrawableId)) { |
1384 if (__isSmallInteger(aDrawableId) && ISCONNECTED) { |
1289 BEGIN_INTERRUPTSBLOCKED |
1385 BEGIN_INTERRUPTSBLOCKED |
1290 XFreePixmap(myDpy, _PixmapVal(aDrawableId)); |
1386 XFreePixmap(myDpy, _PixmapVal(aDrawableId)); |
1291 END_INTERRUPTSBLOCKED |
1387 END_INTERRUPTSBLOCKED |
1292 RETURN ( self ); |
1388 RETURN ( self ); |
1293 } |
1389 } |
1294 %} |
1390 %}. |
1295 . |
|
1296 self primitiveFailed |
1391 self primitiveFailed |
1297 ! |
1392 ! |
1298 |
1393 |
1299 destroyFaxImage:aFaxImageId |
1394 destroyFaxImage:aFaxImageId |
1300 |
1395 |
1306 XFAXImageFreeImage(myDpy, (FAXImage)_WindowVal(aFaxImageId)); |
1401 XFAXImageFreeImage(myDpy, (FAXImage)_WindowVal(aFaxImageId)); |
1307 END_INTERRUPTSBLOCKED |
1402 END_INTERRUPTSBLOCKED |
1308 RETURN ( self ); |
1403 RETURN ( self ); |
1309 } |
1404 } |
1310 #endif |
1405 #endif |
1311 %} |
1406 %}. |
1312 . |
1407 self primitiveFailed |
1313 self primitiveFailed |
1408 ! |
1314 ! |
1409 |
1315 |
1410 realRootWindowId |
1316 realRootWindowFor:aView |
1411 "return the id of the real root window. |
1317 %{ /* NOCONTEXT */ |
1412 This may not be the window you see as background, |
|
1413 since some window managers install a virtual root window on top |
|
1414 of it. Except for very special cases, use #rootWindowId, which takes |
|
1415 care of any virtual root." |
|
1416 |
|
1417 %{ /* NOCONTEXT */ |
|
1418 |
1318 int screen = _intVal(_INST(screen)); |
1419 int screen = _intVal(_INST(screen)); |
1319 Window root; |
1420 Window root; |
1320 |
1421 |
1321 root = RootWindow(myDpy, screen); |
1422 if (_INST(rootId) != nil) { |
1322 if (! root) { |
1423 RETURN (_INST(rootId)); |
1323 RETURN ( nil ); |
1424 } |
1324 } |
1425 |
1325 RETURN( MKOBJ(root) ); |
1426 if (ISCONNECTED) { |
1326 %} |
1427 root = RootWindow(myDpy, screen); |
1327 ! |
1428 if (! root) { |
1328 |
1429 RETURN ( nil ); |
1329 rootWindowFor:aView |
1430 } |
1330 |id| |
1431 _INST(rootId) = MKOBJ(root); |
1331 %{ |
1432 RETURN (_INST(rootId)); |
|
1433 } |
|
1434 %}. |
|
1435 self primitiveFailed |
|
1436 ! |
|
1437 |
|
1438 rootWindowId |
|
1439 "return the id of the root window. |
|
1440 This is the window you see as background, |
|
1441 however, it may or may not be the real physical root window, |
|
1442 since some window managers install a virtual root window on top |
|
1443 of the real one. If this is the case, that views id is returned here." |
|
1444 |
|
1445 %{ /* NOCONTEXT */ |
1332 int screen = _intVal(_INST(screen)); |
1446 int screen = _intVal(_INST(screen)); |
1333 Window root; |
1447 Window rootWin, vRootWin; |
1334 OBJ vRoot; |
1448 |
1335 |
1449 if (_INST(virtualRootId) != nil) { |
1336 vRoot = _INST(virtualRootId); |
1450 RETURN (_INST(virtualRootId)); |
1337 if (__isSmallInteger(vRoot)) { |
1451 } |
1338 root = _WindowVal(vRoot); |
1452 |
1339 } else { |
1453 if (ISCONNECTED) { |
|
1454 vRootWin = rootWin = RootWindow(myDpy, screen); |
|
1455 #ifndef IRIS |
1340 BEGIN_INTERRUPTSBLOCKED |
1456 BEGIN_INTERRUPTSBLOCKED |
1341 root = RootWindow(myDpy, screen); |
|
1342 #ifndef IRIS |
|
1343 /* |
1457 /* |
1344 * on IRIS, this creates a badwindow error - why ? |
1458 * on IRIS, this creates a badwindow error - why ? |
1345 * children contains a funny window (000034) |
1459 * children contains a funny window (000034) |
1346 */ |
1460 */ |
1347 |
1461 |
1353 int i; |
1467 int i; |
1354 Window rootReturn, parentReturn; |
1468 Window rootReturn, parentReturn; |
1355 Window* children; |
1469 Window* children; |
1356 unsigned int numChildren; |
1470 unsigned int numChildren; |
1357 |
1471 |
1358 if (XQueryTree(myDpy, root, |
1472 if (XQueryTree(myDpy, rootWin, |
1359 &rootReturn, &parentReturn, |
1473 &rootReturn, &parentReturn, |
1360 &children, &numChildren)) { |
1474 &children, &numChildren)) { |
1361 vRootAtom = XInternAtom(myDpy, "__SWM_VROOT", True ); |
1475 vRootAtom = XInternAtom(myDpy, "__SWM_VROOT", True ); |
1362 if (vRootAtom != None) { |
1476 if (vRootAtom != None) { |
1363 for (i=0; i < numChildren; i++) { |
1477 for (i=0; i < numChildren; i++) { |
1371 0L, 1L, False, XA_WINDOW, |
1485 0L, 1L, False, XA_WINDOW, |
1372 &actual_type, &actual_format, |
1486 &actual_type, &actual_format, |
1373 &nitems, &bytesafter, |
1487 &nitems, &bytesafter, |
1374 (unsigned char**) &newRoot |
1488 (unsigned char**) &newRoot |
1375 ) == Success && newRoot) { |
1489 ) == Success && newRoot) { |
1376 root = *newRoot; |
1490 vRootWin = *newRoot; |
1377 break; |
1491 break; |
1378 } |
1492 } |
1379 } |
1493 } |
1380 } |
1494 } |
1381 if (children) XFree( children ); |
1495 if (children) XFree( children ); |
1382 } |
1496 } |
1383 } |
1497 } |
1384 } |
1498 } |
|
1499 END_INTERRUPTSBLOCKED |
1385 #endif |
1500 #endif |
1386 END_INTERRUPTSBLOCKED |
1501 } |
1387 } |
1502 |
1388 if (! root) { |
1503 /* cannot happen */ |
1389 RETURN ( nil ); |
1504 if (! vRootWin) { |
1390 } |
1505 vRootWin = rootWin; |
1391 id = _INST(virtualRootId) = MKOBJ(root); |
1506 if (! rootWin) { |
1392 %} |
1507 RETURN ( nil ); |
1393 . |
1508 } |
|
1509 } |
|
1510 _INST(rootId) = MKOBJ(rootWin); |
|
1511 _INST(virtualRootId) = MKOBJ(vRootWin); |
|
1512 RETURN ( _INST(virtualRootId) ); |
|
1513 %} |
|
1514 ! |
|
1515 |
|
1516 realRootWindowFor:aView |
|
1517 "the name of this method is historic; |
|
1518 - it will vanish" |
|
1519 |
|
1520 |id| |
|
1521 |
|
1522 id := self realRootWindowId. |
|
1523 self addKnownView:aView withId:id. |
|
1524 ^ id |
|
1525 ! |
|
1526 |
|
1527 rootWindowFor:aView |
|
1528 |id| |
|
1529 |
|
1530 id := self rootWindowId. |
1394 self addKnownView:aView withId:id. |
1531 self addKnownView:aView withId:id. |
1395 ^ id |
1532 ^ id |
1396 ! |
1533 ! |
1397 |
1534 |
1398 createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight |
1535 createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight |
1431 iconView:wiconView |
1568 iconView:wiconView |
1432 |
1569 |
1433 |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight |
1570 |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight |
1434 bColorId wsuperViewId wcursorId wiconId windowId |
1571 bColorId wsuperViewId wcursorId wiconId windowId |
1435 weventMask wiconViewId bitGravity viewGravity vBgColor |
1572 weventMask wiconViewId bitGravity viewGravity vBgColor |
1436 vBgForm deepForm preferedVisual preferedDepth| |
1573 vBgForm deepForm preferredVisual preferredDepth| |
|
1574 |
|
1575 displayId isNil ifTrue:[ |
|
1576 self primitiveFailed. |
|
1577 ^ nil |
|
1578 ]. |
1437 |
1579 |
1438 origin notNil ifTrue:[ |
1580 origin notNil ifTrue:[ |
1439 xpos := origin x. |
1581 xpos := origin x. |
1440 ypos := origin y. |
1582 ypos := origin y. |
1441 ] ifFalse:[ |
1583 ] ifFalse:[ |
1490 ]. |
1632 ]. |
1491 weventMask := aView eventMask. |
1633 weventMask := aView eventMask. |
1492 |
1634 |
1493 "/ bitGravity := aView bitGravity. |
1635 "/ bitGravity := aView bitGravity. |
1494 "/ viewGravity := aView viewGravity. |
1636 "/ viewGravity := aView viewGravity. |
1495 preferedVisual := aView preferedVisual. |
1637 preferredVisual := aView preferredVisual. |
1496 preferedDepth := aView preferedDepth. |
1638 preferredDepth := aView preferredDepth. |
1497 |
1639 |
1498 %{ /* STACK:16000 */ |
1640 %{ /* STACK:16000 */ |
1499 Display *dpy = myDpy; |
1641 Display *dpy = myDpy; |
1500 int screen = _intVal(_INST(screen)); |
1642 int screen = _intVal(_INST(screen)); |
1501 Visual visual; |
1643 Visual visual; |
1639 |
1781 |
1640 #ifdef OLD |
1782 #ifdef OLD |
1641 /* these may not be disabled */ |
1783 /* these may not be disabled */ |
1642 xswa.event_mask |= ExposureMask | StructureNotifyMask | |
1784 xswa.event_mask |= ExposureMask | StructureNotifyMask | |
1643 KeyPressMask | KeyReleaseMask | |
1785 KeyPressMask | KeyReleaseMask | |
|
1786 EnterWindowMask | LeaveWindowMask | |
1644 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
1787 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
1645 #endif |
1788 #endif |
1646 |
1789 |
1647 if (ioClass == InputOnly) { |
1790 if (ioClass == InputOnly) { |
1648 bw = 0; |
1791 bw = 0; |
1661 } |
1804 } |
1662 xswa.border_pixel = bd; |
1805 xswa.border_pixel = bd; |
1663 } |
1806 } |
1664 |
1807 |
1665 visual.visualid = CopyFromParent; |
1808 visual.visualid = CopyFromParent; |
1666 if (__isSmallInteger(preferedDepth)) { |
1809 if (__isSmallInteger(preferredDepth)) { |
1667 depth = _intVal(preferedDepth); |
1810 depth = _intVal(preferredDepth); |
1668 } |
1811 } |
1669 |
1812 |
1670 BEGIN_INTERRUPTSBLOCKED |
1813 BEGIN_INTERRUPTSBLOCKED |
1671 if (preferedVisual != nil) { |
1814 if (preferredVisual != nil) { |
1672 XVisualInfo vi; |
1815 XVisualInfo vi; |
1673 int cls; |
1816 int cls; |
1674 |
1817 |
1675 if (preferedVisual == @symbol(StaticGray)) |
1818 if (preferredVisual == @symbol(StaticGray)) |
1676 cls = StaticGray; |
1819 cls = StaticGray; |
1677 else if (preferedVisual == @symbol(GrayScale)) |
1820 else if (preferredVisual == @symbol(GrayScale)) |
1678 cls = StaticGray; |
1821 cls = StaticGray; |
1679 else if (preferedVisual == @symbol(StaticColor)) |
1822 else if (preferredVisual == @symbol(StaticColor)) |
1680 cls = StaticColor; |
1823 cls = StaticColor; |
1681 else if (preferedVisual == @symbol(PseudoColor)) |
1824 else if (preferredVisual == @symbol(PseudoColor)) |
1682 cls = PseudoColor; |
1825 cls = PseudoColor; |
1683 else if (preferedVisual == @symbol(TrueColor)) |
1826 else if (preferredVisual == @symbol(TrueColor)) |
1684 cls = TrueColor; |
1827 cls = TrueColor; |
1685 else if (preferedVisual == @symbol(DirectColor)) |
1828 else if (preferredVisual == @symbol(DirectColor)) |
1686 cls = DirectColor; |
1829 cls = DirectColor; |
1687 else |
1830 else |
1688 cls = PseudoColor; |
1831 cls = PseudoColor; |
1689 |
1832 |
1690 if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) { |
1833 if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) { |
1838 |
1981 |
1839 %{ /* NOCONTEXT */ |
1982 %{ /* NOCONTEXT */ |
1840 int screen = _intVal(_INST(screen)); |
1983 int screen = _intVal(_INST(screen)); |
1841 GC gc; |
1984 GC gc; |
1842 |
1985 |
1843 if (__isSmallInteger(aDrawableId)) { |
1986 if (__isSmallInteger(aDrawableId) && ISCONNECTED) { |
1844 BEGIN_INTERRUPTSBLOCKED |
1987 BEGIN_INTERRUPTSBLOCKED |
1845 gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
1988 gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
1846 0L, (XGCValues *)0); |
1989 0L, (XGCValues *)0); |
1847 END_INTERRUPTSBLOCKED |
1990 END_INTERRUPTSBLOCKED |
1848 RETURN ( gc ? MKOBJ(gc) : nil ); |
1991 RETURN ( gc ? MKOBJ(gc) : nil ); |
1858 #ifdef XXDPS |
2001 #ifdef XXDPS |
1859 int screen = _intVal(_INST(screen)); |
2002 int screen = _intVal(_INST(screen)); |
1860 DPSContext dps; |
2003 DPSContext dps; |
1861 int height; |
2004 int height; |
1862 |
2005 |
1863 if (__bothSmallInteger(aDrawableId, aGCId)) { |
2006 if (__bothSmallInteger(aDrawableId, aGCId) && ISCONNECTED) { |
1864 BEGIN_INTERRUPTSBLOCKED |
2007 BEGIN_INTERRUPTSBLOCKED |
1865 dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId), |
2008 dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId), |
1866 _GCVal(aGCId), |
2009 _GCVal(aGCId), |
1867 0, height, 0, colormap, NULL, 0, |
2010 0, height, 0, colormap, NULL, 0, |
1868 XDPSDefaultTextBackstop, |
2011 XDPSDefaultTextBackstop, |
1883 getResource:name class:cls |
2026 getResource:name class:cls |
1884 %{ |
2027 %{ |
1885 char *rslt; |
2028 char *rslt; |
1886 |
2029 |
1887 if ((__isString(name) || __isSymbol(name)) |
2030 if ((__isString(name) || __isSymbol(name)) |
1888 && (__isString(cls) || __isSymbol(cls))) { |
2031 && (__isString(cls) || __isSymbol(cls)) |
|
2032 && ISCONNECTED) { |
1889 BEGIN_INTERRUPTSBLOCKED |
2033 BEGIN_INTERRUPTSBLOCKED |
1890 rslt = XGetDefault(myDpy, (char *)_stringVal(cls), |
2034 rslt = XGetDefault(myDpy, (char *)_stringVal(cls), |
1891 (char *)_stringVal(name)); |
2035 (char *)_stringVal(name)); |
1892 END_INTERRUPTSBLOCKED |
2036 END_INTERRUPTSBLOCKED |
1893 RETURN (rslt ? _MKSTRING(rslt, __context) : nil ); |
2037 RETURN (rslt ? _MKSTRING(rslt, __context) : nil ); |
1930 Atom prop, type; |
2074 Atom prop, type; |
1931 Window window; |
2075 Window window; |
1932 unsigned int value; |
2076 unsigned int value; |
1933 |
2077 |
1934 if (__bothSmallInteger(propertyID, typeID) |
2078 if (__bothSmallInteger(propertyID, typeID) |
|
2079 && ISCONNECTED |
1935 && (__isString(anObject) |
2080 && (__isString(anObject) |
1936 || __isSmallInteger(anObject) |
2081 || __isSmallInteger(anObject) |
1937 || __isSymbol(anObject) |
2082 || __isSymbol(anObject) |
1938 || __isByteArray(anObject))) { |
2083 || __isByteArray(anObject))) { |
1939 |
2084 |
2082 %{ /* NOCONTEXT */ |
2227 %{ /* NOCONTEXT */ |
2083 Display *dpy = myDpy; |
2228 Display *dpy = myDpy; |
2084 Atom selection; |
2229 Atom selection; |
2085 Window window; |
2230 Window window; |
2086 |
2231 |
2087 if (__isSmallInteger(selectionID)) { |
2232 if (__isSmallInteger(selectionID) && ISCONNECTED) { |
2088 window = XGetSelectionOwner(dpy, _AtomVal(selectionID)); |
2233 window = XGetSelectionOwner(dpy, _AtomVal(selectionID)); |
2089 if (window == None) { |
2234 if (window == None) { |
2090 RETURN (nil); |
2235 RETURN (nil); |
2091 } |
2236 } |
2092 RETURN (MKOBJ(window)); |
2237 RETURN (MKOBJ(window)); |
2100 "set the owner of a selection; return false if failed" |
2245 "set the owner of a selection; return false if failed" |
2101 |
2246 |
2102 %{ /* NOCONTEXT */ |
2247 %{ /* NOCONTEXT */ |
2103 Display *dpy = myDpy; |
2248 Display *dpy = myDpy; |
2104 |
2249 |
2105 if (__bothSmallInteger(aWindowId, selectionID)) { |
2250 if (__bothSmallInteger(aWindowId, selectionID) && ISCONNECTED) { |
2106 XSetSelectionOwner(dpy, _AtomVal(selectionID), _WindowVal(aWindowId), CurrentTime); |
2251 XSetSelectionOwner(dpy, _AtomVal(selectionID), _WindowVal(aWindowId), CurrentTime); |
2107 if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != _WindowVal(aWindowId)) { |
2252 if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != _WindowVal(aWindowId)) { |
2108 RETURN (false); |
2253 RETURN (false); |
2109 } |
2254 } |
2110 RETURN (true); |
2255 RETURN (true); |
2143 Display *dpy = myDpy; |
2288 Display *dpy = myDpy; |
2144 Atom sel_prop; |
2289 Atom sel_prop; |
2145 char *cp; |
2290 char *cp; |
2146 |
2291 |
2147 if (_isSmallInteger(aWindowId) |
2292 if (_isSmallInteger(aWindowId) |
|
2293 && ISCONNECTED |
2148 && __bothSmallInteger(typeID, selectionID)) { |
2294 && __bothSmallInteger(typeID, selectionID)) { |
2149 if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) { |
2295 if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) { |
2150 /* |
2296 /* |
2151 * no owner of primary selection |
2297 * no owner of primary selection |
2152 */ |
2298 */ |
2200 "return an Atoms ID; if create is true, create it if not already present" |
2346 "return an Atoms ID; if create is true, create it if not already present" |
2201 |
2347 |
2202 %{ /* NOCONTEXT */ |
2348 %{ /* NOCONTEXT */ |
2203 Atom prop; |
2349 Atom prop; |
2204 |
2350 |
2205 if (__isString(aStringOrSymbol) |
2351 if (ISCONNECTED) { |
2206 || __isSymbol(aStringOrSymbol)) { |
2352 if (__isString(aStringOrSymbol) |
2207 prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol), |
2353 || __isSymbol(aStringOrSymbol)) { |
2208 (create == true) ? False : True); |
2354 prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol), |
2209 if (prop == None) { |
2355 (create == true) ? False : True); |
2210 RETURN (nil); |
2356 if (prop == None) { |
2211 } |
2357 RETURN (nil); |
2212 RETURN ( MKOBJ(prop) ); |
2358 } |
|
2359 RETURN ( MKOBJ(prop) ); |
|
2360 } |
2213 } |
2361 } |
2214 %}. |
2362 %}. |
2215 self primitiveFailed. |
2363 self primitiveFailed. |
2216 ^ nil |
2364 ^ nil |
2217 |
2365 |
2257 |
2405 |
2258 %{ /* NOCONTEXT */ |
2406 %{ /* NOCONTEXT */ |
2259 Display *dpy = myDpy; |
2407 Display *dpy = myDpy; |
2260 |
2408 |
2261 if (__bothSmallInteger(propertyID, requestorID) |
2409 if (__bothSmallInteger(propertyID, requestorID) |
|
2410 && ISCONNECTED |
2262 && __bothSmallInteger(targetID, selectionID)) { |
2411 && __bothSmallInteger(targetID, selectionID)) { |
2263 XEvent ev; |
2412 XEvent ev; |
2264 int requestor = (int)(_AtomVal(requestorID)); |
2413 int requestor = (int)(_AtomVal(requestorID)); |
2265 int property = (int)(_AtomVal(propertyID)); |
2414 int property = (int)(_AtomVal(propertyID)); |
2266 int target = (int)(_AtomVal(targetID)); |
2415 int target = (int)(_AtomVal(targetID)); |
2679 |
2828 |
2680 %{ /* NOCONTEXT */ |
2829 %{ /* NOCONTEXT */ |
2681 |
2830 |
2682 XFontStruct *newFont; |
2831 XFontStruct *newFont; |
2683 |
2832 |
2684 if (__isString(aFontName) || __isSymbol(aFontName)) { |
2833 if (ISCONNECTED) { |
2685 BEGIN_INTERRUPTSBLOCKED |
2834 if (__isString(aFontName) || __isSymbol(aFontName)) { |
2686 newFont = XLoadQueryFont(myDpy, (char *)_stringVal(aFontName)); |
2835 BEGIN_INTERRUPTSBLOCKED |
2687 END_INTERRUPTSBLOCKED |
2836 newFont = XLoadQueryFont(myDpy, (char *)_stringVal(aFontName)); |
2688 RETURN ( newFont ? MKOBJ(newFont) : nil ); |
2837 END_INTERRUPTSBLOCKED |
|
2838 RETURN ( newFont ? MKOBJ(newFont) : nil ); |
|
2839 } |
2689 } |
2840 } |
2690 %} |
2841 %} |
2691 . |
2842 . |
2692 self primitiveFailed. |
2843 self primitiveFailed. |
2693 ^ nil |
2844 ^ nil |
2704 |
2855 |
2705 %{ /* NOCONTEXT */ |
2856 %{ /* NOCONTEXT */ |
2706 |
2857 |
2707 XFontStruct *f; |
2858 XFontStruct *f; |
2708 |
2859 |
2709 if (__isSmallInteger(aFontId)) { |
2860 if (ISCONNECTED) { |
2710 f = _FontVal(aFontId); |
2861 if (__isSmallInteger(aFontId)) { |
2711 BEGIN_INTERRUPTSBLOCKED |
2862 f = _FontVal(aFontId); |
2712 XFreeFont(myDpy, f); |
2863 BEGIN_INTERRUPTSBLOCKED |
2713 END_INTERRUPTSBLOCKED |
2864 XFreeFont(myDpy, f); |
2714 RETURN ( self ); |
2865 END_INTERRUPTSBLOCKED |
|
2866 RETURN ( self ); |
|
2867 } |
2715 } |
2868 } |
2716 %} |
2869 %} |
2717 . |
2870 . |
2718 self primitiveFailed |
2871 self primitiveFailed |
2719 ! |
2872 ! |
2802 len = XTextWidth(f, cp, n); |
2952 len = XTextWidth(f, cp, n); |
2803 END_INTERRUPTSBLOCKED |
2953 END_INTERRUPTSBLOCKED |
2804 RETURN ( _MKSMALLINT(len) ); |
2954 RETURN ( _MKSMALLINT(len) ); |
2805 } |
2955 } |
2806 #ifdef TWOBYTESTRINGS |
2956 #ifdef TWOBYTESTRINGS |
2807 if (__Class(aString) == TwoByteString) { |
2957 if (__Class(aString) == @global(TwoByteString)) { |
2808 n = _byteArraySize(aString) / 2; |
2958 n = _byteArraySize(aString) / 2; |
2809 cp = (char *) _stringVal(aString); |
2959 cp = (char *) _stringVal(aString); |
2810 BEGIN_INTERRUPTSBLOCKED |
2960 BEGIN_INTERRUPTSBLOCKED |
2811 len = XTextWidth16(f, (XChar2b *)cp, n); |
2961 len = XTextWidth16(f, (XChar2b *)cp, n); |
2812 END_INTERRUPTSBLOCKED |
2962 END_INTERRUPTSBLOCKED |
2846 END_INTERRUPTSBLOCKED |
2993 END_INTERRUPTSBLOCKED |
2847 RETURN ( _MKSMALLINT(len) ); |
2994 RETURN ( _MKSMALLINT(len) ); |
2848 } |
2995 } |
2849 } |
2996 } |
2850 #ifdef TWOBYTESTRINGS |
2997 #ifdef TWOBYTESTRINGS |
2851 if (__Class(aString) == TwoByteString) { |
2998 if (__Class(aString) == @global(TwoByteString)) { |
2852 cp = (char *) _stringVal(aString); |
2999 cp = (char *) _stringVal(aString); |
2853 n = _byteArraySize(aString) / 2; |
3000 n = _byteArraySize(aString) / 2; |
2854 if ((i1 >= 0) && (i2 >= i1) && (i2 < n)) { |
3001 if ((i1 >= 0) && (i2 >= i1) && (i2 < n)) { |
2855 cp += (i1 * 2); |
3002 cp += (i1 * 2); |
2856 BEGIN_INTERRUPTSBLOCKED |
3003 BEGIN_INTERRUPTSBLOCKED |
2892 |
3039 |
2893 destroyCursor:aCursorId |
3040 destroyCursor:aCursorId |
2894 |
3041 |
2895 %{ /* NOCONTEXT */ |
3042 %{ /* NOCONTEXT */ |
2896 |
3043 |
2897 if (__isSmallInteger(aCursorId)) { |
3044 if (ISCONNECTED) { |
2898 BEGIN_INTERRUPTSBLOCKED |
3045 if (__isSmallInteger(aCursorId)) { |
2899 XFreeCursor(myDpy, _CursorVal(aCursorId)); |
3046 BEGIN_INTERRUPTSBLOCKED |
2900 END_INTERRUPTSBLOCKED |
3047 XFreeCursor(myDpy, _CursorVal(aCursorId)); |
2901 RETURN ( self ); |
3048 END_INTERRUPTSBLOCKED |
|
3049 RETURN ( self ); |
|
3050 } |
2902 } |
3051 } |
2903 %} |
3052 %} |
2904 . |
3053 . |
2905 self primitiveFailed |
3054 self primitiveFailed |
2906 ! |
3055 ! |
2908 createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy |
3057 createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy |
2909 "create a cursor given 2 bitmaps (source, mask) and a hotspot" |
3058 "create a cursor given 2 bitmaps (source, mask) and a hotspot" |
2910 |
3059 |
2911 |id sourceId maskId| |
3060 |id sourceId maskId| |
2912 |
3061 |
|
3062 displayId isNil ifTrue:[ |
|
3063 self primitiveFailed. |
|
3064 ^ nil |
|
3065 ]. |
2913 sourceId := sourceForm id. |
3066 sourceId := sourceForm id. |
2914 maskId := maskForm id. |
3067 maskId := maskForm id. |
2915 %{ |
3068 %{ |
2916 Cursor newCursor; |
3069 Cursor newCursor; |
2917 XColor fgColor, bgColor; |
3070 XColor fgColor, bgColor; |
3343 |
3501 |
3344 Display *dpy = myDpy; |
3502 Display *dpy = myDpy; |
3345 unsigned long color; |
3503 unsigned long color; |
3346 int screen = _intVal(_INST(screen)); |
3504 int screen = _intVal(_INST(screen)); |
3347 |
3505 |
3348 if (__isSmallInteger(colorIndex)) { |
3506 if (__isSmallInteger(colorIndex) && ISCONNECTED) { |
3349 color = (long) _intVal(colorIndex); |
3507 color = (long) _intVal(colorIndex); |
3350 BEGIN_INTERRUPTSBLOCKED |
3508 BEGIN_INTERRUPTSBLOCKED |
3351 XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L); |
3509 XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L); |
3352 END_INTERRUPTSBLOCKED |
3510 END_INTERRUPTSBLOCKED |
3353 RETURN ( self ); |
3511 RETURN ( self ); |
3386 Display *dpy = myDpy; |
3544 Display *dpy = myDpy; |
3387 XColor ecolor; |
3545 XColor ecolor; |
3388 int screen = _intVal(_INST(screen)); |
3546 int screen = _intVal(_INST(screen)); |
3389 Status ok; |
3547 Status ok; |
3390 |
3548 |
3391 if (__bothSmallInteger(r, g) && __isSmallInteger(b)) { |
3549 if (__bothSmallInteger(r, g) |
|
3550 && __isSmallInteger(b) |
|
3551 && ISCONNECTED) { |
3392 ecolor.red = _intVal(r); |
3552 ecolor.red = _intVal(r); |
3393 ecolor.green= _intVal(g); |
3553 ecolor.green= _intVal(g); |
3394 ecolor.blue = _intVal(b); |
3554 ecolor.blue = _intVal(b); |
3395 BEGIN_INTERRUPTSBLOCKED |
3555 BEGIN_INTERRUPTSBLOCKED |
3396 ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
3556 ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
3416 Display *dpy = myDpy; |
3576 Display *dpy = myDpy; |
3417 XColor scolor, ecolor; |
3577 XColor scolor, ecolor; |
3418 int screen =_intVal(_INST(screen)); |
3578 int screen =_intVal(_INST(screen)); |
3419 Status ok; |
3579 Status ok; |
3420 |
3580 |
3421 if (__isString(aString) || __isSymbol(aString)) { |
3581 if (ISCONNECTED) { |
3422 colorname = (char *)_stringVal(aString); |
3582 if (__isString(aString) || __isSymbol(aString)) { |
3423 |
3583 colorname = (char *)_stringVal(aString); |
3424 BEGIN_INTERRUPTSBLOCKED |
3584 |
3425 ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); |
3585 BEGIN_INTERRUPTSBLOCKED |
3426 if (ok) { |
3586 ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); |
3427 ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
3587 if (ok) { |
3428 } |
3588 ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
3429 END_INTERRUPTSBLOCKED |
3589 } |
3430 if (! ok) { |
3590 END_INTERRUPTSBLOCKED |
3431 RETURN ( nil ); |
3591 if (! ok) { |
3432 } |
3592 RETURN ( nil ); |
3433 RETURN ( _MKSMALLINT(ecolor.pixel) ); |
3593 } |
|
3594 RETURN ( _MKSMALLINT(ecolor.pixel) ); |
|
3595 } |
3434 } |
3596 } |
3435 %} |
3597 %} |
3436 . |
3598 . |
3437 self primitiveFailed. |
3599 self primitiveFailed. |
3438 ^ nil |
3600 ^ nil |
3513 getRGBFromName:colorName into:aBlock |
3675 getRGBFromName:colorName into:aBlock |
3514 "get rgb components (0..100) of color named colorName, |
3676 "get rgb components (0..100) of color named colorName, |
3515 and evaluate the 3-arg block, aBlock with them" |
3677 and evaluate the 3-arg block, aBlock with them" |
3516 |
3678 |
3517 |r g b| |
3679 |r g b| |
|
3680 |
|
3681 displayId isNil ifTrue:[ |
|
3682 self pimitiveFailed. |
|
3683 ^ nil |
|
3684 ]. |
3518 %{ |
3685 %{ |
3519 Display *dpy = myDpy; |
3686 Display *dpy = myDpy; |
3520 int screen = _intVal(_INST(screen)); |
3687 int screen = _intVal(_INST(screen)); |
3521 XColor color; |
3688 XColor color; |
3522 double fr, fg, fb; |
3689 double fr, fg, fb; |
4696 GC gc = _GCVal(aGCId); |
4863 GC gc = _GCVal(aGCId); |
4697 Window win = _WindowVal(aDrawableId); |
4864 Window win = _WindowVal(aDrawableId); |
4698 unsigned char *cp; |
4865 unsigned char *cp; |
4699 int n; |
4866 int n; |
4700 OBJ cls; |
4867 OBJ cls; |
4701 #ifdef TWOBYTESTRINGS |
|
4702 extern OBJ TwoByteString; |
|
4703 #endif |
|
4704 |
4868 |
4705 if (__bothSmallInteger(aGCId, aDrawableId) |
4869 if (__bothSmallInteger(aGCId, aDrawableId) |
4706 && __isNonNilObject(aString) |
4870 && __isNonNilObject(aString) |
4707 && __bothSmallInteger(x, y)) { |
4871 && __bothSmallInteger(x, y)) { |
4708 cls = __qClass(aString); |
4872 cls = __qClass(aString); |
4715 else |
4879 else |
4716 XDrawString(myDpy, win, gc, _intVal(x), _intVal(y), (char *)cp, n); |
4880 XDrawString(myDpy, win, gc, _intVal(x), _intVal(y), (char *)cp, n); |
4717 RETURN ( self ); |
4881 RETURN ( self ); |
4718 } |
4882 } |
4719 #ifdef TWOBYTESTRINGS |
4883 #ifdef TWOBYTESTRINGS |
4720 if (cls == TwoByteString) { |
4884 if (cls == @global(TwoByteString)) { |
4721 cp = _stringVal(aString); |
4885 cp = _stringVal(aString); |
4722 n = _byteArraySize(aString) / 2; |
4886 n = _byteArraySize(aString) / 2; |
4723 if (n > 1000) n = 1000; |
4887 if (n > 1000) n = 1000; |
4724 if (opaque == true) |
4888 if (opaque == true) |
4725 XDrawImageString16(myDpy, win, gc, _intVal(x), _intVal(y), (XChar2b *)cp, n); |
4889 XDrawImageString16(myDpy, win, gc, _intVal(x), _intVal(y), (XChar2b *)cp, n); |
4744 GC gc = _GCVal(aGCId); |
4908 GC gc = _GCVal(aGCId); |
4745 Window win = _WindowVal(aDrawableId); |
4909 Window win = _WindowVal(aDrawableId); |
4746 unsigned char *cp; |
4910 unsigned char *cp; |
4747 OBJ cls; |
4911 OBJ cls; |
4748 int i1, i2, l, n; |
4912 int i1, i2, l, n; |
4749 #ifdef TWOBYTESTRINGS |
|
4750 extern OBJ TwoByteString; |
|
4751 #endif |
|
4752 |
4913 |
4753 if (__bothSmallInteger(aGCId, aDrawableId) |
4914 if (__bothSmallInteger(aGCId, aDrawableId) |
4754 && __isNonNilObject(aString) |
4915 && __isNonNilObject(aString) |
4755 && __bothSmallInteger(index1, index2) |
4916 && __bothSmallInteger(index1, index2) |
4756 && __bothSmallInteger(x, y)) { |
4917 && __bothSmallInteger(x, y)) { |
4772 } |
4933 } |
4773 RETURN ( self ); |
4934 RETURN ( self ); |
4774 } |
4935 } |
4775 } |
4936 } |
4776 #ifdef TWOBYTESTRINGS |
4937 #ifdef TWOBYTESTRINGS |
4777 if (cls == TwoByteString) { |
4938 if (cls == @global(TwoByteString)) { |
4778 i1 = _intVal(index1) - 1; |
4939 i1 = _intVal(index1) - 1; |
4779 i2 = _intVal(index2) - 1; |
4940 i2 = _intVal(index2) - 1; |
4780 n = _byteArraySize(aString) / 2; |
4941 n = _byteArraySize(aString) / 2; |
4781 cp = _stringVal(aString); |
4942 cp = _stringVal(aString); |
4782 if ((i1 >= 0) && (i2 < n)) { |
4943 if ((i1 >= 0) && (i2 < n)) { |
5378 |
5539 |
5379 #ifdef OLD |
5540 #ifdef OLD |
5380 /* these may not be disabled */ |
5541 /* these may not be disabled */ |
5381 mask |= ExposureMask | StructureNotifyMask | |
5542 mask |= ExposureMask | StructureNotifyMask | |
5382 KeyPressMask | KeyReleaseMask | |
5543 KeyPressMask | KeyReleaseMask | |
|
5544 EnterWindowMask | LeaveWindowMask | |
5383 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
5545 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
5384 #endif |
5546 #endif |
5385 |
5547 |
5386 XSelectInput(myDpy, _WindowVal(aWindowId), mask); |
5548 XSelectInput(myDpy, _WindowVal(aWindowId), mask); |
5387 RETURN ( self ); |
5549 RETURN ( self ); |
5497 Display *dpy = myDpy; |
5659 Display *dpy = myDpy; |
5498 Window win, wWanted; |
5660 Window win, wWanted; |
5499 int evMask; |
5661 int evMask; |
5500 OBJ eB; |
5662 OBJ eB; |
5501 XEvent *ev; |
5663 XEvent *ev; |
|
5664 |
|
5665 if (! ISCONNECTED) { |
|
5666 RETURN (false); |
|
5667 } |
5502 |
5668 |
5503 eB = _INST(eventBuffer); |
5669 eB = _INST(eventBuffer); |
5504 if (__isByteArray(eB)) { |
5670 if (__isByteArray(eB)) { |
5505 ev = (XEvent *)(_ByteArrayInstPtr(eB)->ba_element); |
5671 ev = (XEvent *)(_ByteArrayInstPtr(eB)->ba_element); |
5506 } else { |
5672 } else { |
5559 int i, nchars; |
5725 int i, nchars; |
5560 char *keySymString; |
5726 char *keySymString; |
5561 char keySymStringBuffer[32]; |
5727 char keySymStringBuffer[32]; |
5562 static unsigned multiClickTime = 0; |
5728 static unsigned multiClickTime = 0; |
5563 unsigned nextMultiClickTime; |
5729 unsigned nextMultiClickTime; |
|
5730 OBJ upDown; |
5564 |
5731 |
5565 struct inlineCache *ipS; |
5732 struct inlineCache *ipS; |
5566 static struct inlineCache vid = _ILC1; |
5733 static struct inlineCache vid = _ILC1; |
5567 |
5734 |
5568 static struct inlineCache expS = _ILC5; |
5735 static struct inlineCache expS = _ILC5; |
5631 |
5798 |
5632 switch (ev->type) { |
5799 switch (ev->type) { |
5633 case KeyRelease: |
5800 case KeyRelease: |
5634 symS = @symbol(keyRelease:x:y:view:); |
5801 symS = @symbol(keyRelease:x:y:view:); |
5635 ipS = &skrS; |
5802 ipS = &skrS; |
|
5803 upDown = false; |
5636 goto keyPressAndRelease; |
5804 goto keyPressAndRelease; |
5637 break; |
|
5638 |
5805 |
5639 case KeyPress: |
5806 case KeyPress: |
5640 symS = @symbol(keyPress:x:y:view:); |
5807 symS = @symbol(keyPress:x:y:view:); |
5641 ipS = &skpS; |
5808 ipS = &skpS; |
|
5809 upDown = true; |
|
5810 /* FALL INTO */ |
5642 |
5811 |
5643 keyPressAndRelease: |
5812 keyPressAndRelease: |
5644 _INST(eventRootX) = _MKSMALLINT(ke->x_root); |
5813 _INST(eventRootX) = _MKSMALLINT(ke->x_root); |
5645 _INST(eventRootY) = _MKSMALLINT(ke->y_root); |
5814 _INST(eventRootY) = _MKSMALLINT(ke->y_root); |
5646 _INST(altDown) = (ke->state & Mod2Mask) ? true : false; |
5815 _INST(altDown) = (ke->state & Mod2Mask) ? true : false; |
5647 _INST(metaDown) = (ke->state & Mod1Mask) ? true : false; |
5816 _INST(metaDown) = (ke->state & Mod1Mask) ? true : false; |
5648 _INST(shiftDown) = (ke->state & ShiftMask) ? true : false; |
5817 _INST(shiftDown) = (ke->state & ShiftMask) ? true : false; |
5649 _INST(controlDown) = (ke->state & ControlMask) ? true : false; |
5818 _INST(ctrlDown) = (ke->state & ControlMask) ? true : false; |
5650 |
5819 |
5651 arg = nil; |
5820 arg = nil; |
5652 nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL); |
5821 nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL); |
5653 if (nchars |
5822 if (nchars |
5654 && (((buffer[0] >= ' ') && (buffer[0] <= '~')) |
5823 && (((buffer[0] >= ' ') && (buffer[0] <= '~')) |
5655 || (buffer[0] >= 0x80))) { |
5824 || (buffer[0] >= 0x80))) { |
5656 arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */; |
5825 arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */; |
5657 keySymString = NULL; |
5826 keySymString = NULL; |
5658 } else { |
5827 } else { |
|
5828 switch (keySym) { |
|
5829 case XK_Control_L: |
|
5830 case XK_Control_R: |
|
5831 _INST(ctrlDown) = upDown; |
|
5832 break; |
|
5833 case XK_Shift_L: |
|
5834 case XK_Shift_R: |
|
5835 _INST(shiftDown) = upDown; |
|
5836 break; |
|
5837 case XK_Meta_L: |
|
5838 case XK_Meta_R: |
|
5839 _INST(metaDown) = upDown; |
|
5840 break; |
|
5841 case XK_Alt_L: |
|
5842 case XK_Alt_R: |
|
5843 _INST(altDown) = upDown; |
|
5844 break; |
|
5845 } |
|
5846 |
5659 keySymString = XKeysymToString(keySym); |
5847 keySymString = XKeysymToString(keySym); |
5660 if (keySymString) { |
5848 if (keySymString) { |
5661 if (keySymString[0] == 'D') { |
5849 if (keySymString[0] == 'D') { |
5662 /* |
5850 /* |
5663 * remove underscore, dont want it in symbols |
5851 * remove underscore, dont want it in symbols |
5763 } |
5951 } |
5764 |
5952 |
5765 _INST(eventRootX) = _MKSMALLINT(me->x_root); |
5953 _INST(eventRootX) = _MKSMALLINT(me->x_root); |
5766 _INST(eventRootY) = _MKSMALLINT(me->y_root); |
5954 _INST(eventRootY) = _MKSMALLINT(me->y_root); |
5767 |
5955 |
|
5956 _INST(altDown) = (me->state & Mod2Mask) ? true : false; |
|
5957 _INST(metaDown) = (me->state & Mod1Mask) ? true : false; |
|
5958 _INST(shiftDown) = (me->state & ShiftMask) ? true : false; |
|
5959 _INST(ctrlDown) = (me->state & ControlMask) ? true : false; |
|
5960 |
5768 (*motS.ilc_func)(self, |
5961 (*motS.ilc_func)(self, |
5769 @symbol(buttonMotion:x:y:view:) |
5962 @symbol(buttonMotion:x:y:view:) |
5770 COMMA_CON, nil, &motS, |
5963 COMMA_CON, nil, &motS, |
5771 _MKSMALLINT(me->state), |
5964 _MKSMALLINT(me->state), |
5772 _MKSMALLINT(me->x), |
5965 _MKSMALLINT(me->x), |
5787 COMMA_CON, nil, &focOutS, |
5980 COMMA_CON, nil, &focOutS, |
5788 theView); |
5981 theView); |
5789 break; |
5982 break; |
5790 |
5983 |
5791 case EnterNotify: |
5984 case EnterNotify: |
|
5985 _INST(altDown) = (ewe->state & Mod2Mask) ? true : false; |
|
5986 _INST(metaDown) = (ewe->state & Mod1Mask) ? true : false; |
|
5987 _INST(shiftDown) = (ewe->state & ShiftMask) ? true : false; |
|
5988 _INST(ctrlDown) = (ewe->state & ControlMask) ? true : false; |
|
5989 |
5792 (*peS.ilc_func)(self, |
5990 (*peS.ilc_func)(self, |
5793 @symbol(pointerEnter:x:y:view:) |
5991 @symbol(pointerEnter:x:y:view:) |
5794 COMMA_CON, nil, &peS, |
5992 COMMA_CON, nil, &peS, |
5795 _MKSMALLINT(ewe->state), |
5993 _MKSMALLINT(ewe->state), |
5796 _MKSMALLINT(ewe->x), |
5994 _MKSMALLINT(ewe->x), |
6065 |
6263 |
6066 %{ /* UNLIMITEDSTACK */ |
6264 %{ /* UNLIMITEDSTACK */ |
6067 |
6265 |
6068 Display *dpy = myDpy; |
6266 Display *dpy = myDpy; |
6069 |
6267 |
6070 XSync(dpy, 0); /* make certain everything is flushed */ |
6268 if (ISCONNECTED) { |
6071 RETURN ( (XPending(dpy)) ? true : false ); |
6269 XSync(dpy, 0); /* make certain everything is flushed */ |
|
6270 if (XPending(dpy)) { |
|
6271 RETURN (true); |
|
6272 } |
|
6273 } |
|
6274 RETURN ( false ); |
6072 %} |
6275 %} |
6073 ! |
6276 ! |
6074 |
6277 |
6075 eventPendingWithoutSync |
6278 eventPendingWithoutSync |
6076 "return true, if any event is pending." |
6279 "return true, if any event is pending." |
6077 |
6280 |
6078 %{ /* UNLIMITEDSTACK */ |
6281 %{ /* UNLIMITEDSTACK */ |
6079 |
6282 |
6080 RETURN ( (XPending(myDpy)) ? true : false ); |
6283 if (ISCONNECTED) { |
|
6284 if (XPending(myDpy)) { |
|
6285 RETURN (true); |
|
6286 } |
|
6287 } |
|
6288 RETURN ( false ); |
6081 %} |
6289 %} |
6082 ! |
6290 ! |
6083 |
6291 |
6084 exposeEventPendingFor:aWindowIdOrNil |
6292 exposeEventPendingFor:aWindowIdOrNil |
6085 "return true, if any expose event is pending" |
6293 "return true, if any expose event is pending" |
6089 Display *dpy = myDpy; |
6297 Display *dpy = myDpy; |
6090 XEvent ev; |
6298 XEvent ev; |
6091 Window win; |
6299 Window win; |
6092 int thereIsOne; |
6300 int thereIsOne; |
6093 |
6301 |
6094 XSync(dpy, 0); /* make certain everything is flushed */ |
6302 if (ISCONNECTED) { |
6095 if (__isSmallInteger(aWindowIdOrNil)) { |
6303 XSync(dpy, 0); /* make certain everything is flushed */ |
6096 win = _WindowVal(aWindowIdOrNil); |
6304 if (__isSmallInteger(aWindowIdOrNil)) { |
6097 thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); |
6305 win = _WindowVal(aWindowIdOrNil); |
6098 } else { |
6306 thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); |
6099 thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); |
6307 } else { |
6100 } |
6308 thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); |
6101 if (thereIsOne) { |
6309 } |
6102 XPutBackEvent(dpy, &ev); |
6310 if (thereIsOne) { |
6103 RETURN ( true ); |
6311 XPutBackEvent(dpy, &ev); |
|
6312 RETURN ( true ); |
|
6313 } |
6104 } |
6314 } |
6105 RETURN ( false ); |
6315 RETURN ( false ); |
6106 %} |
6316 %} |
6107 ! |
6317 ! |
6108 |
6318 |
6114 Display *dpy = myDpy; |
6324 Display *dpy = myDpy; |
6115 XEvent ev; |
6325 XEvent ev; |
6116 Window win; |
6326 Window win; |
6117 int thereIsOne; |
6327 int thereIsOne; |
6118 |
6328 |
6119 if (__isSmallInteger(anEventMask)) { |
6329 if (ISCONNECTED && __isSmallInteger(anEventMask)) { |
6120 XSync(dpy, 0); /* make certain everything is flushed */ |
6330 XSync(dpy, 0); /* make certain everything is flushed */ |
6121 if (__isSmallInteger(aWindowIdOrNil)) { |
6331 if (__isSmallInteger(aWindowIdOrNil)) { |
6122 win = _WindowVal(aWindowIdOrNil); |
6332 win = _WindowVal(aWindowIdOrNil); |
6123 thereIsOne = XCheckWindowEvent(dpy, win, _intVal(anEventMask), &ev); |
6333 thereIsOne = XCheckWindowEvent(dpy, win, _intVal(anEventMask), &ev); |
6124 } else { |
6334 } else { |