changeset 6160 | 3ea2f08308ae |
parent 6159 | d4e463e0c56c |
child 6169 | 426e8838363a |
6159:d4e463e0c56c | 6160:3ea2f08308ae |
---|---|
1 " |
1 " |
2 COPYRIGHT (c) 1989 by Claus Gittinger |
2 COPYRIGHT (c) 1989 by Claus Gittinger |
3 All Rights Reserved |
3 All Rights Reserved |
4 |
4 |
5 This software is furnished under a license and may be used |
5 This software is furnished under a license and may be used |
6 only in accordance with the terms of that license and with the |
6 only in accordance with the terms of that license and with the |
7 inclusion of the above copyright notice. This software may not |
7 inclusion of the above copyright notice. This software may not |
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 "{ Package: 'stx:libview' }" |
12 "{ Package: 'stx:libview' }" |
13 |
13 |
14 DeviceWorkstation subclass:#XWorkstation |
14 DeviceWorkstation subclass:#XWorkstation |
15 instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension |
15 instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension |
16 hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension |
16 hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension |
17 hasImageExtension hasInputExtension hasXineramaExtension |
17 hasImageExtension hasInputExtension hasXineramaExtension |
18 hasRenderExtension hasXftLibrary ignoreBackingStore blackpixel whitepixel atoms protocolsAtom |
18 hasRenderExtension hasXftLibrary ignoreBackingStore blackpixel whitepixel atoms protocolsAtom |
19 deleteWindowAtom saveYourselfAtom quitAppAtom primaryAtom |
19 deleteWindowAtom saveYourselfAtom quitAppAtom primaryAtom |
20 clipboardAtom stringAtom wmStateAtom motifWMHintsAtom |
20 clipboardAtom stringAtom wmStateAtom motifWMHintsAtom |
21 listOfXFonts buttonsPressed eventRootX eventRootY displayName |
21 listOfXFonts buttonsPressed eventRootX eventRootY displayName |
22 eventTrace dispatchingExpose rgbVisual rgbaVisual virtualRootId |
22 eventTrace dispatchingExpose rgbVisual rgbaVisual virtualRootId |
23 rootId altModifierMask metaModifierMask lastEventTime |
23 rootId altModifierMask metaModifierMask lastEventTime |
24 rawMonitorBounds monitorBounds lastButtonPressTime |
24 rawMonitorBounds monitorBounds lastButtonPressTime |
25 deviceIOTimeoutErrorSignal activateOnClick rawKeySymTranslation |
25 deviceIOTimeoutErrorSignal activateOnClick rawKeySymTranslation |
26 selectionOwner selectionTime selectionFetchers selectionHandlers |
26 selectionOwner clipboardSelectionTime primarySelectionTime |
27 preWaitAction xlibTimeout xlibTimeoutForWindowCreation |
27 selectionFetchers selectionHandlers preWaitAction xlibTimeout |
28 hasConnectionBroken uniqueDeviceID stxDeviceAtom uuidAtom |
28 xlibTimeoutForWindowCreation hasConnectionBroken uniqueDeviceID |
29 primaryBuffer windowGroupWindow maxOperationsUntilFlush |
29 stxDeviceAtom uuidAtom primaryBuffer windowGroupWindow |
30 operationsUntilFlush' |
30 maxOperationsUntilFlush operationsUntilFlush' |
31 classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength |
31 classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength |
32 DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation' |
32 DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation' |
33 poolDictionaries:'' |
33 poolDictionaries:'' |
34 category:'Interface-Graphics' |
34 category:'Interface-Graphics' |
35 ! |
35 ! |
36 |
36 |
37 Object subclass:#SelectionFetcher |
37 Object subclass:#SelectionFetcher |
38 instanceVariableNames:'sema message display drawableID selectionID propertyID targetID |
38 instanceVariableNames:'sema message display drawableID selectionID propertyID targetID |
39 buffer done incremental' |
39 buffer done incremental' |
40 classVariableNames:'' |
40 classVariableNames:'' |
41 poolDictionaries:'' |
41 poolDictionaries:'' |
42 privateIn:XWorkstation |
42 privateIn:XWorkstation |
43 ! |
43 ! |
44 |
44 |
45 SimpleView subclass:#WindowGroupWindow |
45 SimpleView subclass:#WindowGroupWindow |
46 instanceVariableNames:'' |
46 instanceVariableNames:'' |
47 classVariableNames:'' |
47 classVariableNames:'' |
48 poolDictionaries:'' |
48 poolDictionaries:'' |
49 privateIn:XWorkstation |
49 privateIn:XWorkstation |
50 ! |
50 ! |
51 |
51 |
52 !XWorkstation primitiveDefinitions! |
52 !XWorkstation primitiveDefinitions! |
53 %{ |
53 %{ |
54 |
54 |
242 * This exception will shutDown the connection. |
242 * This exception will shutDown the connection. |
243 * Q: is this a good idea for the local display ? |
243 * Q: is this a good idea for the local display ? |
244 */ |
244 */ |
245 #define __ENTER_XLIB(whichTimeout) \ |
245 #define __ENTER_XLIB(whichTimeout) \ |
246 { \ |
246 { \ |
247 __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \ |
247 __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \ |
248 __blockingPrimitiveTimeoutArg__ = self; \ |
248 __blockingPrimitiveTimeoutArg__ = self; \ |
249 __blockingPrimitiveTimeout__ = __intVal(__INST(whichTimeout)) * 1000; \ |
249 __blockingPrimitiveTimeout__ = __intVal(__INST(whichTimeout)) * 1000; \ |
250 } { |
250 } { |
251 |
251 |
252 #define LEAVE_XLIB() \ |
252 #define LEAVE_XLIB() \ |
253 { \ |
253 { \ |
254 __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)0; \ |
254 __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)0; \ |
255 __blockingPrimitiveTimeoutArg__ = nil; \ |
255 __blockingPrimitiveTimeoutArg__ = nil; \ |
256 __blockingPrimitiveTimeout__ = 0; \ |
256 __blockingPrimitiveTimeout__ = 0; \ |
257 } } |
257 } } |
258 |
258 |
259 #define ENTER_XLIB() __ENTER_XLIB(xlibTimeout) |
259 #define ENTER_XLIB() __ENTER_XLIB(xlibTimeout) |
260 #define ENTER_XLIB2() __ENTER_XLIB(xlibTimeoutForWindowCreation) |
260 #define ENTER_XLIB2() __ENTER_XLIB(xlibTimeoutForWindowCreation) |
261 |
261 |
345 # ifdef __GNUC__ |
345 # ifdef __GNUC__ |
346 VOLATILE |
346 VOLATILE |
347 # endif |
347 # endif |
348 static |
348 static |
349 dummyToForceLoading() { |
349 dummyToForceLoading() { |
350 XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0); |
350 XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0); |
351 XCloseDisplay(0); |
351 XCloseDisplay(0); |
352 XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0); |
352 XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0); |
353 XSetWindowColormap(0, 0, 0); |
353 XSetWindowColormap(0, 0, 0); |
354 XQueryColors(0,0,0,0); |
354 XQueryColors(0,0,0,0); |
355 # ifdef SHM |
355 # ifdef SHM |
356 XShmAttach(0, 0); |
356 XShmAttach(0, 0); |
357 XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0); |
357 XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0); |
358 XShmDetach(0, 0); |
358 XShmDetach(0, 0); |
359 XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0); |
359 XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0); |
360 shmctl(0,0,0); |
360 shmctl(0,0,0); |
361 fgetc(0); |
361 fgetc(0); |
362 # endif |
362 # endif |
363 } |
363 } |
364 #endif |
364 #endif |
365 |
365 |
366 #undef __myInstPtr |
366 #undef __myInstPtr |
381 { |
381 { |
382 XGetErrorText(dpy, event->error_code, lastErrorMsg, 127); |
382 XGetErrorText(dpy, event->error_code, lastErrorMsg, 127); |
383 lastErrorMsg[127] = '\0'; |
383 lastErrorMsg[127] = '\0'; |
384 |
384 |
385 if (lastErrorMsg[0] == '\0') { |
385 if (lastErrorMsg[0] == '\0') { |
386 sprintf(lastErrorMsg, "code: %d", event->error_code); |
386 sprintf(lastErrorMsg, "code: %d", event->error_code); |
387 } |
387 } |
388 lastRequestCode = event->request_code; |
388 lastRequestCode = event->request_code; |
389 lastMinorCode = event->minor_code; |
389 lastMinorCode = event->minor_code; |
390 lastResource = event->resourceid; |
390 lastResource = event->resourceid; |
391 if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) { |
391 if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) { |
392 /* |
392 /* |
393 * this is a BadWindow error for X_DestroyWindow. |
393 * this is a BadWindow error for X_DestroyWindow. |
394 * ignore it here, since it results from the GC freeing windows |
394 * ignore it here, since it results from the GC freeing windows |
395 * in non bottom-up window order. |
395 * in non bottom-up window order. |
396 */ |
396 */ |
397 return 0; |
397 return 0; |
398 } |
398 } |
399 |
399 |
400 if (@global(DeviceWorkstation:ErrorPrinting) == true) { |
400 if (@global(DeviceWorkstation:ErrorPrinting) == true) { |
401 console_fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%"_lx_"\n", |
401 console_fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%"_lx_"\n", |
402 event->request_code, event->request_code, |
402 event->request_code, event->request_code, |
403 event->minor_code, event->minor_code, (INT)(event->resourceid)); |
403 event->minor_code, event->minor_code, (INT)(event->resourceid)); |
404 console_fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n", |
404 console_fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n", |
405 event->error_code, lastErrorMsg); |
405 event->error_code, lastErrorMsg); |
406 } |
406 } |
407 |
407 |
408 __errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy)); |
408 __errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy)); |
409 return 0; |
409 return 0; |
410 } |
410 } |
420 int |
420 int |
421 __XIOErrorHandler__(dpy) |
421 __XIOErrorHandler__(dpy) |
422 Display *dpy; |
422 Display *dpy; |
423 { |
423 { |
424 if (@global(DeviceWorkstation:ErrorPrinting) == true) { |
424 if (@global(DeviceWorkstation:ErrorPrinting) == true) { |
425 console_fprintf(stderr, "XWorkstation [error]: I/O error\n"); |
425 console_fprintf(stderr, "XWorkstation [error]: I/O error\n"); |
426 } |
426 } |
427 __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError), |
427 __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError), |
428 __MKEXTERNALADDRESS(dpy)); |
428 __MKEXTERNALADDRESS(dpy)); |
429 |
429 |
430 #if 0 |
430 #if 0 |
431 /* |
431 /* |
432 * don't do this. |
432 * don't do this. |
433 * This error is called asynchronously, and the wrong process may be terminated |
433 * This error is called asynchronously, and the wrong process may be terminated |
455 void |
455 void |
456 __XTimeoutErrorHandler(displayDeviceInst) |
456 __XTimeoutErrorHandler(displayDeviceInst) |
457 OBJ displayDeviceInst; |
457 OBJ displayDeviceInst; |
458 { |
458 { |
459 if ((displayDeviceInst == @global(MainDisplay)) |
459 if ((displayDeviceInst == @global(MainDisplay)) |
460 || (displayDeviceInst == @global(DeviceWorkstation:DefaultScreen))) { |
460 || (displayDeviceInst == @global(DeviceWorkstation:DefaultScreen))) { |
461 console_fprintf(stderr, "XWorkstation [error]: keep display connection for master display after X11 timeout (no shutdown)\n"); |
461 console_fprintf(stderr, "XWorkstation [error]: keep display connection for master display after X11 timeout (no shutdown)\n"); |
462 return; |
462 return; |
463 } |
463 } |
464 if (@global(DeviceWorkstation:ErrorPrinting) == true) { |
464 if (@global(DeviceWorkstation:ErrorPrinting) == true) { |
465 console_fprintf(stderr, "XWorkstation [error]: X11 request timeout dpy=%"_lx_"\n", (INT)displayDeviceInst); |
465 console_fprintf(stderr, "XWorkstation [error]: X11 request timeout dpy=%"_lx_"\n", (INT)displayDeviceInst); |
466 } |
466 } |
467 __OINST(displayDeviceInst, hasConnectionBroken) = true; |
467 __OINST(displayDeviceInst, hasConnectionBroken) = true; |
468 |
468 |
469 __PROTECT__(displayDeviceInst); |
469 __PROTECT__(displayDeviceInst); |
470 __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst); |
470 __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst); |
472 |
472 |
473 /* |
473 /* |
474 * if we return from the error interrupt ... |
474 * if we return from the error interrupt ... |
475 */ |
475 */ |
476 if (__OINST(displayDeviceInst, displayId) != nil) { |
476 if (__OINST(displayDeviceInst, displayId) != nil) { |
477 __internalError("unhandled X11 display timeout error"); |
477 __internalError("unhandled X11 display timeout error"); |
478 |
478 |
479 /* |
479 /* |
480 * the current process failed to do an X11 request. |
480 * the current process failed to do an X11 request. |
481 * Terminate it! |
481 * Terminate it! |
482 */ |
482 */ |
483 __terminateProcess(0); /* soft terminate */ |
483 __terminateProcess(0); /* soft terminate */ |
484 __terminateProcess(1); /* hard terminate */ |
484 __terminateProcess(1); /* hard terminate */ |
485 } |
485 } |
486 } |
486 } |
487 |
487 |
488 %} |
488 %} |
489 ! ! |
489 ! ! |
491 !XWorkstation class methodsFor:'documentation'! |
491 !XWorkstation class methodsFor:'documentation'! |
492 |
492 |
493 copyright |
493 copyright |
494 " |
494 " |
495 COPYRIGHT (c) 1989 by Claus Gittinger |
495 COPYRIGHT (c) 1989 by Claus Gittinger |
496 All Rights Reserved |
496 All Rights Reserved |
497 |
497 |
498 This software is furnished under a license and may be used |
498 This software is furnished under a license and may be used |
499 only in accordance with the terms of that license and with the |
499 only in accordance with the terms of that license and with the |
500 inclusion of the above copyright notice. This software may not |
500 inclusion of the above copyright notice. This software may not |
501 be provided or otherwise made available to, or used by, any |
501 be provided or otherwise made available to, or used by, any |
517 the other device to the currentScreen query. |
517 the other device to the currentScreen query. |
518 Therefore, 'normal' applications do not have to care for all of this, as the currentScreen |
518 Therefore, 'normal' applications do not have to care for all of this, as the currentScreen |
519 query is answered by the launcher when opening its applications. |
519 query is answered by the launcher when opening its applications. |
520 |
520 |
521 Timeouts: |
521 Timeouts: |
522 sometimes, X-connections are lost and, as the Xlib is blocking and synchronous by |
522 sometimes, X-connections are lost and, as the Xlib is blocking and synchronous by |
523 default, this would lead to a locked ST/X system. |
523 default, this would lead to a locked ST/X system. |
524 Therefore, this class defines a timeOut, whenever doing an Xlib call. |
524 Therefore, this class defines a timeOut, whenever doing an Xlib call. |
525 The default for this timeout is 30seconds. |
525 The default for this timeout is 30seconds. |
526 This may be a problem with windowmanagers which show a rubber-band rectangle |
526 This may be a problem with windowmanagers which show a rubber-band rectangle |
527 when creating windows. |
527 when creating windows. |
528 If the user does not specify the rectangle within 30 seconds, the device assumes |
528 If the user does not specify the rectangle within 30 seconds, the device assumes |
529 a timeout and closes the connection. |
529 a timeout and closes the connection. |
530 As a (kludgy) workaround, a second timeout value is used for window-creation. |
530 As a (kludgy) workaround, a second timeout value is used for window-creation. |
531 This secondary timeout value defaults to 60*5 seconds (5 minutes). |
531 This secondary timeout value defaults to 60*5 seconds (5 minutes). |
532 |
532 |
533 See more documentation in my superclass, DeviceWorkstation. |
533 See more documentation in my superclass, DeviceWorkstation. |
534 |
534 |
535 [author:] |
535 [author:] |
536 Claus Gittinger |
536 Claus Gittinger |
537 " |
537 " |
538 ! ! |
538 ! ! |
539 |
539 |
540 !XWorkstation class methodsFor:'initialization'! |
540 !XWorkstation class methodsFor:'initialization'! |
541 |
541 |
549 "/ shutdown the X-connection, when no response is received after that many seconds. |
549 "/ shutdown the X-connection, when no response is received after that many seconds. |
550 DefaultXLibTimeout := 30. |
550 DefaultXLibTimeout := 30. |
551 DefaultXLibTimeoutForWindowCreation := 5*60. |
551 DefaultXLibTimeoutForWindowCreation := 5*60. |
552 |
552 |
553 RawKeySymTranslation isNil ifTrue:[ |
553 RawKeySymTranslation isNil ifTrue:[ |
554 "/ the following table maps X-keyevents to ST/X |
554 "/ the following table maps X-keyevents to ST/X |
555 "/ device independend events. |
555 "/ device independend events. |
556 "/ It is NOT meant as a keyboardMap replacement. |
556 "/ It is NOT meant as a keyboardMap replacement. |
557 |
557 |
558 RawKeySymTranslation := Dictionary new:6. |
558 RawKeySymTranslation := Dictionary new:6. |
559 RawKeySymTranslation |
559 RawKeySymTranslation |
560 at:#'Delete_line' put:#DeleteLine; |
560 at:#'Delete_line' put:#DeleteLine; |
561 at:#'Delete_word' put:#DeleteWord; |
561 at:#'Delete_word' put:#DeleteWord; |
562 at:#Down put:#CursorDown; |
562 at:#Down put:#CursorDown; |
563 at:#Up put:#CursorUp; |
563 at:#Up put:#CursorUp; |
564 at:#Left put:#CursorLeft; |
564 at:#Left put:#CursorLeft; |
565 at:#Right put:#CursorRight. |
565 at:#Right put:#CursorRight. |
566 ] |
566 ] |
567 |
567 |
568 "Modified: / 27.4.1999 / 17:21:30 / cg" |
568 "Modified: / 27.4.1999 / 17:21:30 / cg" |
569 ! ! |
569 ! ! |
570 |
570 |
579 |
579 |
580 debugResources |
580 debugResources |
581 %{ |
581 %{ |
582 #ifdef COUNT_RESOURCES |
582 #ifdef COUNT_RESOURCES |
583 console_fprintf(stderr, "colors:%d bitmaps:%d views:%d gc:%d cursors:%d fonts:%d\n", |
583 console_fprintf(stderr, "colors:%d bitmaps:%d views:%d gc:%d cursors:%d fonts:%d\n", |
584 __cnt_color, __cnt_bitmap, |
584 __cnt_color, __cnt_bitmap, |
585 __cnt_view, __cnt_gc, __cnt_cursor, __cnt_font); |
585 __cnt_view, __cnt_gc, __cnt_cursor, __cnt_font); |
586 #endif |
586 #endif |
587 %} |
587 %} |
588 |
588 |
589 " |
589 " |
590 XWorkstation debugResources |
590 XWorkstation debugResources |
622 and append the name of the corresponding X-request |
622 and append the name of the corresponding X-request |
623 " |
623 " |
624 match := 'XRequest.' , self requestCodeOfLastError printString. |
624 match := 'XRequest.' , self requestCodeOfLastError printString. |
625 s := '/usr/lib/X11/XErrorDB' asFilename readStreamOrNil. |
625 s := '/usr/lib/X11/XErrorDB' asFilename readStreamOrNil. |
626 s notNil ifTrue:[ |
626 s notNil ifTrue:[ |
627 line := s peekForLineStartingWith:match. |
627 line := s peekForLineStartingWith:match. |
628 s close. |
628 s close. |
629 ]. |
629 ]. |
630 line isNil ifTrue:[ |
630 line isNil ifTrue:[ |
631 string := string, ' in ', match |
631 string := string, ' in ', match |
632 ] ifFalse:[ |
632 ] ifFalse:[ |
633 string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1) |
633 string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1) |
634 ]. |
634 ]. |
635 ^ string |
635 ^ string |
636 ! |
636 ! |
637 |
637 |
638 minorCodeOfLastError |
638 minorCodeOfLastError |
651 |
651 |
652 resourceIdOfLastError |
652 resourceIdOfLastError |
653 %{ /* NOCONTEXT */ |
653 %{ /* NOCONTEXT */ |
654 |
654 |
655 if (lastResource != 0) { |
655 if (lastResource != 0) { |
656 RETURN ( __MKEXTERNALADDRESS(lastResource) ); |
656 RETURN ( __MKEXTERNALADDRESS(lastResource) ); |
657 } |
657 } |
658 %}. |
658 %}. |
659 |
659 |
660 ^ nil |
660 ^ nil |
661 |
661 |
662 |
662 |
663 " |
663 " |
664 Screen resourceIdOfLastError |
664 Screen resourceIdOfLastError |
665 " |
665 " |
666 ! |
666 ! |
667 |
667 |
668 setConnectionTimeOut:seconds |
668 setConnectionTimeOut:seconds |
669 "set the default connection timeout (seconds)" |
669 "set the default connection timeout (seconds)" |
727 |
727 |
728 |prev| |
728 |prev| |
729 |
729 |
730 prev := activateOnClick ? false. |
730 prev := activateOnClick ? false. |
731 aBoolean notNil ifTrue:[ |
731 aBoolean notNil ifTrue:[ |
732 activateOnClick := aBoolean. |
732 activateOnClick := aBoolean. |
733 ]. |
733 ]. |
734 ^ prev |
734 ^ prev |
735 |
735 |
736 " |
736 " |
737 Display class activateOnClick:true |
737 Display class activateOnClick:true |
790 "return the state-mask for button1 in motion events state-field. |
790 "return the state-mask for button1 in motion events state-field. |
791 This is the devices mask." |
791 This is the devices mask." |
792 |
792 |
793 %{ /* NOCONTEXT */ |
793 %{ /* NOCONTEXT */ |
794 if (aButton == __MKSMALLINT(1)) { |
794 if (aButton == __MKSMALLINT(1)) { |
795 RETURN (__MKSMALLINT(Button1MotionMask)); |
795 RETURN (__MKSMALLINT(Button1MotionMask)); |
796 } |
796 } |
797 if (aButton == __MKSMALLINT(2)) { |
797 if (aButton == __MKSMALLINT(2)) { |
798 RETURN (__MKSMALLINT(Button2MotionMask)); |
798 RETURN (__MKSMALLINT(Button2MotionMask)); |
799 } |
799 } |
800 if (aButton == __MKSMALLINT(3)) { |
800 if (aButton == __MKSMALLINT(3)) { |
801 RETURN (__MKSMALLINT(Button3MotionMask)); |
801 RETURN (__MKSMALLINT(Button3MotionMask)); |
802 } |
802 } |
803 %}. |
803 %}. |
804 ^ nil |
804 ^ nil |
805 ! |
805 ! |
806 |
806 |
817 "return the displays fileNumber - for select" |
817 "return the displays fileNumber - for select" |
818 |
818 |
819 %{ /* NOCONTEXT */ |
819 %{ /* NOCONTEXT */ |
820 #ifndef WIN32 |
820 #ifndef WIN32 |
821 if (ISCONNECTED) { |
821 if (ISCONNECTED) { |
822 RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) ); |
822 RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) ); |
823 } |
823 } |
824 #endif |
824 #endif |
825 RETURN (nil); |
825 RETURN (nil); |
826 %} |
826 %} |
827 ! |
827 ! |
844 "return the X-servers protocol version - should normally not be of |
844 "return the X-servers protocol version - should normally not be of |
845 any interest" |
845 any interest" |
846 |
846 |
847 %{ /* NOCONTEXT */ |
847 %{ /* NOCONTEXT */ |
848 if (ISCONNECTED) { |
848 if (ISCONNECTED) { |
849 RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) ); |
849 RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) ); |
850 } |
850 } |
851 RETURN (nil); |
851 RETURN (nil); |
852 %} |
852 %} |
853 |
853 |
854 " |
854 " |
860 "return the X-server vendor string - this should normally not be of |
860 "return the X-server vendor string - this should normally not be of |
861 any interest, but can be for special cases |
861 any interest, but can be for special cases |
862 (to avoid bugs in certain implementations)" |
862 (to avoid bugs in certain implementations)" |
863 %{ |
863 %{ |
864 if (ISCONNECTED) { |
864 if (ISCONNECTED) { |
865 RETURN ( __MKSTRING(XServerVendor(myDpy)) ); |
865 RETURN ( __MKSTRING(XServerVendor(myDpy)) ); |
866 } |
866 } |
867 RETURN (nil); |
867 RETURN (nil); |
868 %} |
868 %} |
869 |
869 |
870 " |
870 " |
901 |
901 |
902 if (ISCONNECTED |
902 if (ISCONNECTED |
903 && __isExternalAddress(windowId1) |
903 && __isExternalAddress(windowId1) |
904 && __isExternalAddress(windowId2) |
904 && __isExternalAddress(windowId2) |
905 && __bothSmallInteger(x1, y1)) { |
905 && __bothSmallInteger(x1, y1)) { |
906 Display *dpy = myDpy; |
906 Display *dpy = myDpy; |
907 Window rootWin; |
907 Window rootWin; |
908 |
908 |
909 w1 = __WindowVal(windowId1); |
909 w1 = __WindowVal(windowId1); |
910 w2 = __WindowVal(windowId2); |
910 w2 = __WindowVal(windowId2); |
911 |
911 |
912 rootWin = RootWindow(dpy, screen); |
912 rootWin = RootWindow(dpy, screen); |
913 if (w1 == rootWin) { |
913 if (w1 == rootWin) { |
914 w1 = (Window)__externalAddressVal(rootWindowId); |
914 w1 = (Window)__externalAddressVal(rootWindowId); |
915 } |
915 } |
916 if (w2 == rootWin) { |
916 if (w2 == rootWin) { |
917 w2 = (Window)__externalAddressVal(rootWindowId); |
917 w2 = (Window)__externalAddressVal(rootWindowId); |
918 } |
918 } |
919 |
919 |
920 ENTER_XLIB(); |
920 ENTER_XLIB(); |
921 XTranslateCoordinates(dpy, w1, w2, |
921 XTranslateCoordinates(dpy, w1, w2, |
922 __intVal(x1), __intVal(y1), |
922 __intVal(x1), __intVal(y1), |
923 &xpos, &ypos, &child_ret); |
923 &xpos, &ypos, &child_ret); |
924 LEAVE_XLIB(); |
924 LEAVE_XLIB(); |
925 |
925 |
926 x2 = __MKSMALLINT(xpos); |
926 x2 = __MKSMALLINT(xpos); |
927 y2 = __MKSMALLINT(ypos); |
927 y2 = __MKSMALLINT(ypos); |
928 } |
928 } |
929 %}. |
929 %}. |
930 |
930 |
931 ^ (x2 @ y2) |
931 ^ (x2 @ y2) |
932 ! |
932 ! |
936 any interest, but can be for special cases. |
936 any interest, but can be for special cases. |
937 (to avoid bugs in certain implementations)" |
937 (to avoid bugs in certain implementations)" |
938 |
938 |
939 %{ /* NOCONTEXT */ |
939 %{ /* NOCONTEXT */ |
940 if (ISCONNECTED) { |
940 if (ISCONNECTED) { |
941 RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) ); |
941 RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) ); |
942 } |
942 } |
943 RETURN (nil); |
943 RETURN (nil); |
944 %} |
944 %} |
945 |
945 |
946 " |
946 " |
963 Window child_ret; |
963 Window child_ret; |
964 |
964 |
965 if (ISCONNECTED |
965 if (ISCONNECTED |
966 && __isExternalAddress(windowId) |
966 && __isExternalAddress(windowId) |
967 && __isPoint(aPoint)) { |
967 && __isPoint(aPoint)) { |
968 Display *dpy = myDpy; |
968 Display *dpy = myDpy; |
969 |
969 |
970 xp = _point_X(aPoint); |
970 xp = _point_X(aPoint); |
971 yp = _point_Y(aPoint); |
971 yp = _point_Y(aPoint); |
972 if (__bothSmallInteger(xp, yp)) { |
972 if (__bothSmallInteger(xp, yp)) { |
973 |
973 |
974 ENTER_XLIB(); |
974 ENTER_XLIB(); |
975 XTranslateCoordinates(dpy, |
975 XTranslateCoordinates(dpy, |
976 RootWindow(dpy, screen), |
976 RootWindow(dpy, screen), |
977 __WindowVal(windowId), |
977 __WindowVal(windowId), |
978 __intVal(xp), __intVal(yp), |
978 __intVal(xp), __intVal(yp), |
979 &xpos, &ypos, &child_ret); |
979 &xpos, &ypos, &child_ret); |
980 LEAVE_XLIB(); |
980 LEAVE_XLIB(); |
981 |
981 |
982 if (child_ret) { |
982 if (child_ret) { |
983 RETURN ( __MKEXTERNALADDRESS(child_ret) ); |
983 RETURN ( __MKEXTERNALADDRESS(child_ret) ); |
984 } |
984 } |
985 RETURN ( nil ); |
985 RETURN ( nil ); |
986 } |
986 } |
987 } |
987 } |
988 %}. |
988 %}. |
989 windowId notNil ifTrue:[ |
989 windowId notNil ifTrue:[ |
990 aPoint isPoint ifTrue:[ |
990 aPoint isPoint ifTrue:[ |
991 ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId |
991 ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId |
992 ] |
992 ] |
993 ]. |
993 ]. |
994 |
994 |
995 ^ nil |
995 ^ nil |
996 |
996 |
997 " |
997 " |
1007 |
1007 |
1008 %{ |
1008 %{ |
1009 if (ISCONNECTED |
1009 if (ISCONNECTED |
1010 && (__INST(rootId) != __INST(virtualRootId)) |
1010 && (__INST(rootId) != __INST(virtualRootId)) |
1011 && __isExternalAddress(__INST(virtualRootId))) { |
1011 && __isExternalAddress(__INST(virtualRootId))) { |
1012 Window vRootWin; |
1012 Window vRootWin; |
1013 Window root; |
1013 Window root; |
1014 int x, y; |
1014 int x, y; |
1015 unsigned int width, height; |
1015 unsigned int width, height; |
1016 unsigned int dummy; |
1016 unsigned int dummy; |
1017 int ret; |
1017 int ret; |
1018 |
1018 |
1019 vRootWin = __WindowVal(__INST(virtualRootId)); |
1019 vRootWin = __WindowVal(__INST(virtualRootId)); |
1020 ENTER_XLIB(); |
1020 ENTER_XLIB(); |
1021 ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height, |
1021 ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height, |
1022 &dummy, &dummy); |
1022 &dummy, &dummy); |
1023 LEAVE_XLIB(); |
1023 LEAVE_XLIB(); |
1024 if (ret) { |
1024 if (ret) { |
1025 RETURN ( __MKPOINT_INT(width, height) ); |
1025 RETURN ( __MKPOINT_INT(width, height) ); |
1026 } |
1026 } |
1027 } |
1027 } |
1028 %}. |
1028 %}. |
1029 ^ width @ height |
1029 ^ width @ height |
1030 " |
1030 " |
1031 Display virtualExtent |
1031 Display virtualExtent |
1064 0@0 is returned for systems which locate the resize handles outside the client area. |
1064 0@0 is returned for systems which locate the resize handles outside the client area. |
1065 This may be used by the UI painter or programmatically to reserve some client area. |
1065 This may be used by the UI painter or programmatically to reserve some client area. |
1066 This method must be redefined for displays which need it (i.e. X11 on osx)" |
1066 This method must be redefined for displays which need it (i.e. X11 on osx)" |
1067 |
1067 |
1068 OperatingSystem getOSType == #osx ifTrue:[ |
1068 OperatingSystem getOSType == #osx ifTrue:[ |
1069 "/ should check for local display here - sigh, osx's Xserver does not give |
1069 "/ should check for local display here - sigh, osx's Xserver does not give |
1070 "/ us a hint through the server vendor... |
1070 "/ us a hint through the server vendor... |
1071 ^ 16@16 |
1071 ^ 16@16 |
1072 ]. |
1072 ]. |
1073 ^ 0@0 |
1073 ^ 0@0 |
1074 ! |
1074 ! |
1075 |
1075 |
1076 hasDPS |
1076 hasDPS |
1096 int dummy; |
1096 int dummy; |
1097 OBJ rslt = false; |
1097 OBJ rslt = false; |
1098 |
1098 |
1099 if (ISCONNECTED |
1099 if (ISCONNECTED |
1100 && __isStringLike(extensionString)) { |
1100 && __isStringLike(extensionString)) { |
1101 ENTER_XLIB(); |
1101 ENTER_XLIB(); |
1102 if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) { |
1102 if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) { |
1103 rslt = true; |
1103 rslt = true; |
1104 } |
1104 } |
1105 LEAVE_XLIB(); |
1105 LEAVE_XLIB(); |
1106 } |
1106 } |
1107 RETURN (rslt); |
1107 RETURN (rslt); |
1108 %} |
1108 %} |
1109 |
1109 |
1110 " |
1110 " |
1203 int screen = __intVal(__INST(screen)); |
1203 int screen = __intVal(__INST(screen)); |
1204 XIconSize *sizeList; |
1204 XIconSize *sizeList; |
1205 int cnt; |
1205 int cnt; |
1206 |
1206 |
1207 if (ISCONNECTED) { |
1207 if (ISCONNECTED) { |
1208 Display *dpy = myDpy; |
1208 Display *dpy = myDpy; |
1209 int status; |
1209 int status; |
1210 |
1210 |
1211 ENTER_XLIB(); |
1211 ENTER_XLIB(); |
1212 status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt); |
1212 status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt); |
1213 LEAVE_XLIB(); |
1213 LEAVE_XLIB(); |
1214 if (status > 0) { |
1214 if (status > 0) { |
1215 xIconSizes = __MKEXTERNALBYTES(sizeList); |
1215 xIconSizes = __MKEXTERNALBYTES(sizeList); |
1216 count = __MKSMALLINT(cnt); |
1216 count = __MKSMALLINT(cnt); |
1217 } |
1217 } |
1218 } |
1218 } |
1219 %}. |
1219 %}. |
1220 xIconSizes isNil ifTrue:[^ nil]. |
1220 xIconSizes isNil ifTrue:[^ nil]. |
1221 |
1221 |
1222 ret := OrderedCollection new:count. |
1222 ret := OrderedCollection new:count. |
1223 1 to:count do:[ :i | |
1223 1 to:count do:[ :i | |
1224 |minWidth minHeight maxWidth maxHeight widthStep heightStep d| |
1224 |minWidth minHeight maxWidth maxHeight widthStep heightStep d| |
1225 |
1225 |
1226 %{ |
1226 %{ |
1227 XIconSize *slp; |
1227 XIconSize *slp; |
1228 |
1228 |
1229 slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1]; |
1229 slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1]; |
1230 minWidth = __MKSMALLINT(slp->min_width); |
1230 minWidth = __MKSMALLINT(slp->min_width); |
1231 minHeight = __MKSMALLINT(slp->min_height); |
1231 minHeight = __MKSMALLINT(slp->min_height); |
1232 maxWidth = __MKSMALLINT(slp->max_width); |
1232 maxWidth = __MKSMALLINT(slp->max_width); |
1233 maxHeight = __MKSMALLINT(slp->max_height); |
1233 maxHeight = __MKSMALLINT(slp->max_height); |
1234 widthStep = __MKSMALLINT(slp->width_inc); |
1234 widthStep = __MKSMALLINT(slp->width_inc); |
1235 heightStep = __MKSMALLINT(slp->height_inc); |
1235 heightStep = __MKSMALLINT(slp->height_inc); |
1236 %}. |
1236 %}. |
1237 d := IdentityDictionary new. |
1237 d := IdentityDictionary new. |
1238 d at:#minWidth put:minWidth. |
1238 d at:#minWidth put:minWidth. |
1239 d at:#maxWidth put:maxWidth. |
1239 d at:#maxWidth put:maxWidth. |
1240 d at:#widthStep put:widthStep. |
1240 d at:#widthStep put:widthStep. |
1241 d at:#minHeight put:minHeight. |
1241 d at:#minHeight put:minHeight. |
1242 d at:#maxHeight put:maxHeight. |
1242 d at:#maxHeight put:maxHeight. |
1243 d at:#heightStep put:heightStep. |
1243 d at:#heightStep put:heightStep. |
1244 |
1244 |
1245 ret add:d |
1245 ret add:d |
1246 ]. |
1246 ]. |
1247 |
1247 |
1248 xIconSizes free. |
1248 xIconSizes free. |
1249 ^ ret |
1249 ^ ret |
1250 |
1250 |
1268 |numberOfMonitors resultArray bounds| |
1268 |numberOfMonitors resultArray bounds| |
1269 |
1269 |
1270 %{ |
1270 %{ |
1271 #ifdef XINERAMA |
1271 #ifdef XINERAMA |
1272 if (ISCONNECTED && __INST(hasXineramaExtension) == true) { |
1272 if (ISCONNECTED && __INST(hasXineramaExtension) == true) { |
1273 Display *dpy = myDpy; |
1273 Display *dpy = myDpy; |
1274 XineramaScreenInfo *screenInfo; |
1274 XineramaScreenInfo *screenInfo; |
1275 int numDisplays; |
1275 int numDisplays; |
1276 OBJ *cResultArray; |
1276 OBJ *cResultArray; |
1277 int i, ci; |
1277 int i, ci; |
1278 |
1278 |
1279 screenInfo = XineramaQueryScreens (dpy, &numDisplays); |
1279 screenInfo = XineramaQueryScreens (dpy, &numDisplays); |
1280 if (screenInfo == 0) { |
1280 if (screenInfo == 0) { |
1281 goto out; |
1281 goto out; |
1282 } |
1282 } |
1283 |
1283 |
1284 numberOfMonitors = __mkSmallInteger(numDisplays); |
1284 numberOfMonitors = __mkSmallInteger(numDisplays); |
1285 resultArray = __ARRAY_NEW_INT(numDisplays * 5); |
1285 resultArray = __ARRAY_NEW_INT(numDisplays * 5); |
1286 cResultArray = __ArrayInstPtr(resultArray)->a_element; |
1286 cResultArray = __ArrayInstPtr(resultArray)->a_element; |
1287 |
1287 |
1288 for (i=0, ci=0; i < numDisplays; i++, ci+=5) { |
1288 for (i=0, ci=0; i < numDisplays; i++, ci+=5) { |
1289 cResultArray[ci] = __mkSmallInteger(screenInfo[i].screen_number); |
1289 cResultArray[ci] = __mkSmallInteger(screenInfo[i].screen_number); |
1290 cResultArray[ci+1] = __mkSmallInteger(screenInfo[i].x_org); |
1290 cResultArray[ci+1] = __mkSmallInteger(screenInfo[i].x_org); |
1291 cResultArray[ci+2] = __mkSmallInteger(screenInfo[i].y_org); |
1291 cResultArray[ci+2] = __mkSmallInteger(screenInfo[i].y_org); |
1292 cResultArray[ci+3] = __mkSmallInteger(screenInfo[i].width); |
1292 cResultArray[ci+3] = __mkSmallInteger(screenInfo[i].width); |
1293 cResultArray[ci+4] = __mkSmallInteger(screenInfo[i].height); |
1293 cResultArray[ci+4] = __mkSmallInteger(screenInfo[i].height); |
1294 } |
1294 } |
1295 |
1295 |
1296 XFree(screenInfo); |
1296 XFree(screenInfo); |
1297 } |
1297 } |
1298 #endif |
1298 #endif |
1299 out:; |
1299 out:; |
1300 %}. |
1300 %}. |
1301 numberOfMonitors isNil ifTrue:[ |
1301 numberOfMonitors isNil ifTrue:[ |
1302 "no xinerama - the display is the only monitor" |
1302 "no xinerama - the display is the only monitor" |
1303 ^ Array with:self bounds. |
1303 ^ Array with:self bounds. |
1304 ]. |
1304 ]. |
1305 rawMonitorBounds = resultArray ifTrue:[ |
1305 rawMonitorBounds = resultArray ifTrue:[ |
1306 ^ monitorBounds. |
1306 ^ monitorBounds. |
1307 ]. |
1307 ]. |
1308 |
1308 |
1309 bounds := Array new:numberOfMonitors. |
1309 bounds := Array new:numberOfMonitors. |
1310 1 to:numberOfMonitors do:[:idx| |
1310 1 to:numberOfMonitors do:[:idx| |
1311 |rect baseIdx| |
1311 |rect baseIdx| |
1312 baseIdx := (idx-1) * 5. |
1312 baseIdx := (idx-1) * 5. |
1313 rect := Rectangle |
1313 rect := Rectangle |
1314 left:(resultArray at:baseIdx+2) |
1314 left:(resultArray at:baseIdx+2) |
1315 top:(resultArray at:baseIdx+3) |
1315 top:(resultArray at:baseIdx+3) |
1316 width:(resultArray at:baseIdx+4) |
1316 width:(resultArray at:baseIdx+4) |
1317 height:(resultArray at:baseIdx+5). |
1317 height:(resultArray at:baseIdx+5). |
1318 bounds at:idx put:rect. |
1318 bounds at:idx put:rect. |
1319 ]. |
1319 ]. |
1320 |
1320 |
1321 rawMonitorBounds := resultArray. |
1321 rawMonitorBounds := resultArray. |
1322 monitorBounds := bounds. |
1322 monitorBounds := bounds. |
1323 |
1323 |
1336 monitorBoundsAt:aPoint |
1336 monitorBoundsAt:aPoint |
1337 |bounds| |
1337 |bounds| |
1338 |
1338 |
1339 bounds := self monitorBounds. |
1339 bounds := self monitorBounds. |
1340 ^ bounds |
1340 ^ bounds |
1341 detect:[:eachRectangle| eachRectangle containsPoint:aPoint] |
1341 detect:[:eachRectangle| eachRectangle containsPoint:aPoint] |
1342 ifNone:[super monitorBoundsAt:aPoint]. |
1342 ifNone:[super monitorBoundsAt:aPoint]. |
1343 |
1343 |
1344 " |
1344 " |
1345 Screen current monitorBoundsAt:(0@0) |
1345 Screen current monitorBoundsAt:(0@0) |
1346 Screen current monitorBoundsAt:(1500@0) |
1346 Screen current monitorBoundsAt:(1500@0) |
1347 Screen current monitorBoundsAt:(3000@0) |
1347 Screen current monitorBoundsAt:(3000@0) |
1352 |
1352 |
1353 numberOfMonitors |
1353 numberOfMonitors |
1354 ^ self monitorBounds size |
1354 ^ self monitorBounds size |
1355 |
1355 |
1356 " |
1356 " |
1357 Display numberOfMonitors |
1357 Display numberOfMonitors |
1358 " |
1358 " |
1359 ! |
1359 ! |
1360 |
1360 |
1361 pointIsVisible:aPoint |
1361 pointIsVisible:aPoint |
1362 "is the point visible?" |
1362 "is the point visible?" |
1383 preferredIconSize |
1383 preferredIconSize |
1384 "return the displays preferred size for icons. |
1384 "return the displays preferred size for icons. |
1385 Redefined to return a special value on SGI servers." |
1385 Redefined to return a special value on SGI servers." |
1386 |
1386 |
1387 self serverVendor = 'Silicon Graphics' ifTrue:[ |
1387 self serverVendor = 'Silicon Graphics' ifTrue:[ |
1388 ^ 86@68 |
1388 ^ 86@68 |
1389 ]. |
1389 ]. |
1390 ^ super preferredIconSize |
1390 ^ super preferredIconSize |
1391 |
1391 |
1392 "Created: 10.6.1996 / 21:06:48 / cg" |
1392 "Created: 10.6.1996 / 21:06:48 / cg" |
1393 ! |
1393 ! |
1405 |
1405 |
1406 |minH| |
1406 |minH| |
1407 |
1407 |
1408 minH := self usableHeight. |
1408 minH := self usableHeight. |
1409 self monitorBounds do:[:eachBounds | |
1409 self monitorBounds do:[:eachBounds | |
1410 minH := minH min: eachBounds height. |
1410 minH := minH min: eachBounds height. |
1411 ]. |
1411 ]. |
1412 ^ minH |
1412 ^ minH |
1413 |
1413 |
1414 " |
1414 " |
1415 Display smallestMonitorHeight |
1415 Display smallestMonitorHeight |
1416 " |
1416 " |
1417 ! |
1417 ! |
1418 |
1418 |
1419 supportedImageFormats |
1419 supportedImageFormats |
1420 "return an array with supported image formats; |
1420 "return an array with supported image formats; |
1425 formatArray| |
1425 formatArray| |
1426 %{ |
1426 %{ |
1427 Display *dpy; |
1427 Display *dpy; |
1428 |
1428 |
1429 if (! ISCONNECTED) { |
1429 if (! ISCONNECTED) { |
1430 RETURN (nil); |
1430 RETURN (nil); |
1431 } |
1431 } |
1432 |
1432 |
1433 dpy = myDpy; |
1433 dpy = myDpy; |
1434 #ifdef NO_PRIVATE_DISPLAY_ACCESS |
1434 #ifdef NO_PRIVATE_DISPLAY_ACCESS |
1435 nFormats = __MKSMALLINT(1); |
1435 nFormats = __MKSMALLINT(1); |
1437 nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats); |
1437 nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats); |
1438 #endif |
1438 #endif |
1439 %}. |
1439 %}. |
1440 formatArray := Array new:nFormats. |
1440 formatArray := Array new:nFormats. |
1441 1 to:nFormats do:[:index | |
1441 1 to:nFormats do:[:index | |
1442 |info bitsPerPixelInfo depthInfo paddingInfo i| |
1442 |info bitsPerPixelInfo depthInfo paddingInfo i| |
1443 |
1443 |
1444 i := index. |
1444 i := index. |
1445 %{ |
1445 %{ |
1446 ScreenFormat *format; |
1446 ScreenFormat *format; |
1447 Display *dpy = myDpy; |
1447 Display *dpy = myDpy; |
1448 |
1448 |
1449 #ifdef NO_PRIVATE_DISPLAY_ACCESS |
1449 #ifdef NO_PRIVATE_DISPLAY_ACCESS |
1450 depthInfo = __MKSMALLINT(1); |
1450 depthInfo = __MKSMALLINT(1); |
1451 bitsPerPixelInfo = __MKSMALLINT(1); |
1451 bitsPerPixelInfo = __MKSMALLINT(1); |
1452 paddingInfo = __MKSMALLINT(8); |
1452 paddingInfo = __MKSMALLINT(8); |
1453 #else |
1453 #else |
1454 format = DISPLAYACCESS(dpy)->pixmap_format; |
1454 format = DISPLAYACCESS(dpy)->pixmap_format; |
1455 format += (__intVal(i)-1); |
1455 format += (__intVal(i)-1); |
1456 bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel); |
1456 bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel); |
1457 depthInfo = __MKSMALLINT(format->depth); |
1457 depthInfo = __MKSMALLINT(format->depth); |
1458 paddingInfo = __MKSMALLINT(format->scanline_pad); |
1458 paddingInfo = __MKSMALLINT(format->scanline_pad); |
1459 #endif |
1459 #endif |
1460 %}. |
1460 %}. |
1461 info := IdentityDictionary new. |
1461 info := IdentityDictionary new. |
1462 info at:#depth put:depthInfo. |
1462 info at:#depth put:depthInfo. |
1463 info at:#bitsPerPixel put:bitsPerPixelInfo. |
1463 info at:#bitsPerPixel put:bitsPerPixelInfo. |
1464 info at:#padding put:paddingInfo. |
1464 info at:#padding put:paddingInfo. |
1465 formatArray at:index put:info. |
1465 formatArray at:index put:info. |
1466 ]. |
1466 ]. |
1467 ^ formatArray |
1467 ^ formatArray |
1468 |
1468 |
1469 " |
1469 " |
1470 Display supportedImageFormats |
1470 Display supportedImageFormats |
1545 |
1545 |
1546 |h| |
1546 |h| |
1547 |
1547 |
1548 h := (self monitorBoundsAt:aPoint) height. |
1548 h := (self monitorBoundsAt:aPoint) height. |
1549 OperatingSystem isOSXlike ifTrue:[ |
1549 OperatingSystem isOSXlike ifTrue:[ |
1550 "/ take away some space for the icon-panel at the bottom. |
1550 "/ take away some space for the icon-panel at the bottom. |
1551 ^ h - 50 |
1551 ^ h - 50 |
1552 ]. |
1552 ]. |
1553 ^ h |
1553 ^ h |
1554 |
1554 |
1555 " |
1555 " |
1556 Screen current usableHeightAt:(0@0) |
1556 Screen current usableHeightAt:(0@0) |
1569 |
1569 |
1570 |bitmapId| |
1570 |bitmapId| |
1571 |
1571 |
1572 bitmapId := self primCreateBitmapFromArray:anArray width:w height:h. |
1572 bitmapId := self primCreateBitmapFromArray:anArray width:w height:h. |
1573 bitmapId isNil ifTrue:[ |
1573 bitmapId isNil ifTrue:[ |
1574 self primitiveFailedOrClosedConnection |
1574 self primitiveFailedOrClosedConnection |
1575 ]. |
1575 ]. |
1576 ^ bitmapId |
1576 ^ bitmapId |
1577 ! |
1577 ! |
1578 |
1578 |
1579 createBitmapFromFile:aString for:aForm |
1579 createBitmapFromFile:aString for:aForm |
1584 %{ |
1584 %{ |
1585 int screen = __intVal(__INST(screen)); |
1585 int screen = __intVal(__INST(screen)); |
1586 |
1586 |
1587 if (ISCONNECTED |
1587 if (ISCONNECTED |
1588 && __isStringLike(aString)) { |
1588 && __isStringLike(aString)) { |
1589 Display *dpy = myDpy; |
1589 Display *dpy = myDpy; |
1590 char *filename; |
1590 char *filename; |
1591 int status; |
1591 int status; |
1592 Pixmap newBitmap; |
1592 Pixmap newBitmap; |
1593 unsigned b_width, b_height; |
1593 unsigned b_width, b_height; |
1594 int b_x_hot, b_y_hot; |
1594 int b_x_hot, b_y_hot; |
1595 |
1595 |
1596 filename = (char *) __stringVal(aString); |
1596 filename = (char *) __stringVal(aString); |
1597 |
1597 |
1598 |
1598 |
1599 ENTER_XLIB(); |
1599 ENTER_XLIB(); |
1600 status = XReadBitmapFile(dpy, RootWindow(dpy, screen), |
1600 status = XReadBitmapFile(dpy, RootWindow(dpy, screen), |
1601 filename, &b_width, &b_height, &newBitmap, |
1601 filename, &b_width, &b_height, &newBitmap, |
1602 &b_x_hot, &b_y_hot); |
1602 &b_x_hot, &b_y_hot); |
1603 LEAVE_XLIB(); |
1603 LEAVE_XLIB(); |
1604 |
1604 |
1605 |
1605 |
1606 if ((status == BitmapSuccess) && newBitmap) { |
1606 if ((status == BitmapSuccess) && newBitmap) { |
1607 #ifdef COUNT_RESOURCES |
1607 #ifdef COUNT_RESOURCES |
1608 __cnt_bitmap++; |
1608 __cnt_bitmap++; |
1609 #endif |
1609 #endif |
1610 w = __MKSMALLINT(b_width); |
1610 w = __MKSMALLINT(b_width); |
1611 h = __MKSMALLINT(b_height); |
1611 h = __MKSMALLINT(b_height); |
1612 id = __MKEXTERNALADDRESS(newBitmap); |
1612 id = __MKEXTERNALADDRESS(newBitmap); |
1613 } |
1613 } |
1614 } |
1614 } |
1615 %}. |
1615 %}. |
1616 id notNil ifTrue:[ |
1616 id notNil ifTrue:[ |
1617 aForm setWidth:w height:h |
1617 aForm setWidth:w height:h |
1618 ]. |
1618 ]. |
1619 ^ id |
1619 ^ id |
1620 ! |
1620 ! |
1621 |
1621 |
1622 createBitmapWidth:w height:h |
1622 createBitmapWidth:w height:h |
1628 %{ |
1628 %{ |
1629 int screen = __intVal(__INST(screen)); |
1629 int screen = __intVal(__INST(screen)); |
1630 Pixmap newBitmap; |
1630 Pixmap newBitmap; |
1631 |
1631 |
1632 if (__bothSmallInteger(w, h) && ISCONNECTED) { |
1632 if (__bothSmallInteger(w, h) && ISCONNECTED) { |
1633 Display *dpy = myDpy; |
1633 Display *dpy = myDpy; |
1634 |
1634 |
1635 |
1635 |
1636 ENTER_XLIB(); |
1636 ENTER_XLIB(); |
1637 newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1637 newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1638 __intVal(w), __intVal(h), 1); |
1638 __intVal(w), __intVal(h), 1); |
1639 LEAVE_XLIB(); |
1639 LEAVE_XLIB(); |
1640 #ifdef COUNT_RESOURCES |
1640 #ifdef COUNT_RESOURCES |
1641 if (newBitmap) |
1641 if (newBitmap) |
1642 __cnt_bitmap++; |
1642 __cnt_bitmap++; |
1643 #endif |
1643 #endif |
1644 |
1644 |
1645 RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
1645 RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
1646 } |
1646 } |
1647 %}. |
1647 %}. |
1648 self primitiveFailedOrClosedConnection. |
1648 self primitiveFailedOrClosedConnection. |
1649 ^ nil |
1649 ^ nil |
1650 ! |
1650 ! |
1658 |
1658 |
1659 int screen = __intVal(__INST(screen)); |
1659 int screen = __intVal(__INST(screen)); |
1660 Pixmap newBitmap; |
1660 Pixmap newBitmap; |
1661 |
1661 |
1662 if (__bothSmallInteger(w, h) && ISCONNECTED) { |
1662 if (__bothSmallInteger(w, h) && ISCONNECTED) { |
1663 Display *dpy = myDpy; |
1663 Display *dpy = myDpy; |
1664 |
1664 |
1665 |
1665 |
1666 ENTER_XLIB(); |
1666 ENTER_XLIB(); |
1667 newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1667 newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1668 __intVal(w), __intVal(h), __intVal(d)); |
1668 __intVal(w), __intVal(h), __intVal(d)); |
1669 LEAVE_XLIB(); |
1669 LEAVE_XLIB(); |
1670 #ifdef COUNT_RESOURCES |
1670 #ifdef COUNT_RESOURCES |
1671 if (newBitmap) |
1671 if (newBitmap) |
1672 __cnt_bitmap++; |
1672 __cnt_bitmap++; |
1673 #endif |
1673 #endif |
1674 |
1674 |
1675 RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
1675 RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
1676 } |
1676 } |
1677 %}. |
1677 %}. |
1678 self primitiveFailedOrClosedConnection. |
1678 self primitiveFailedOrClosedConnection. |
1679 ^ nil |
1679 ^ nil |
1680 ! |
1680 ! |
1681 |
1681 |
1682 createWindowFor:aView type:typeSymbol |
1682 createWindowFor:aView type:typeSymbol |
1683 origin:origin |
1683 origin:origin |
1684 extent:extent |
1684 extent:extent |
1685 minExtent:minExt |
1685 minExtent:minExt |
1686 maxExtent:maxExt |
1686 maxExtent:maxExt |
1687 borderWidth:bWidth |
1687 borderWidth:bWidth |
1688 subViewOf:wsuperView |
1688 subViewOf:wsuperView |
1689 style:wStyle |
1689 style:wStyle |
1690 inputOnly:winputOnly |
1690 inputOnly:winputOnly |
1691 label:wlabel |
1691 label:wlabel |
1692 owner:wowner |
1692 owner:wowner |
1693 icon:wicon iconMask:wiconMask |
1693 icon:wicon iconMask:wiconMask |
1694 iconView:wiconView |
1694 iconView:wiconView |
1695 |
1695 |
1696 <context: #return> |
1696 <context: #return> |
1697 |
1697 |
1698 |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight |
1698 |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight |
1699 bColorId wsuperViewId windowId isTopWindow |
1699 bColorId wsuperViewId windowId isTopWindow |
1700 weventMask bitGravity viewGravity vBgColor |
1700 weventMask bitGravity viewGravity vBgColor |
1701 vBgForm deepForm preferredVisual preferredDepth |
1701 vBgForm deepForm preferredVisual preferredDepth |
1702 wiconId wiconMaskId wiconViewId windowGroupWindowId| |
1702 wiconId wiconMaskId wiconViewId windowGroupWindowId| |
1703 |
1703 |
1704 displayId isNil ifTrue:[ |
1704 displayId isNil ifTrue:[ |
1705 self primitiveFailedOrClosedConnection. |
1705 self primitiveFailedOrClosedConnection. |
1706 ^ nil |
1706 ^ nil |
1707 ]. |
1707 ]. |
1708 |
1708 |
1709 origin notNil ifTrue:[ |
1709 origin notNil ifTrue:[ |
1710 xpos := origin x. |
1710 xpos := origin x. |
1711 ypos := origin y. |
1711 ypos := origin y. |
1712 ] ifFalse:[ |
1712 ] ifFalse:[ |
1713 xpos := ypos := 0. |
1713 xpos := ypos := 0. |
1714 ]. |
1714 ]. |
1715 extent notNil ifTrue:[ |
1715 extent notNil ifTrue:[ |
1716 wwidth := extent x. |
1716 wwidth := extent x. |
1717 wheight := extent y. |
1717 wheight := extent y. |
1718 ] ifFalse:[ |
1718 ] ifFalse:[ |
1719 wwidth := wheight := 100. |
1719 wwidth := wheight := 100. |
1720 ]. |
1720 ]. |
1721 minExt notNil ifTrue:[ |
1721 minExt notNil ifTrue:[ |
1722 minWidth := minExt x. |
1722 minWidth := minExt x. |
1723 minHeight := minExt y |
1723 minHeight := minExt y |
1724 ]. |
1724 ]. |
1725 maxExt notNil ifTrue:[ |
1725 maxExt notNil ifTrue:[ |
1726 maxWidth := maxExt x. |
1726 maxWidth := maxExt x. |
1727 maxHeight := maxExt y |
1727 maxHeight := maxExt y |
1728 ]. |
1728 ]. |
1729 |
1729 |
1730 wsuperView notNil ifTrue:[ |
1730 wsuperView notNil ifTrue:[ |
1731 wsuperViewId := wsuperView id |
1731 wsuperViewId := wsuperView id |
1732 ] ifFalse:[ |
1732 ] ifFalse:[ |
1733 isTopWindow := true. |
1733 isTopWindow := true. |
1734 aView class ~~ WindowGroupWindow ifTrue:[ |
1734 aView class ~~ WindowGroupWindow ifTrue:[ |
1735 windowGroupWindow isNil ifTrue:[ |
1735 windowGroupWindow isNil ifTrue:[ |
1736 self getWindowGroupWindow. |
1736 self getWindowGroupWindow. |
1737 ]. |
1737 ]. |
1738 windowGroupWindowId := windowGroupWindow id. |
1738 windowGroupWindowId := windowGroupWindow id. |
1739 ]. |
1739 ]. |
1740 wicon notNil ifTrue:[ |
1740 wicon notNil ifTrue:[ |
1741 wiconId := wicon id. |
1741 wiconId := wicon id. |
1742 wiconMask notNil ifTrue:[ |
1742 wiconMask notNil ifTrue:[ |
1743 wiconMaskId := wiconMask id |
1743 wiconMaskId := wiconMask id |
1744 ] |
1744 ] |
1745 ]. |
1745 ]. |
1746 wiconView notNil ifTrue:[ |
1746 wiconView notNil ifTrue:[ |
1747 wiconViewId := wiconView id |
1747 wiconViewId := wiconView id |
1748 ]. |
1748 ]. |
1749 ]. |
1749 ]. |
1750 |
1750 |
1751 weventMask := aView eventMask. |
1751 weventMask := aView eventMask. |
1752 |
1752 |
1753 preferredVisual := aView preferredVisual. |
1753 preferredVisual := aView preferredVisual. |
1777 sizehints.height = 100; |
1777 sizehints.height = 100; |
1778 sizehints.x = 0; |
1778 sizehints.x = 0; |
1779 sizehints.y = 0; |
1779 sizehints.y = 0; |
1780 |
1780 |
1781 if (__bothSmallInteger(wwidth, wheight)) { |
1781 if (__bothSmallInteger(wwidth, wheight)) { |
1782 sizehints.flags |= PSize; |
1782 sizehints.flags |= PSize; |
1783 sizehints.width = __intVal(wwidth); |
1783 sizehints.width = __intVal(wwidth); |
1784 sizehints.height = __intVal(wheight); |
1784 sizehints.height = __intVal(wheight); |
1785 } |
1785 } |
1786 if (__bothSmallInteger(xpos, ypos)) { |
1786 if (__bothSmallInteger(xpos, ypos)) { |
1787 sizehints.flags |= PPosition; |
1787 sizehints.flags |= PPosition; |
1788 sizehints.x = __intVal(xpos); |
1788 sizehints.x = __intVal(xpos); |
1789 sizehints.y = __intVal(ypos); |
1789 sizehints.y = __intVal(ypos); |
1790 } |
1790 } |
1791 if (__bothSmallInteger(minWidth, minHeight)) { |
1791 if (__bothSmallInteger(minWidth, minHeight)) { |
1792 sizehints.flags |= PMinSize; |
1792 sizehints.flags |= PMinSize; |
1793 sizehints.min_width = __intVal(minWidth); |
1793 sizehints.min_width = __intVal(minWidth); |
1794 sizehints.min_height = __intVal(minHeight); |
1794 sizehints.min_height = __intVal(minHeight); |
1795 } |
1795 } |
1796 if (__bothSmallInteger(maxWidth, maxHeight)) { |
1796 if (__bothSmallInteger(maxWidth, maxHeight)) { |
1797 sizehints.flags |= PMaxSize; |
1797 sizehints.flags |= PMaxSize; |
1798 sizehints.max_width = __intVal(maxWidth); |
1798 sizehints.max_width = __intVal(maxWidth); |
1799 sizehints.max_height = __intVal(maxHeight); |
1799 sizehints.max_height = __intVal(maxHeight); |
1800 } |
1800 } |
1801 |
1801 |
1802 bg = WhitePixel(dpy, screen); |
1802 bg = WhitePixel(dpy, screen); |
1803 |
1803 |
1804 if (__isSmallInteger(bWidth)) { |
1804 if (__isSmallInteger(bWidth)) { |
1805 bw = __intVal(bWidth); |
1805 bw = __intVal(bWidth); |
1806 } else { |
1806 } else { |
1807 bw = 0; |
1807 bw = 0; |
1808 } |
1808 } |
1809 |
1809 |
1810 bd = BlackPixel(dpy, screen); |
1810 bd = BlackPixel(dpy, screen); |
1811 |
1811 |
1812 if (__isExternalAddress(wsuperViewId)) { |
1812 if (__isExternalAddress(wsuperViewId)) { |
1813 parentWindow = __WindowVal(wsuperViewId); |
1813 parentWindow = __WindowVal(wsuperViewId); |
1814 } else { |
1814 } else { |
1815 parentWindow = RootWindow(dpy, screen); |
1815 parentWindow = RootWindow(dpy, screen); |
1816 } |
1816 } |
1817 |
1817 |
1818 if (wStyle == @symbol(popUp)) |
1818 if (wStyle == @symbol(popUp)) |
1819 xswa.override_redirect = 1; |
1819 xswa.override_redirect = 1; |
1820 else |
1820 else |
1821 xswa.override_redirect = 0; |
1821 xswa.override_redirect = 0; |
1822 |
1822 |
1823 if (winputOnly == true) |
1823 if (winputOnly == true) |
1824 ioClass = InputOnly; |
1824 ioClass = InputOnly; |
1825 else |
1825 else |
1826 ioClass = InputOutput; |
1826 ioClass = InputOutput; |
1827 |
1827 |
1828 if (__isSmallInteger(weventMask)) { |
1828 if (__isSmallInteger(weventMask)) { |
1829 xswa.event_mask = __intVal(weventMask); |
1829 xswa.event_mask = __intVal(weventMask); |
1830 } else { |
1830 } else { |
1831 xswa.event_mask = 0; |
1831 xswa.event_mask = 0; |
1832 } |
1832 } |
1833 |
1833 |
1834 if (ioClass == InputOnly) { |
1834 if (ioClass == InputOnly) { |
1835 bw = 0; |
1835 bw = 0; |
1836 depth = 0; |
1836 depth = 0; |
1837 flags |= CWEventMask; |
1837 flags |= CWEventMask; |
1838 } else { |
1838 } else { |
1839 depth = DefaultDepth(dpy,screen); |
1839 depth = DefaultDepth(dpy,screen); |
1840 flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect; |
1840 flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect; |
1841 |
1841 |
1842 if (backPixmap != (Pixmap)0) { |
1842 if (backPixmap != (Pixmap)0) { |
1843 xswa.background_pixmap = backPixmap; |
1843 xswa.background_pixmap = backPixmap; |
1844 flags |= CWBackPixmap; |
1844 flags |= CWBackPixmap; |
1845 } else { |
1845 } else { |
1846 xswa.background_pixel = bg; |
1846 xswa.background_pixel = bg; |
1847 flags |= CWBackPixel; |
1847 flags |= CWBackPixel; |
1848 } |
1848 } |
1849 xswa.border_pixel = bd; |
1849 xswa.border_pixel = bd; |
1850 } |
1850 } |
1851 |
1851 |
1852 visual.visualid = CopyFromParent; |
1852 visual.visualid = CopyFromParent; |
1853 if (__isSmallInteger(preferredDepth)) { |
1853 if (__isSmallInteger(preferredDepth)) { |
1854 depth = __intVal(preferredDepth); |
1854 depth = __intVal(preferredDepth); |
1855 } |
1855 } |
1856 |
1856 |
1857 |
1857 |
1858 if (preferredVisual != nil) { |
1858 if (preferredVisual != nil) { |
1859 XVisualInfo vi; |
1859 XVisualInfo vi; |
1860 int cls; |
1860 int cls; |
1861 |
1861 |
1862 if (preferredVisual == @symbol(StaticGray)) |
1862 if (preferredVisual == @symbol(StaticGray)) |
1863 cls = StaticGray; |
1863 cls = StaticGray; |
1864 else if (preferredVisual == @symbol(GrayScale)) |
1864 else if (preferredVisual == @symbol(GrayScale)) |
1865 cls = GrayScale; |
1865 cls = GrayScale; |
1866 else if (preferredVisual == @symbol(StaticColor)) |
1866 else if (preferredVisual == @symbol(StaticColor)) |
1867 cls = StaticColor; |
1867 cls = StaticColor; |
1868 else if (preferredVisual == @symbol(PseudoColor)) |
1868 else if (preferredVisual == @symbol(PseudoColor)) |
1869 cls = PseudoColor; |
1869 cls = PseudoColor; |
1870 else if (preferredVisual == @symbol(TrueColor)) |
1870 else if (preferredVisual == @symbol(TrueColor)) |
1871 cls = TrueColor; |
1871 cls = TrueColor; |
1872 else if (preferredVisual == @symbol(DirectColor)) |
1872 else if (preferredVisual == @symbol(DirectColor)) |
1873 cls = DirectColor; |
1873 cls = DirectColor; |
1874 else |
1874 else |
1875 cls = PseudoColor; |
1875 cls = PseudoColor; |
1876 |
1876 |
1877 ENTER_XLIB(); |
1877 ENTER_XLIB(); |
1878 if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) { |
1878 if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) { |
1879 visual.visualid = vi.visualid; |
1879 visual.visualid = vi.visualid; |
1880 /* |
1880 /* |
1881 console_fprintf(stderr, "visualId=%x\n", vi.visualid); |
1881 console_fprintf(stderr, "visualId=%x\n", vi.visualid); |
1882 */ |
1882 */ |
1883 } |
1883 } |
1884 LEAVE_XLIB(); |
1884 LEAVE_XLIB(); |
1885 } |
1885 } |
1886 |
1886 |
1887 ENTER_XLIB2(); |
1887 ENTER_XLIB2(); |
1888 newWindow = XCreateWindow(dpy, parentWindow, |
1888 newWindow = XCreateWindow(dpy, parentWindow, |
1889 sizehints.x, sizehints.y, |
1889 sizehints.x, sizehints.y, |
1890 sizehints.width, sizehints.height, |
1890 sizehints.width, sizehints.height, |
1891 bw, depth, ioClass, &visual, |
1891 bw, depth, ioClass, &visual, |
1892 flags, &xswa); |
1892 flags, &xswa); |
1893 LEAVE_XLIB(); |
1893 LEAVE_XLIB(); |
1894 |
1894 |
1895 |
1895 |
1896 if (! newWindow) { |
1896 if (! newWindow) { |
1897 RETURN ( nil ); |
1897 RETURN ( nil ); |
1898 } |
1898 } |
1899 |
1899 |
1900 #ifdef COUNT_RESOURCES |
1900 #ifdef COUNT_RESOURCES |
1901 __cnt_view++; |
1901 __cnt_view++; |
1902 #endif |
1902 #endif |
1904 /* |
1904 /* |
1905 * define its icon and name |
1905 * define its icon and name |
1906 * (only makes sense for topWindows) |
1906 * (only makes sense for topWindows) |
1907 */ |
1907 */ |
1908 if (isTopWindow == true) { |
1908 if (isTopWindow == true) { |
1909 XWMHints wmhints; |
1909 XWMHints wmhints; |
1910 |
1910 |
1911 wmhints.flags = 0; |
1911 wmhints.flags = 0; |
1912 |
1912 |
1913 if (__isExternalAddress(wiconId)) { |
1913 if (__isExternalAddress(wiconId)) { |
1914 wmhints.icon_pixmap = __PixmapVal(wiconId); |
1914 wmhints.icon_pixmap = __PixmapVal(wiconId); |
1915 wmhints.flags = IconPixmapHint; |
1915 wmhints.flags = IconPixmapHint; |
1916 if (__isExternalAddress(wiconMaskId)) { |
1916 if (__isExternalAddress(wiconMaskId)) { |
1917 wmhints.icon_mask = __PixmapVal(wiconMaskId); |
1917 wmhints.icon_mask = __PixmapVal(wiconMaskId); |
1918 wmhints.flags |= IconMaskHint; |
1918 wmhints.flags |= IconMaskHint; |
1919 } |
1919 } |
1920 } |
1920 } |
1921 |
1921 |
1922 if (__isExternalAddress(windowGroupWindowId)) { |
1922 if (__isExternalAddress(windowGroupWindowId)) { |
1923 wmhints.window_group = __WindowVal(windowGroupWindowId); |
1923 wmhints.window_group = __WindowVal(windowGroupWindowId); |
1924 wmhints.flags |= WindowGroupHint; |
1924 wmhints.flags |= WindowGroupHint; |
1925 } |
1925 } |
1926 |
1926 |
1927 if (__isExternalAddress(wiconViewId)) { |
1927 if (__isExternalAddress(wiconViewId)) { |
1928 wmhints.flags |= IconWindowHint; |
1928 wmhints.flags |= IconWindowHint; |
1929 wmhints.icon_window = __WindowVal(wiconViewId); |
1929 wmhints.icon_window = __WindowVal(wiconViewId); |
1930 }; |
1930 }; |
1931 |
1931 |
1932 /* |
1932 /* |
1933 wmhints.flags |= InputHint; |
1933 wmhints.flags |= InputHint; |
1934 wmhints.input = True; |
1934 wmhints.input = True; |
1935 */ |
1935 */ |
1936 ENTER_XLIB(); |
1936 ENTER_XLIB(); |
1937 XSetWMHints(dpy, newWindow, &wmhints); |
1937 XSetWMHints(dpy, newWindow, &wmhints); |
1938 XSetWMNormalHints(dpy, newWindow, &sizehints); |
1938 XSetWMNormalHints(dpy, newWindow, &sizehints); |
1939 LEAVE_XLIB(); |
1939 LEAVE_XLIB(); |
1940 |
1940 |
1941 /* |
1941 /* |
1942 * get atoms first (if not already known) |
1942 * get atoms first (if not already known) |
1943 */ |
1943 */ |
1944 if (__INST(protocolsAtom) == nil) { |
1944 if (__INST(protocolsAtom) == nil) { |
1945 ENTER_XLIB(); |
1945 ENTER_XLIB(); |
1946 WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False); |
1946 WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False); |
1947 __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom); |
1947 __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom); |
1948 #ifdef USE_SAVEYOURSELF_ATOM |
1948 #ifdef USE_SAVEYOURSELF_ATOM |
1949 WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False); |
1949 WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False); |
1950 __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom); |
1950 __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom); |
1951 #endif |
1951 #endif |
1952 #ifdef USE_QUIT_APP_ATOM |
1952 #ifdef USE_QUIT_APP_ATOM |
1953 WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False); |
1953 WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False); |
1954 __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom); |
1954 __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom); |
1955 #endif |
1955 #endif |
1956 WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
1956 WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
1957 __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom); |
1957 __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom); |
1958 |
1958 |
1959 UUIDAtom = XInternAtom(dpy, "UUID", False); |
1959 UUIDAtom = XInternAtom(dpy, "UUID", False); |
1960 __INST(uuidAtom) = __MKATOMOBJ(UUIDAtom); |
1960 __INST(uuidAtom) = __MKATOMOBJ(UUIDAtom); |
1961 STXDeviceAtom = XInternAtom(dpy, "STX_DEVICE_ID", False); |
1961 STXDeviceAtom = XInternAtom(dpy, "STX_DEVICE_ID", False); |
1962 __INST(stxDeviceAtom) = __MKATOMOBJ(STXDeviceAtom); |
1962 __INST(stxDeviceAtom) = __MKATOMOBJ(STXDeviceAtom); |
1963 |
1963 |
1964 LEAVE_XLIB(); |
1964 LEAVE_XLIB(); |
1965 } else { |
1965 } else { |
1966 #ifdef USE_QUIT_APP_ATOM |
1966 #ifdef USE_QUIT_APP_ATOM |
1967 WmQuitAppAtom = __AtomVal(__INST(quitAppAtom)); |
1967 WmQuitAppAtom = __AtomVal(__INST(quitAppAtom)); |
1968 #else |
1968 #else |
1969 WmQuitAppAtom = 0; |
1969 WmQuitAppAtom = 0; |
1970 #endif |
1970 #endif |
1971 WmProtocolsAtom = __AtomVal(__INST(protocolsAtom)); |
1971 WmProtocolsAtom = __AtomVal(__INST(protocolsAtom)); |
1972 WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom)); |
1972 WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom)); |
1973 #ifdef USE_SAVEYOURSELF_ATOM |
1973 #ifdef USE_SAVEYOURSELF_ATOM |
1974 WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom)); |
1974 WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom)); |
1975 #else |
1975 #else |
1976 WmSaveYourselfAtom = 0; |
1976 WmSaveYourselfAtom = 0; |
1977 #endif |
1977 #endif |
1978 UUIDAtom = __AtomVal(__INST(uuidAtom));; |
1978 UUIDAtom = __AtomVal(__INST(uuidAtom));; |
1979 STXDeviceAtom = __AtomVal(__INST(stxDeviceAtom));; |
1979 STXDeviceAtom = __AtomVal(__INST(stxDeviceAtom));; |
1980 } |
1980 } |
1981 |
1981 |
1982 /* |
1982 /* |
1983 * tell window manager to not kill us but send an event instead |
1983 * tell window manager to not kill us but send an event instead |
1984 */ |
1984 */ |
1985 atoms[0] = WmDeleteWindowAtom; atomCount++; |
1985 atoms[0] = WmDeleteWindowAtom; atomCount++; |
1986 #ifdef USE_SAVEYOURSELF_ATOM |
1986 #ifdef USE_SAVEYOURSELF_ATOM |
1987 atoms[atomCount] = WmSaveYourselfAtom; atomCount++; |
1987 atoms[atomCount] = WmSaveYourselfAtom; atomCount++; |
1988 #endif |
1988 #endif |
1989 #ifdef USE_QUIT_APP_ATOM |
1989 #ifdef USE_QUIT_APP_ATOM |
1990 atoms[atomCount] = WmQuitAppAtom; atomCount++; |
1990 atoms[atomCount] = WmQuitAppAtom; atomCount++; |
1991 #endif |
1991 #endif |
1992 ENTER_XLIB(); |
1992 ENTER_XLIB(); |
1993 XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM, |
1993 XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM, |
1994 32, PropModeReplace, (unsigned char *)atoms, atomCount); |
1994 32, PropModeReplace, (unsigned char *)atoms, atomCount); |
1995 LEAVE_XLIB(); |
1995 LEAVE_XLIB(); |
1996 |
1996 |
1997 /* |
1997 /* |
1998 * an optional unique id (to mark stx-windows) |
1998 * an optional unique id (to mark stx-windows) |
1999 */ |
1999 */ |
2000 if (__isBytes(__INST(uniqueDeviceID))) { |
2000 if (__isBytes(__INST(uniqueDeviceID))) { |
2001 int numUUIDBytes = __byteArraySize(__INST(uniqueDeviceID)); |
2001 int numUUIDBytes = __byteArraySize(__INST(uniqueDeviceID)); |
2002 unsigned char uuidBytes[32]; |
2002 unsigned char uuidBytes[32]; |
2003 |
2003 |
2004 if (numUUIDBytes <= sizeof(uuidBytes)) { |
2004 if (numUUIDBytes <= sizeof(uuidBytes)) { |
2005 Atom uuidAtom; |
2005 Atom uuidAtom; |
2006 |
2006 |
2007 bcopy(__byteArrayVal(__INST(uniqueDeviceID)), uuidBytes, numUUIDBytes); |
2007 bcopy(__byteArrayVal(__INST(uniqueDeviceID)), uuidBytes, numUUIDBytes); |
2008 |
2008 |
2009 ENTER_XLIB(); |
2009 ENTER_XLIB(); |
2010 XChangeProperty (dpy, newWindow, STXDeviceAtom, UUIDAtom, 8, PropModeReplace, |
2010 XChangeProperty (dpy, newWindow, STXDeviceAtom, UUIDAtom, 8, PropModeReplace, |
2011 uuidBytes, numUUIDBytes ); |
2011 uuidBytes, numUUIDBytes ); |
2012 LEAVE_XLIB(); |
2012 LEAVE_XLIB(); |
2013 } |
2013 } |
2014 } |
2014 } |
2015 |
2015 |
2016 #ifdef SUPPORT_MOTIF_WM_HINTS |
2016 #ifdef SUPPORT_MOTIF_WM_HINTS |
2017 /* |
2017 /* |
2018 * less decoration |
2018 * less decoration |
2019 */ |
2019 */ |
2020 if ((wStyle == @symbol(undecorated)) |
2020 if ((wStyle == @symbol(undecorated)) |
2021 || (wStyle == @symbol(dialog2)) |
2021 || (wStyle == @symbol(dialog2)) |
2022 || (wStyle == @symbol(notitle)) |
2022 || (wStyle == @symbol(notitle)) |
2023 ) { |
2023 ) { |
2024 if (__INST(motifWMHintsAtom) == nil) { |
2024 if (__INST(motifWMHintsAtom) == nil) { |
2025 ENTER_XLIB(); |
2025 ENTER_XLIB(); |
2026 MotifWMHintsAtom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False); |
2026 MotifWMHintsAtom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False); |
2027 __INST(motifWMHintsAtom) = __MKATOMOBJ(MotifWMHintsAtom); |
2027 __INST(motifWMHintsAtom) = __MKATOMOBJ(MotifWMHintsAtom); |
2028 LEAVE_XLIB(); |
2028 LEAVE_XLIB(); |
2029 } else { |
2029 } else { |
2030 MotifWMHintsAtom = __AtomVal(__INST(motifWMHintsAtom)); |
2030 MotifWMHintsAtom = __AtomVal(__INST(motifWMHintsAtom)); |
2031 } |
2031 } |
2032 |
2032 |
2033 { |
2033 { |
2034 struct hints { |
2034 struct hints { |
2035 unsigned long flags; |
2035 unsigned long flags; |
2036 unsigned long functions; |
2036 unsigned long functions; |
2037 unsigned long decorations; |
2037 unsigned long decorations; |
2038 long input_mode; |
2038 long input_mode; |
2039 unsigned long status; |
2039 unsigned long status; |
2040 } mvm_hints; |
2040 } mvm_hints; |
2041 |
2041 |
2042 if (wStyle == @symbol(undecorated)) { |
2042 if (wStyle == @symbol(undecorated)) { |
2043 mvm_hints.decorations = MWM_DECOR_NONE; |
2043 mvm_hints.decorations = MWM_DECOR_NONE; |
2044 } |
2044 } |
2045 if (wStyle == @symbol(dialog2)) { |
2045 if (wStyle == @symbol(dialog2)) { |
2046 mvm_hints.decorations = MWM_DECOR_BORDER |
2046 mvm_hints.decorations = MWM_DECOR_BORDER |
2047 | MWM_DECOR_RESIZEH |
2047 | MWM_DECOR_RESIZEH |
2048 | MWM_DECOR_TITLE |
2048 | MWM_DECOR_TITLE |
2049 /* | MWM_DECOR_MENU */ |
2049 /* | MWM_DECOR_MENU */ |
2050 /* | MWM_DECOR_MINIMIZE */ |
2050 /* | MWM_DECOR_MINIMIZE */ |
2051 /* | MWM_DECOR_MAXIMIZE */ |
2051 /* | MWM_DECOR_MAXIMIZE */ |
2052 ; |
2052 ; |
2053 } |
2053 } |
2054 if (wStyle == @symbol(notitle)) { |
2054 if (wStyle == @symbol(notitle)) { |
2055 mvm_hints.decorations = MWM_DECOR_BORDER |
2055 mvm_hints.decorations = MWM_DECOR_BORDER |
2056 /* | MWM_DECOR_RESIZEH */ |
2056 /* | MWM_DECOR_RESIZEH */ |
2057 /* | MWM_DECOR_TITLE */ |
2057 /* | MWM_DECOR_TITLE */ |
2058 /* | MWM_DECOR_MENU */ |
2058 /* | MWM_DECOR_MENU */ |
2059 /* | MWM_DECOR_MINIMIZE */ |
2059 /* | MWM_DECOR_MINIMIZE */ |
2060 /* | MWM_DECOR_MAXIMIZE */ |
2060 /* | MWM_DECOR_MAXIMIZE */ |
2061 ; |
2061 ; |
2062 } |
2062 } |
2063 mvm_hints.flags = MWM_HINTS_DECORATIONS; |
2063 mvm_hints.flags = MWM_HINTS_DECORATIONS; |
2064 ENTER_XLIB(); |
2064 ENTER_XLIB(); |
2065 XChangeProperty (dpy, newWindow, MotifWMHintsAtom, |
2065 XChangeProperty (dpy, newWindow, MotifWMHintsAtom, |
2066 MotifWMHintsAtom, 32, PropModeReplace, |
2066 MotifWMHintsAtom, 32, PropModeReplace, |
2067 (unsigned char*)&mvm_hints, 5 ); |
2067 (unsigned char*)&mvm_hints, 5 ); |
2068 LEAVE_XLIB(); |
2068 LEAVE_XLIB(); |
2069 } |
2069 } |
2070 } |
2070 } |
2071 #endif /* SUPPORT_MOTIF_WM_HINTS */ |
2071 #endif /* SUPPORT_MOTIF_WM_HINTS */ |
2072 } |
2072 } |
2073 |
2073 |
2074 windowId = __MKEXTERNALADDRESS(newWindow); |
2074 windowId = __MKEXTERNALADDRESS(newWindow); |
2075 %}. |
2075 %}. |
2078 "/ self setWindowType:wStyle in:windowId. |
2078 "/ self setWindowType:wStyle in:windowId. |
2079 "/ ]. |
2079 "/ ]. |
2080 |
2080 |
2081 (wsuperView isNil "this is a topwindow" |
2081 (wsuperView isNil "this is a topwindow" |
2082 and:[wlabel notEmptyOrNil]) ifTrue:[ |
2082 and:[wlabel notEmptyOrNil]) ifTrue:[ |
2083 self |
2083 self |
2084 setIconName:wlabel in:windowId; |
2084 setIconName:wlabel in:windowId; |
2085 setWindowName:wlabel in:windowId. |
2085 setWindowName:wlabel in:windowId. |
2086 ]. |
2086 ]. |
2087 |
2087 |
2088 self addKnownView:aView withId:windowId. |
2088 self addKnownView:aView withId:windowId. |
2089 ^ windowId |
2089 ^ windowId |
2090 |
2090 |
2097 %{ |
2097 %{ |
2098 /* |
2098 /* |
2099 * ignore closed connection |
2099 * ignore closed connection |
2100 */ |
2100 */ |
2101 if (! ISCONNECTED) { |
2101 if (! ISCONNECTED) { |
2102 RETURN ( self ); |
2102 RETURN ( self ); |
2103 } |
2103 } |
2104 |
2104 |
2105 if (__isExternalAddress(aGCId)) { |
2105 if (__isExternalAddress(aGCId)) { |
2106 GC gc = __GCVal(aGCId); |
2106 GC gc = __GCVal(aGCId); |
2107 |
2107 |
2108 if (gc) { |
2108 if (gc) { |
2109 __ExternalAddressInstPtr(aGCId)->e_address = NULL; |
2109 __ExternalAddressInstPtr(aGCId)->e_address = NULL; |
2110 |
2110 |
2111 ENTER_XLIB(); |
2111 ENTER_XLIB(); |
2112 XFreeGC(myDpy, gc); |
2112 XFreeGC(myDpy, gc); |
2113 LEAVE_XLIB(); |
2113 LEAVE_XLIB(); |
2114 #ifdef COUNT_RESOURCES |
2114 #ifdef COUNT_RESOURCES |
2115 __cnt_gc--; |
2115 __cnt_gc--; |
2116 #endif |
2116 #endif |
2117 } else { |
2117 } else { |
2118 console_fprintf(stderr, "XWorkstation [warning]: trying to destroy GC twice\n"); |
2118 console_fprintf(stderr, "XWorkstation [warning]: trying to destroy GC twice\n"); |
2119 } |
2119 } |
2120 RETURN ( self ); |
2120 RETURN ( self ); |
2121 } |
2121 } |
2122 %}. |
2122 %}. |
2123 self primitiveFailed |
2123 self primitiveFailed |
2124 ! |
2124 ! |
2125 |
2125 |
2129 %{ |
2129 %{ |
2130 /* |
2130 /* |
2131 * ignore closed connection |
2131 * ignore closed connection |
2132 */ |
2132 */ |
2133 if (! ISCONNECTED) { |
2133 if (! ISCONNECTED) { |
2134 RETURN ( self ); |
2134 RETURN ( self ); |
2135 } |
2135 } |
2136 |
2136 |
2137 if (__isExternalAddress(aDrawableId)) { |
2137 if (__isExternalAddress(aDrawableId)) { |
2138 Pixmap pix = __PixmapVal(aDrawableId); |
2138 Pixmap pix = __PixmapVal(aDrawableId); |
2139 |
2139 |
2140 if (pix) { |
2140 if (pix) { |
2141 |
2141 |
2142 ENTER_XLIB(); |
2142 ENTER_XLIB(); |
2143 XFreePixmap(myDpy, pix); |
2143 XFreePixmap(myDpy, pix); |
2144 LEAVE_XLIB(); |
2144 LEAVE_XLIB(); |
2145 #ifdef COUNT_RESOURCES |
2145 #ifdef COUNT_RESOURCES |
2146 __cnt_bitmap--; |
2146 __cnt_bitmap--; |
2147 #endif |
2147 #endif |
2148 |
2148 |
2149 } |
2149 } |
2150 RETURN ( self ); |
2150 RETURN ( self ); |
2151 } |
2151 } |
2152 %}. |
2152 %}. |
2153 self primitiveFailed |
2153 self primitiveFailed |
2154 ! |
2154 ! |
2155 |
2155 |
2170 |
2170 |
2171 if (__isExternalAddress(aDrawableId) |
2171 if (__isExternalAddress(aDrawableId) |
2172 && __isExternalAddress(aGCId) |
2172 && __isExternalAddress(aGCId) |
2173 && ISCONNECTED) { |
2173 && ISCONNECTED) { |
2174 |
2174 |
2175 ENTER_XLIB(); |
2175 ENTER_XLIB(); |
2176 dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId), |
2176 dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId), |
2177 __GCVal(aGCId), |
2177 __GCVal(aGCId), |
2178 0, height, 0, colormap, NULL, 0, |
2178 0, height, 0, colormap, NULL, 0, |
2179 XDPSDefaultTextBackstop, |
2179 XDPSDefaultTextBackstop, |
2180 XDPSDefaultErrorProc, |
2180 XDPSDefaultErrorProc, |
2181 NULL); |
2181 NULL); |
2182 LEAVE_XLIB(); |
2182 LEAVE_XLIB(); |
2183 |
2183 |
2184 RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil ); |
2184 RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil ); |
2185 } |
2185 } |
2186 #endif |
2186 #endif |
2187 %}. |
2187 %}. |
2188 self primitiveFailedOrClosedConnection. |
2188 self primitiveFailedOrClosedConnection. |
2189 ^ nil |
2189 ^ nil |
2196 int screen = __intVal(__INST(screen)); |
2196 int screen = __intVal(__INST(screen)); |
2197 GC gc; |
2197 GC gc; |
2198 |
2198 |
2199 if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
2199 if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
2200 |
2200 |
2201 ENTER_XLIB(); |
2201 ENTER_XLIB(); |
2202 gc = XCreateGC(myDpy, __DrawableVal(aDrawableId), 0L, (XGCValues *)0); |
2202 gc = XCreateGC(myDpy, __DrawableVal(aDrawableId), 0L, (XGCValues *)0); |
2203 LEAVE_XLIB(); |
2203 LEAVE_XLIB(); |
2204 |
2204 |
2205 #ifdef COUNT_RESOURCES |
2205 #ifdef COUNT_RESOURCES |
2206 if (gc) |
2206 if (gc) |
2207 __cnt_gc++; |
2207 __cnt_gc++; |
2208 #endif |
2208 #endif |
2209 |
2209 |
2210 RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil ); |
2210 RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil ); |
2211 } |
2211 } |
2212 %}. |
2212 %}. |
2213 self primitiveFailedOrClosedConnection. |
2213 self primitiveFailedOrClosedConnection. |
2214 ^ nil |
2214 ^ nil |
2215 ! |
2215 ! |
2242 unsigned char fastBits[10000]; |
2242 unsigned char fastBits[10000]; |
2243 OBJ num, *op; |
2243 OBJ num, *op; |
2244 int bytesPerRow; |
2244 int bytesPerRow; |
2245 |
2245 |
2246 if (! ISCONNECTED) { |
2246 if (! ISCONNECTED) { |
2247 RETURN (nil); |
2247 RETURN (nil); |
2248 } |
2248 } |
2249 |
2249 |
2250 dpy = myDpy; |
2250 dpy = myDpy; |
2251 if (firstCall) { |
2251 if (firstCall) { |
2252 for (index=0; index < 256; index++) { |
2252 for (index=0; index < 256; index++) { |
2253 int t = 0; |
2253 int t = 0; |
2254 |
2254 |
2255 if (index & 128) t |= 1; |
2255 if (index & 128) t |= 1; |
2256 if (index & 64) t |= 2; |
2256 if (index & 64) t |= 2; |
2257 if (index & 32) t |= 4; |
2257 if (index & 32) t |= 4; |
2258 if (index & 16) t |= 8; |
2258 if (index & 16) t |= 8; |
2259 if (index & 8) t |= 16; |
2259 if (index & 8) t |= 16; |
2260 if (index & 4) t |= 32; |
2260 if (index & 4) t |= 32; |
2261 if (index & 2) t |= 64; |
2261 if (index & 2) t |= 64; |
2262 if (index & 1) t |= 128; |
2262 if (index & 1) t |= 128; |
2263 |
2263 |
2264 reverseBitTable[index] = t; |
2264 reverseBitTable[index] = t; |
2265 } |
2265 } |
2266 firstCall = 0; |
2266 firstCall = 0; |
2267 } |
2267 } |
2268 |
2268 |
2269 if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) { |
2269 if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) { |
2270 newBitmap = (Pixmap)0; |
2270 newBitmap = (Pixmap)0; |
2271 b_width = __intVal(w); |
2271 b_width = __intVal(w); |
2272 b_height = __intVal(h); |
2272 b_height = __intVal(h); |
2273 bytesPerRow = (b_width + 7) / 8; |
2273 bytesPerRow = (b_width + 7) / 8; |
2274 nBytes = b_height * bytesPerRow; |
2274 nBytes = b_height * bytesPerRow; |
2275 if (nBytes < sizeof(fastBits)) { |
2275 if (nBytes < sizeof(fastBits)) { |
2276 cp = b_bits = fastBits; |
2276 cp = b_bits = fastBits; |
2277 allocatedBits = 0; |
2277 allocatedBits = 0; |
2278 } else { |
2278 } else { |
2279 cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes); |
2279 cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes); |
2280 if (! cp) goto fail; |
2280 if (! cp) goto fail; |
2281 } |
2281 } |
2282 |
2282 |
2283 if (__isArrayLike(anArray)) { |
2283 if (__isArrayLike(anArray)) { |
2284 index = 1; |
2284 index = 1; |
2285 op = &(__ArrayInstPtr(anArray)->a_element[index - 1]); |
2285 op = &(__ArrayInstPtr(anArray)->a_element[index - 1]); |
2286 for (row = b_height; row; row--) { |
2286 for (row = b_height; row; row--) { |
2287 for (col = bytesPerRow; col; col--) { |
2287 for (col = bytesPerRow; col; col--) { |
2288 num = *op++; |
2288 num = *op++; |
2289 if (__isSmallInteger(num)) { |
2289 if (__isSmallInteger(num)) { |
2290 bits = __intVal(num); |
2290 bits = __intVal(num); |
2291 } else { |
2291 } else { |
2292 bits = __longIntVal(num); |
2292 bits = __longIntVal(num); |
2293 if (bits == 0) { |
2293 if (bits == 0) { |
2294 goto fail; |
2294 goto fail; |
2295 } |
2295 } |
2296 } |
2296 } |
2297 *cp++ = reverseBitTable[bits & 0xFF]; |
2297 *cp++ = reverseBitTable[bits & 0xFF]; |
2298 } |
2298 } |
2299 } |
2299 } |
2300 } else { |
2300 } else { |
2301 if (__isByteArrayLike(anArray)) { |
2301 if (__isByteArrayLike(anArray)) { |
2302 pBits = __ByteArrayInstPtr(anArray)->ba_element; |
2302 pBits = __ByteArrayInstPtr(anArray)->ba_element; |
2303 for (col = b_height*bytesPerRow; col; col--) { |
2303 for (col = b_height*bytesPerRow; col; col--) { |
2304 *cp++ = reverseBitTable[*pBits++]; |
2304 *cp++ = reverseBitTable[*pBits++]; |
2305 } |
2305 } |
2306 } else { |
2306 } else { |
2307 goto fail; |
2307 goto fail; |
2308 } |
2308 } |
2309 } |
2309 } |
2310 |
2310 |
2311 |
2311 |
2312 ENTER_XLIB(); |
2312 ENTER_XLIB(); |
2313 newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen), |
2313 newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen), |
2314 (char *)b_bits, |
2314 (char *)b_bits, |
2315 b_width, b_height); |
2315 b_width, b_height); |
2316 LEAVE_XLIB(); |
2316 LEAVE_XLIB(); |
2317 #ifdef COUNT_RESOURCES |
2317 #ifdef COUNT_RESOURCES |
2318 if (newBitmap) |
2318 if (newBitmap) |
2319 __cnt_bitmap++; |
2319 __cnt_bitmap++; |
2320 #endif |
2320 #endif |
2321 |
2321 |
2322 |
2322 |
2323 fail: ; |
2323 fail: ; |
2324 if (allocatedBits) |
2324 if (allocatedBits) |
2325 free(allocatedBits); |
2325 free(allocatedBits); |
2326 RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
2326 RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
2327 } |
2327 } |
2328 %}. |
2328 %}. |
2329 ^ nil |
2329 ^ nil |
2330 ! |
2330 ! |
2331 |
2331 |
2338 |
2338 |
2339 primDestroyView:aView withId:aWindowId |
2339 primDestroyView:aView withId:aWindowId |
2340 <context: #return> |
2340 <context: #return> |
2341 %{ |
2341 %{ |
2342 if (! ISCONNECTED) { |
2342 if (! ISCONNECTED) { |
2343 RETURN ( self ); |
2343 RETURN ( self ); |
2344 } |
2344 } |
2345 |
2345 |
2346 if (__isExternalAddress(aWindowId)) { |
2346 if (__isExternalAddress(aWindowId)) { |
2347 Window win = __WindowVal(aWindowId); |
2347 Window win = __WindowVal(aWindowId); |
2348 |
2348 |
2349 if (win) { |
2349 if (win) { |
2350 |
2350 |
2351 ENTER_XLIB(); |
2351 ENTER_XLIB(); |
2352 XDestroyWindow(myDpy, win); |
2352 XDestroyWindow(myDpy, win); |
2353 LEAVE_XLIB(); |
2353 LEAVE_XLIB(); |
2354 #ifdef COUNT_RESOURCES |
2354 #ifdef COUNT_RESOURCES |
2355 __cnt_view--; |
2355 __cnt_view--; |
2356 #endif |
2356 #endif |
2357 |
2357 |
2358 } |
2358 } |
2359 } |
2359 } |
2360 %} |
2360 %} |
2361 ! ! |
2361 ! ! |
2362 |
2362 |
2363 !XWorkstation methodsFor:'clipboard'! |
2363 !XWorkstation methodsFor:'clipboard'! |
2392 |
2392 |
2393 self setPrimaryBuffer:aString. |
2393 self setPrimaryBuffer:aString. |
2394 |
2394 |
2395 s := aString ? ''. |
2395 s := aString ? ''. |
2396 s isString ifFalse:[ |
2396 s isString ifFalse:[ |
2397 s := s asStringWithCRsFrom:1 to:(s size) compressTabs:false withCR:false |
2397 s := s asStringWithCRsFrom:1 to:(s size) compressTabs:false withCR:false |
2398 ]. |
2398 ]. |
2399 |
2399 |
2400 viewID := aView id. |
2400 viewID := aView id. |
2401 viewID notNil ifTrue:[ "/ if the view is not already closed |
2401 viewID notNil ifTrue:[ "/ if the view is not already closed |
2402 "/ for now - should add support to pass emphasis information too |
2402 "/ for now - should add support to pass emphasis information too |
2403 s := s string. |
2403 s := s string. |
2404 self setPrimaryText:s owner:viewID. |
2404 self setPrimaryText:s owner:viewID. |
2405 ] |
2405 ] |
2406 |
2406 |
2407 "Created: / 27-03-2012 / 14:46:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2407 "Created: / 27-03-2012 / 14:46:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2408 ! ! |
2408 ! ! |
2409 |
2409 |
2420 XColor color; |
2420 XColor color; |
2421 unsigned long dummy; |
2421 unsigned long dummy; |
2422 Status ok; |
2422 Status ok; |
2423 |
2423 |
2424 if (ISCONNECTED) { |
2424 if (ISCONNECTED) { |
2425 Display *dpy = myDpy; |
2425 Display *dpy = myDpy; |
2426 |
2426 |
2427 |
2427 |
2428 ENTER_XLIB(); |
2428 ENTER_XLIB(); |
2429 ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0, |
2429 ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0, |
2430 &dummy, 0, &color.pixel, 1); |
2430 &dummy, 0, &color.pixel, 1); |
2431 LEAVE_XLIB(); |
2431 LEAVE_XLIB(); |
2432 |
2432 |
2433 if (ok) { |
2433 if (ok) { |
2434 #ifdef COUNT_RESOURCES |
2434 #ifdef COUNT_RESOURCES |
2435 __cnt_color++; |
2435 __cnt_color++; |
2436 #endif |
2436 #endif |
2437 RETURN ( __MKSMALLINT(color.pixel) ); |
2437 RETURN ( __MKSMALLINT(color.pixel) ); |
2438 } |
2438 } |
2439 } |
2439 } |
2440 %}. |
2440 %}. |
2441 ^ nil |
2441 ^ nil |
2442 ! |
2442 ! |
2443 |
2443 |
2454 int id; |
2454 int id; |
2455 Status ok; |
2455 Status ok; |
2456 |
2456 |
2457 if (ISCONNECTED |
2457 if (ISCONNECTED |
2458 && __isStringLike(aString)) { |
2458 && __isStringLike(aString)) { |
2459 Display *dpy = myDpy; |
2459 Display *dpy = myDpy; |
2460 |
2460 |
2461 colorname = (char *) __stringVal(aString); |
2461 colorname = (char *) __stringVal(aString); |
2462 |
2462 |
2463 |
2463 |
2464 ENTER_XLIB(); |
2464 ENTER_XLIB(); |
2465 ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); |
2465 ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); |
2466 LEAVE_XLIB(); |
2466 LEAVE_XLIB(); |
2467 if (ok) { |
2467 if (ok) { |
2468 #ifdef QUICK_TRUE_COLORS |
2468 #ifdef QUICK_TRUE_COLORS |
2469 if (__INST(visualType) == @symbol(TrueColor)) { |
2469 if (__INST(visualType) == @symbol(TrueColor)) { |
2470 id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
2470 id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
2471 id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
2471 id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
2472 id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
2472 id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
2473 RETURN ( __MKSMALLINT(id) ); |
2473 RETURN ( __MKSMALLINT(id) ); |
2474 } |
2474 } |
2475 #endif |
2475 #endif |
2476 ENTER_XLIB(); |
2476 ENTER_XLIB(); |
2477 ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
2477 ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
2478 LEAVE_XLIB(); |
2478 LEAVE_XLIB(); |
2479 } |
2479 } |
2480 |
2480 |
2481 if (! ok) { |
2481 if (! ok) { |
2482 RETURN ( nil ); |
2482 RETURN ( nil ); |
2483 } |
2483 } |
2484 #ifdef COUNT_RESOURCES |
2484 #ifdef COUNT_RESOURCES |
2485 __cnt_color++; |
2485 __cnt_color++; |
2486 #endif |
2486 #endif |
2487 RETURN ( __MKSMALLINT(ecolor.pixel) ); |
2487 RETURN ( __MKSMALLINT(ecolor.pixel) ); |
2488 } |
2488 } |
2489 %}. |
2489 %}. |
2490 ^ super colorNamed:aString |
2490 ^ super colorNamed:aString |
2491 ! |
2491 ! |
2492 |
2492 |
2502 int id; |
2502 int id; |
2503 |
2503 |
2504 if (__bothSmallInteger(r, g) |
2504 if (__bothSmallInteger(r, g) |
2505 && __isSmallInteger(b) |
2505 && __isSmallInteger(b) |
2506 && ISCONNECTED) { |
2506 && ISCONNECTED) { |
2507 ecolor.red = __intVal(r); |
2507 ecolor.red = __intVal(r); |
2508 ecolor.green= __intVal(g); |
2508 ecolor.green= __intVal(g); |
2509 ecolor.blue = __intVal(b); |
2509 ecolor.blue = __intVal(b); |
2510 #ifdef QUICK_TRUE_COLORS |
2510 #ifdef QUICK_TRUE_COLORS |
2511 if (__INST(visualType) == @symbol(TrueColor)) { |
2511 if (__INST(visualType) == @symbol(TrueColor)) { |
2512 id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
2512 id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
2513 id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
2513 id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
2514 id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
2514 id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
2515 RETURN ( __MKSMALLINT(id) ); |
2515 RETURN ( __MKSMALLINT(id) ); |
2516 } |
2516 } |
2517 #endif |
2517 #endif |
2518 dpy = myDpy; |
2518 dpy = myDpy; |
2519 |
2519 |
2520 ENTER_XLIB(); |
2520 ENTER_XLIB(); |
2521 ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
2521 ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
2522 LEAVE_XLIB(); |
2522 LEAVE_XLIB(); |
2523 |
2523 |
2524 if (! ok) { |
2524 if (! ok) { |
2525 RETURN ( nil ); |
2525 RETURN ( nil ); |
2526 } |
2526 } |
2527 #ifdef COUNT_RESOURCES |
2527 #ifdef COUNT_RESOURCES |
2528 __cnt_color++; |
2528 __cnt_color++; |
2529 #endif |
2529 #endif |
2530 RETURN ( __MKSMALLINT(ecolor.pixel) ); |
2530 RETURN ( __MKSMALLINT(ecolor.pixel) ); |
2531 } |
2531 } |
2532 %}. |
2532 %}. |
2533 ^ super colorScaledRed:r scaledGreen:g scaledBlue:b |
2533 ^ super colorScaledRed:r scaledGreen:g scaledBlue:b |
2534 ! |
2534 ! |
2535 |
2535 |
2556 unsigned long color; |
2556 unsigned long color; |
2557 int screen = __intVal(__INST(screen)); |
2557 int screen = __intVal(__INST(screen)); |
2558 |
2558 |
2559 #ifdef QUICK_TRUE_COLORS |
2559 #ifdef QUICK_TRUE_COLORS |
2560 if (__INST(visualType) == @symbol(TrueColor)) { |
2560 if (__INST(visualType) == @symbol(TrueColor)) { |
2561 /* no need to do anything on TrueColor displays ... */ |
2561 /* no need to do anything on TrueColor displays ... */ |
2562 RETURN (self); |
2562 RETURN (self); |
2563 } |
2563 } |
2564 #endif |
2564 #endif |
2565 |
2565 |
2566 /* |
2566 /* |
2567 * ignore closed connection |
2567 * ignore closed connection |
2568 */ |
2568 */ |
2569 if (! ISCONNECTED) { |
2569 if (! ISCONNECTED) { |
2570 RETURN (self); |
2570 RETURN (self); |
2571 } |
2571 } |
2572 |
2572 |
2573 if (__isSmallInteger(colorIndex)) { |
2573 if (__isSmallInteger(colorIndex)) { |
2574 dpy = myDpy; |
2574 dpy = myDpy; |
2575 color = (long) __intVal(colorIndex); |
2575 color = (long) __intVal(colorIndex); |
2576 |
2576 |
2577 ENTER_XLIB(); |
2577 ENTER_XLIB(); |
2578 XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L); |
2578 XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L); |
2579 LEAVE_XLIB(); |
2579 LEAVE_XLIB(); |
2580 #ifdef COUNT_RESOURCES |
2580 #ifdef COUNT_RESOURCES |
2581 __cnt_color--; |
2581 __cnt_color--; |
2582 #endif |
2582 #endif |
2583 |
2583 |
2584 RETURN ( self ); |
2584 RETURN ( self ); |
2585 } |
2585 } |
2586 %}. |
2586 %}. |
2587 self primitiveFailed |
2587 self primitiveFailed |
2588 ! |
2588 ! |
2589 |
2589 |
2598 int sr, sg, sb; |
2598 int sr, sg, sb; |
2599 int bits, scale, shift; |
2599 int bits, scale, shift; |
2600 |
2600 |
2601 if (ISCONNECTED |
2601 if (ISCONNECTED |
2602 && __isSmallInteger(index)) { |
2602 && __isSmallInteger(index)) { |
2603 Display *dpy = myDpy; |
2603 Display *dpy = myDpy; |
2604 |
2604 |
2605 color.pixel = __intVal(index); |
2605 color.pixel = __intVal(index); |
2606 |
2606 |
2607 ENTER_XLIB(); |
2607 ENTER_XLIB(); |
2608 XQueryColor(dpy, DefaultColormap(dpy, screen), &color); |
2608 XQueryColor(dpy, DefaultColormap(dpy, screen), &color); |
2609 LEAVE_XLIB(); |
2609 LEAVE_XLIB(); |
2610 |
2610 |
2611 |
2611 |
2612 /* |
2612 /* |
2613 * have to compensate for an error in X ?, which does not scale |
2613 * have to compensate for an error in X ?, which does not scale |
2614 * colors correctly if lesser than 16bits are valid in a color, |
2614 * colors correctly if lesser than 16bits are valid in a color, |
2615 * (for example, color white on a 4bitsPerRGB server will Return |
2615 * (for example, color white on a 4bitsPerRGB server will Return |
2616 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
2616 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
2617 */ |
2617 */ |
2618 bits = __intVal(__INST(bitsPerRGB)); |
2618 bits = __intVal(__INST(bitsPerRGB)); |
2619 scale = (1<<bits) - 1; |
2619 scale = (1<<bits) - 1; |
2620 shift = 16 - bits; |
2620 shift = 16 - bits; |
2621 |
2621 |
2622 sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
2622 sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
2623 sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
2623 sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
2624 sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
2624 sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
2625 RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb))); |
2625 RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb))); |
2626 } |
2626 } |
2627 %}. |
2627 %}. |
2628 ^ super getScaledRGBFrom:index |
2628 ^ super getScaledRGBFrom:index |
2629 ! |
2629 ! |
2630 |
2630 |
2639 int sr, sg, sb; |
2639 int sr, sg, sb; |
2640 int bits, scale, shift; |
2640 int bits, scale, shift; |
2641 |
2641 |
2642 if (ISCONNECTED |
2642 if (ISCONNECTED |
2643 && __isStringLike(colorName)) { |
2643 && __isStringLike(colorName)) { |
2644 Display *dpy = myDpy; |
2644 Display *dpy = myDpy; |
2645 |
2645 |
2646 |
2646 |
2647 if (XParseColor(dpy, DefaultColormap(dpy, screen), |
2647 if (XParseColor(dpy, DefaultColormap(dpy, screen), |
2648 (char *) __stringVal(colorName), &color)) { |
2648 (char *) __stringVal(colorName), &color)) { |
2649 /* |
2649 /* |
2650 * have to compensate for an error in X ?, which does not scale |
2650 * have to compensate for an error in X ?, which does not scale |
2651 * colors correctly if lesser than 16bits are valid in a color, |
2651 * colors correctly if lesser than 16bits are valid in a color, |
2652 * (for example, color white on a 4bitsPerRGB server will Return |
2652 * (for example, color white on a 4bitsPerRGB server will Return |
2653 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
2653 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
2654 */ |
2654 */ |
2655 bits = __intVal(__INST(bitsPerRGB)); |
2655 bits = __intVal(__INST(bitsPerRGB)); |
2656 scale = (1<<bits) - 1; |
2656 scale = (1<<bits) - 1; |
2657 shift = 16 - bits; |
2657 shift = 16 - bits; |
2658 |
2658 |
2659 /* do assignment to doubles (no cast) - avoid alignment problems in HPPA */ |
2659 /* do assignment to doubles (no cast) - avoid alignment problems in HPPA */ |
2660 dr = color.red>>shift; |
2660 dr = color.red>>shift; |
2661 dg = color.green>>shift; |
2661 dg = color.green>>shift; |
2662 db = color.blue>>shift; |
2662 db = color.blue>>shift; |
2663 |
2663 |
2664 sr = (dr / scale) * 0xFFFF; |
2664 sr = (dr / scale) * 0xFFFF; |
2665 sg = (dg / scale) * 0xFFFF; |
2665 sg = (dg / scale) * 0xFFFF; |
2666 sb = (db / scale) * 0xFFFF; |
2666 sb = (db / scale) * 0xFFFF; |
2667 RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb))); |
2667 RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb))); |
2668 } |
2668 } |
2669 |
2669 |
2670 } |
2670 } |
2671 %}. |
2671 %}. |
2672 ^ super getScaledRGBFromName:colorName |
2672 ^ super getScaledRGBFromName:colorName |
2673 |
2673 |
2674 " |
2674 " |
2675 Screen current getScaledRGBFromName:'red' |
2675 Screen current getScaledRGBFromName:'red' |
2676 Screen current getScaledRGBFromName:'orange' |
2676 Screen current getScaledRGBFromName:'orange' |
2677 " |
2677 " |
2678 ! |
2678 ! |
2679 |
2679 |
2680 listOfAvailableColors |
2680 listOfAvailableColors |
2681 "return a list of all available colornames. |
2681 "return a list of all available colornames. |
2686 |
2686 |
2687 aStream := '/usr/lib/X11/rgb.txt' asFilename readStreamOrNil. |
2687 aStream := '/usr/lib/X11/rgb.txt' asFilename readStreamOrNil. |
2688 aStream isNil ifTrue:[^ nil]. |
2688 aStream isNil ifTrue:[^ nil]. |
2689 list := OrderedCollection new. |
2689 list := OrderedCollection new. |
2690 [aStream atEnd] whileFalse:[ |
2690 [aStream atEnd] whileFalse:[ |
2691 line := aStream nextLine. |
2691 line := aStream nextLine. |
2692 line notNil ifTrue:[ |
2692 line notNil ifTrue:[ |
2693 "skip the r/g/b numbers" |
2693 "skip the r/g/b numbers" |
2694 index := 1. |
2694 index := 1. |
2695 [(line at:index) isSeparator] whileTrue:[index := index + 1]. |
2695 [(line at:index) isSeparator] whileTrue:[index := index + 1]. |
2696 [(line at:index) isDigit] whileTrue:[index := index + 1]. |
2696 [(line at:index) isDigit] whileTrue:[index := index + 1]. |
2697 [(line at:index) isSeparator] whileTrue:[index := index + 1]. |
2697 [(line at:index) isSeparator] whileTrue:[index := index + 1]. |
2698 [(line at:index) isDigit] whileTrue:[index := index + 1]. |
2698 [(line at:index) isDigit] whileTrue:[index := index + 1]. |
2699 [(line at:index) isSeparator] whileTrue:[index := index + 1]. |
2699 [(line at:index) isSeparator] whileTrue:[index := index + 1]. |
2700 [(line at:index) isDigit] whileTrue:[index := index + 1]. |
2700 [(line at:index) isDigit] whileTrue:[index := index + 1]. |
2701 [(line at:index) isSeparator] whileTrue:[index := index + 1]. |
2701 [(line at:index) isSeparator] whileTrue:[index := index + 1]. |
2702 colorName := line copyFrom:index. |
2702 colorName := line copyFrom:index. |
2703 ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[ |
2703 ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[ |
2704 list add:colorName |
2704 list add:colorName |
2705 ] |
2705 ] |
2706 ] |
2706 ] |
2707 ]. |
2707 ]. |
2708 aStream close. |
2708 aStream close. |
2709 ^ list sort |
2709 ^ list sort |
2710 |
2710 |
2711 " |
2711 " |
2721 |
2721 |
2722 |
2722 |
2723 %{ /* NOCONTEXT */ |
2723 %{ /* NOCONTEXT */ |
2724 |
2724 |
2725 if (__isSmallInteger(aPercentage)) { |
2725 if (__isSmallInteger(aPercentage)) { |
2726 RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) ); |
2726 RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) ); |
2727 } |
2727 } |
2728 if (__isFloat(aPercentage)) { |
2728 if (__isFloat(aPercentage)) { |
2729 RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) ); |
2729 RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) ); |
2730 } |
2730 } |
2731 %}. |
2731 %}. |
2732 ^ (16rFFFF * aPercentage / 100) rounded |
2732 ^ (16rFFFF * aPercentage / 100) rounded |
2733 ! |
2733 ! |
2734 |
2734 |
2744 int screen = __intVal(__INST(screen)); |
2744 int screen = __intVal(__INST(screen)); |
2745 int r, g, b; |
2745 int r, g, b; |
2746 int ok = 1; |
2746 int ok = 1; |
2747 |
2747 |
2748 if (__isSmallInteger(sred)) |
2748 if (__isSmallInteger(sred)) |
2749 r = __intVal(sred); |
2749 r = __intVal(sred); |
2750 else ok = 0; |
2750 else ok = 0; |
2751 |
2751 |
2752 if (__isSmallInteger(sgreen)) |
2752 if (__isSmallInteger(sgreen)) |
2753 g = __intVal(sgreen); |
2753 g = __intVal(sgreen); |
2754 else ok = 0; |
2754 else ok = 0; |
2755 |
2755 |
2756 if (__isSmallInteger(sblue)) |
2756 if (__isSmallInteger(sblue)) |
2757 b = __intVal(sblue); |
2757 b = __intVal(sblue); |
2758 else ok = 0; |
2758 else ok = 0; |
2759 |
2759 |
2760 if (ISCONNECTED |
2760 if (ISCONNECTED |
2761 && __isSmallInteger(index) && ok) { |
2761 && __isSmallInteger(index) && ok) { |
2762 Display *dpy = myDpy; |
2762 Display *dpy = myDpy; |
2763 |
2763 |
2764 color.pixel = __intVal(index); |
2764 color.pixel = __intVal(index); |
2765 color.red = r; |
2765 color.red = r; |
2766 color.green = g; |
2766 color.green = g; |
2767 color.blue = b; |
2767 color.blue = b; |
2768 color.flags = DoRed | DoGreen | DoBlue; |
2768 color.flags = DoRed | DoGreen | DoBlue; |
2769 |
2769 |
2770 |
2770 |
2771 ENTER_XLIB(); |
2771 ENTER_XLIB(); |
2772 XStoreColor(dpy, DefaultColormap(dpy, screen), &color); |
2772 XStoreColor(dpy, DefaultColormap(dpy, screen), &color); |
2773 LEAVE_XLIB(); |
2773 LEAVE_XLIB(); |
2774 |
2774 |
2775 RETURN ( self ); |
2775 RETURN ( self ); |
2776 } |
2776 } |
2777 %}. |
2777 %}. |
2778 self primitiveFailedOrClosedConnection |
2778 self primitiveFailedOrClosedConnection |
2779 ! ! |
2779 ! ! |
2780 |
2780 |
2787 (actually, there are more than those below ...)" |
2787 (actually, there are more than those below ...)" |
2788 |
2788 |
2789 "/ if you add something here, also add to #shapeNumberFromCursor ... |
2789 "/ if you add something here, also add to #shapeNumberFromCursor ... |
2790 |
2790 |
2791 ^ #( |
2791 ^ #( |
2792 #upLeftArrow "/ XC_top_left_arrow |
2792 #upLeftArrow "/ XC_top_left_arrow |
2793 #upRightHand "/ XC_hand1 |
2793 #upRightHand "/ XC_hand1 |
2794 #upDownArrow "/ XC_sb_v_double_arrow |
2794 #upDownArrow "/ XC_sb_v_double_arrow |
2795 #leftRightArrow "/ XC_sb_h_double_arrow |
2795 #leftRightArrow "/ XC_sb_h_double_arrow |
2796 #upLimitArrow "/ XC_top_side |
2796 #upLimitArrow "/ XC_top_side |
2797 #downLimitArrow "/ XC_bottom_side |
2797 #downLimitArrow "/ XC_bottom_side |
2798 #leftLimitArrow "/ XC_left_side |
2798 #leftLimitArrow "/ XC_left_side |
2799 #rightLimitArrow "/ XC_right_side |
2799 #rightLimitArrow "/ XC_right_side |
2800 #text "/ XC_xterm |
2800 #text "/ XC_xterm |
2801 #upRightArrow "/ XC_draft_large |
2801 #upRightArrow "/ XC_draft_large |
2802 #leftHand "/ XC_hand2 |
2802 #leftHand "/ XC_hand2 |
2803 #questionMark "/ XC_question_arrow |
2803 #questionMark "/ XC_question_arrow |
2804 #cross "/ XC_X_cursor |
2804 #cross "/ XC_X_cursor |
2805 #wait "/ XC_watch |
2805 #wait "/ XC_watch |
2806 #crossHair "/ XC_tcross |
2806 #crossHair "/ XC_tcross |
2807 #origin "/ XC_ul_angle |
2807 #origin "/ XC_ul_angle |
2808 #topLeft "/ XC_ul_angle |
2808 #topLeft "/ XC_ul_angle |
2809 #corner "/ XC_lr_angle |
2809 #corner "/ XC_lr_angle |
2810 #bottomRight "/ XC_lr_angle |
2810 #bottomRight "/ XC_lr_angle |
2811 #topRight "/ XC_ur_angle |
2811 #topRight "/ XC_ur_angle |
2812 #bottomLeft "/ XC_ll_angle |
2812 #bottomLeft "/ XC_ll_angle |
2813 #square "/ XC_dotbox |
2813 #square "/ XC_dotbox |
2814 #fourWay "/ XC_fleur |
2814 #fourWay "/ XC_fleur |
2815 #crossCursor "/ XC_X_cursor |
2815 #crossCursor "/ XC_X_cursor |
2816 ) |
2816 ) |
2817 |
2817 |
2818 "Created: 8.4.1997 / 10:12:30 / cg" |
2818 "Created: 8.4.1997 / 10:12:30 / cg" |
2819 "Modified: 8.4.1997 / 10:31:46 / cg" |
2819 "Modified: 8.4.1997 / 10:31:46 / cg" |
2820 ! |
2820 ! |
2839 && __isExternalAddress(aCursorId) |
2839 && __isExternalAddress(aCursorId) |
2840 && __bothSmallInteger(fgG, fgB) |
2840 && __bothSmallInteger(fgG, fgB) |
2841 && __bothSmallInteger(bgR, bgG) |
2841 && __bothSmallInteger(bgR, bgG) |
2842 && __bothSmallInteger(bgB, fgR)) { |
2842 && __bothSmallInteger(bgB, fgR)) { |
2843 |
2843 |
2844 fgcolor.red = __intVal(fgR); |
2844 fgcolor.red = __intVal(fgR); |
2845 fgcolor.green= __intVal(fgG); |
2845 fgcolor.green= __intVal(fgG); |
2846 fgcolor.blue = __intVal(fgB); |
2846 fgcolor.blue = __intVal(fgB); |
2847 bgcolor.red = __intVal(bgR); |
2847 bgcolor.red = __intVal(bgR); |
2848 bgcolor.green= __intVal(bgG); |
2848 bgcolor.green= __intVal(bgG); |
2849 bgcolor.blue = __intVal(bgB); |
2849 bgcolor.blue = __intVal(bgB); |
2850 |
2850 |
2851 ENTER_XLIB(); |
2851 ENTER_XLIB(); |
2852 XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor); |
2852 XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor); |
2853 LEAVE_XLIB(); |
2853 LEAVE_XLIB(); |
2854 |
2854 |
2855 RETURN ( self ); |
2855 RETURN ( self ); |
2856 } |
2856 } |
2857 %}. |
2857 %}. |
2858 self primitiveFailedOrClosedConnection |
2858 self primitiveFailedOrClosedConnection |
2859 ! |
2859 ! |
2860 |
2860 |
2872 |
2872 |
2873 createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h |
2873 createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h |
2874 "create a cursor given 2 bitmaps (source, mask) and a hotspot" |
2874 "create a cursor given 2 bitmaps (source, mask) and a hotspot" |
2875 |
2875 |
2876 ^ self |
2876 ^ self |
2877 primCreateCursorSourceFormId:sourceForm id |
2877 primCreateCursorSourceFormId:sourceForm id |
2878 maskFormId:maskForm id |
2878 maskFormId:maskForm id |
2879 hotX:hx hotY:hy |
2879 hotX:hx hotY:hy |
2880 width:w height:h |
2880 width:w height:h |
2881 ! |
2881 ! |
2882 |
2882 |
2883 destroyCursor:aCursorId |
2883 destroyCursor:aCursorId |
2884 "release a cursor - frees any device resources" |
2884 "release a cursor - frees any device resources" |
2885 |
2885 |
2887 %{ |
2887 %{ |
2888 /* |
2888 /* |
2889 * ignore closed connection |
2889 * ignore closed connection |
2890 */ |
2890 */ |
2891 if (! ISCONNECTED) { |
2891 if (! ISCONNECTED) { |
2892 RETURN ( self ); |
2892 RETURN ( self ); |
2893 } |
2893 } |
2894 |
2894 |
2895 if (__isExternalAddress(aCursorId)) { |
2895 if (__isExternalAddress(aCursorId)) { |
2896 Cursor curs = __CursorVal(aCursorId); |
2896 Cursor curs = __CursorVal(aCursorId); |
2897 |
2897 |
2898 if (curs) { |
2898 if (curs) { |
2899 |
2899 |
2900 ENTER_XLIB(); |
2900 ENTER_XLIB(); |
2901 XFreeCursor(myDpy, curs); |
2901 XFreeCursor(myDpy, curs); |
2902 LEAVE_XLIB(); |
2902 LEAVE_XLIB(); |
2903 #ifdef COUNT_RESOURCES |
2903 #ifdef COUNT_RESOURCES |
2904 __cnt_cursor--; |
2904 __cnt_cursor--; |
2905 #endif |
2905 #endif |
2906 } |
2906 } |
2907 RETURN ( self ); |
2907 RETURN ( self ); |
2908 } |
2908 } |
2909 %}. |
2909 %}. |
2910 self primitiveFailed |
2910 self primitiveFailed |
2911 ! |
2911 ! |
2912 |
2912 |
2922 Cursor newCursor; |
2922 Cursor newCursor; |
2923 |
2923 |
2924 if (ISCONNECTED |
2924 if (ISCONNECTED |
2925 && __isSmallInteger(aShapeNumber)) { |
2925 && __isSmallInteger(aShapeNumber)) { |
2926 |
2926 |
2927 ENTER_XLIB(); |
2927 ENTER_XLIB(); |
2928 newCursor = XCreateFontCursor(myDpy, __intVal(aShapeNumber)); |
2928 newCursor = XCreateFontCursor(myDpy, __intVal(aShapeNumber)); |
2929 LEAVE_XLIB(); |
2929 LEAVE_XLIB(); |
2930 #ifdef COUNT_RESOURCES |
2930 #ifdef COUNT_RESOURCES |
2931 if (newCursor) |
2931 if (newCursor) |
2932 __cnt_cursor++; |
2932 __cnt_cursor++; |
2933 #endif |
2933 #endif |
2934 |
2934 |
2935 if (newCursor != (Cursor)0) { |
2935 if (newCursor != (Cursor)0) { |
2936 RETURN (__MKEXTERNALADDRESS(newCursor)); |
2936 RETURN (__MKEXTERNALADDRESS(newCursor)); |
2937 } |
2937 } |
2938 } |
2938 } |
2939 %}. |
2939 %}. |
2940 self primitiveFailedOrClosedConnection. |
2940 self primitiveFailedOrClosedConnection. |
2941 ^ nil |
2941 ^ nil |
2942 ! |
2942 ! |
2951 |
2951 |
2952 if (ISCONNECTED |
2952 if (ISCONNECTED |
2953 && __isExternalAddress(sourceId) |
2953 && __isExternalAddress(sourceId) |
2954 && __isExternalAddress(maskId) |
2954 && __isExternalAddress(maskId) |
2955 && __bothSmallInteger(hx, hy)) { |
2955 && __bothSmallInteger(hx, hy)) { |
2956 fgColor.red = 0; /* fg is black */ |
2956 fgColor.red = 0; /* fg is black */ |
2957 fgColor.green = 0; |
2957 fgColor.green = 0; |
2958 fgColor.blue = 0; |
2958 fgColor.blue = 0; |
2959 bgColor.red = 0xFFFF; /* bg is white */ |
2959 bgColor.red = 0xFFFF; /* bg is white */ |
2960 bgColor.green = 0xFFFF; |
2960 bgColor.green = 0xFFFF; |
2961 bgColor.blue = 0xFFFF; |
2961 bgColor.blue = 0xFFFF; |
2962 |
2962 |
2963 |
2963 |
2964 ENTER_XLIB(); |
2964 ENTER_XLIB(); |
2965 newCursor = XCreatePixmapCursor(myDpy, |
2965 newCursor = XCreatePixmapCursor(myDpy, |
2966 __PixmapVal(sourceId), |
2966 __PixmapVal(sourceId), |
2967 __PixmapVal(maskId), |
2967 __PixmapVal(maskId), |
2968 &fgColor, &bgColor, __intVal(hx), __intVal(hy)); |
2968 &fgColor, &bgColor, __intVal(hx), __intVal(hy)); |
2969 LEAVE_XLIB(); |
2969 LEAVE_XLIB(); |
2970 #ifdef COUNT_RESOURCES |
2970 #ifdef COUNT_RESOURCES |
2971 if (newCursor) |
2971 if (newCursor) |
2972 __cnt_cursor++; |
2972 __cnt_cursor++; |
2973 #endif |
2973 #endif |
2974 |
2974 |
2975 if (newCursor != (Cursor)0) { |
2975 if (newCursor != (Cursor)0) { |
2976 RETURN (__MKEXTERNALADDRESS(newCursor)); |
2976 RETURN (__MKEXTERNALADDRESS(newCursor)); |
2977 } |
2977 } |
2978 } |
2978 } |
2979 %}. |
2979 %}. |
2980 self primitiveFailedOrClosedConnection. |
2980 self primitiveFailedOrClosedConnection. |
2981 ^ nil |
2981 ^ nil |
2982 ! |
2982 ! |
3027 |msgType dropColl dropCollSize anyFile anyDir anyText anyOther |
3027 |msgType dropColl dropCollSize anyFile anyDir anyText anyOther |
3028 dropType dropTypeCode strings sz idx val| |
3028 dropType dropTypeCode strings sz idx val| |
3029 |
3029 |
3030 (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[ |
3030 (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[ |
3031 |
3031 |
3032 "/ DND can drop files, file, dir, links, dirLink and text |
3032 "/ DND can drop files, file, dir, links, dirLink and text |
3033 "/ check for this. |
3033 "/ check for this. |
3034 |
3034 |
3035 dropObjects isCollection ifFalse:[ |
3035 dropObjects isCollection ifFalse:[ |
3036 dropColl := Array with:dropObjects |
3036 dropColl := Array with:dropObjects |
3037 ] ifTrue:[ |
3037 ] ifTrue:[ |
3038 dropColl := dropObjects |
3038 dropColl := dropObjects |
3039 ]. |
3039 ]. |
3040 anyFile := anyDir := anyText := anyOther := false. |
3040 anyFile := anyDir := anyText := anyOther := false. |
3041 dropColl do:[:aDropObject | |
3041 dropColl do:[:aDropObject | |
3042 aDropObject isFileObject ifTrue:[ |
3042 aDropObject isFileObject ifTrue:[ |
3043 aDropObject theObject isDirectory ifTrue:[ |
3043 aDropObject theObject isDirectory ifTrue:[ |
3044 anyDir := true |
3044 anyDir := true |
3045 ] ifFalse:[ |
3045 ] ifFalse:[ |
3046 anyFile := true |
3046 anyFile := true |
3047 ] |
3047 ] |
3048 ] ifFalse:[ |
3048 ] ifFalse:[ |
3049 aDropObject isTextObject ifTrue:[ |
3049 aDropObject isTextObject ifTrue:[ |
3050 anyText := true |
3050 anyText := true |
3051 ] ifFalse:[ |
3051 ] ifFalse:[ |
3052 anyOther := true |
3052 anyOther := true |
3053 ] |
3053 ] |
3054 ] |
3054 ] |
3055 ]. |
3055 ]. |
3056 |
3056 |
3057 anyOther ifTrue:[ |
3057 anyOther ifTrue:[ |
3058 "/ DND does not support this ... |
3058 "/ DND does not support this ... |
3059 'XWorkstation [info]: DND can only drop files or text' infoPrintCR. |
3059 'XWorkstation [info]: DND can only drop files or text' infoPrintCR. |
3060 ^ false |
3060 ^ false |
3061 ]. |
3061 ]. |
3062 anyText ifTrue:[ |
3062 anyText ifTrue:[ |
3063 (anyFile or:[anyDir]) ifTrue:[ |
3063 (anyFile or:[anyDir]) ifTrue:[ |
3064 "/ DND does not support mixed types |
3064 "/ DND does not support mixed types |
3065 'XWorkstation [info]: DND cannot drop both files and text' infoPrintCR. |
3065 'XWorkstation [info]: DND cannot drop both files and text' infoPrintCR. |
3066 ^ false |
3066 ^ false |
3067 ] |
3067 ] |
3068 ]. |
3068 ]. |
3069 |
3069 |
3070 dropCollSize := dropColl size. |
3070 dropCollSize := dropColl size. |
3071 anyFile ifTrue:[ |
3071 anyFile ifTrue:[ |
3072 dropType := #DndFiles. |
3072 dropType := #DndFiles. |
3073 dropCollSize == 1 ifTrue:[ |
3073 dropCollSize == 1 ifTrue:[ |
3074 dropType := #DndFile |
3074 dropType := #DndFile |
3075 ] |
3075 ] |
3076 ] ifFalse:[ |
3076 ] ifFalse:[ |
3077 anyDir ifTrue:[ |
3077 anyDir ifTrue:[ |
3078 dropType := #DndFiles. |
3078 dropType := #DndFiles. |
3079 dropCollSize == 1 ifTrue:[ |
3079 dropCollSize == 1 ifTrue:[ |
3080 dropType := #DndDir |
3080 dropType := #DndDir |
3081 ] |
3081 ] |
3082 ] ifFalse:[ |
3082 ] ifFalse:[ |
3083 anyText ifTrue:[ |
3083 anyText ifTrue:[ |
3084 dropCollSize == 1 ifTrue:[ |
3084 dropCollSize == 1 ifTrue:[ |
3085 dropType := #DndText |
3085 dropType := #DndText |
3086 ] ifFalse:[ |
3086 ] ifFalse:[ |
3087 "/ can only drop a single text object |
3087 "/ can only drop a single text object |
3088 'XWorkstation [info]: DND can only drop a single text' infoPrintCR. |
3088 'XWorkstation [info]: DND can only drop a single text' infoPrintCR. |
3089 ^ false |
3089 ^ false |
3090 ] |
3090 ] |
3091 ] ifFalse:[ |
3091 ] ifFalse:[ |
3092 "/ mhmh ... |
3092 "/ mhmh ... |
3093 'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
3093 'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
3094 ^ false |
3094 ^ false |
3095 ] |
3095 ] |
3096 ] |
3096 ] |
3097 ]. |
3097 ]. |
3098 |
3098 |
3099 dropTypeCode := self dndDropTypes indexOf:dropType. |
3099 dropTypeCode := self dndDropTypes indexOf:dropType. |
3100 dropTypeCode == 0 ifTrue:[ |
3100 dropTypeCode == 0 ifTrue:[ |
3101 'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
3101 'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
3102 ^ false |
3102 ^ false |
3103 ]. |
3103 ]. |
3104 dropTypeCode := dropTypeCode - 1. |
3104 dropTypeCode := dropTypeCode - 1. |
3105 |
3105 |
3106 |
3106 |
3107 "/ place the selection inTo the DndSelection property |
3107 "/ place the selection inTo the DndSelection property |
3108 "/ of the rootView ... |
3108 "/ of the rootView ... |
3109 "/ ... need a single string, with 0-terminated parts. |
3109 "/ ... need a single string, with 0-terminated parts. |
3110 |
3110 |
3111 strings := OrderedCollection new. |
3111 strings := OrderedCollection new. |
3112 sz := 0. |
3112 sz := 0. |
3113 dropColl do:[:anObject | |
3113 dropColl do:[:anObject | |
3114 |s o| |
3114 |s o| |
3115 |
3115 |
3116 o := anObject theObject. |
3116 o := anObject theObject. |
3117 anObject isFileObject ifTrue:[ |
3117 anObject isFileObject ifTrue:[ |
3118 o := o pathName |
3118 o := o pathName |
3119 ]. |
3119 ]. |
3120 s := o asString. |
3120 s := o asString. |
3121 strings add:s. |
3121 strings add:s. |
3122 sz := sz + (s size) + 1. |
3122 sz := sz + (s size) + 1. |
3123 ]. |
3123 ]. |
3124 val := String new:sz. |
3124 val := String new:sz. |
3125 idx := 1. |
3125 idx := 1. |
3126 strings do:[:aString | |
3126 strings do:[:aString | |
3127 |sz| |
3127 |sz| |
3128 |
3128 |
3129 sz := aString size. |
3129 sz := aString size. |
3130 val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1. |
3130 val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1. |
3131 idx := idx + sz. |
3131 idx := idx + sz. |
3132 val at:idx put:(Character value:0). |
3132 val at:idx put:(Character value:0). |
3133 idx := idx + 1 |
3133 idx := idx + 1 |
3134 ]. |
3134 ]. |
3135 |
3135 |
3136 self |
3136 self |
3137 setProperty:(self atomIDOf:#DndSelection) |
3137 setProperty:(self atomIDOf:#DndSelection) |
3138 type:(self atomIDOf:#STRING) |
3138 type:(self atomIDOf:#STRING) |
3139 value:val |
3139 value:val |
3140 for:rootId. |
3140 for:rootId. |
3141 |
3141 |
3142 ^ self |
3142 ^ self |
3143 sendClientEvent:msgType |
3143 sendClientEvent:msgType |
3144 format:32 |
3144 format:32 |
3145 to:destinationId |
3145 to:destinationId |
3146 propagate:true |
3146 propagate:true |
3147 eventMask:nil |
3147 eventMask:nil |
3148 window:destinationId |
3148 window:destinationId |
3149 data1:dropTypeCode |
3149 data1:dropTypeCode |
3150 data2:0 |
3150 data2:0 |
3151 data3:destinationId |
3151 data3:destinationId |
3152 data4:nil |
3152 data4:nil |
3153 data5:nil. |
3153 data5:nil. |
3154 ]. |
3154 ]. |
3155 |
3155 |
3156 ^ false |
3156 ^ false |
3157 |
3157 |
3158 "Created: 6.4.1997 / 13:39:37 / cg" |
3158 "Created: 6.4.1997 / 13:39:37 / cg" |
3161 |
3161 |
3162 dndDropTypes |
3162 dndDropTypes |
3163 "return the dropTypes as supported by DND" |
3163 "return the dropTypes as supported by DND" |
3164 |
3164 |
3165 ^ #( |
3165 ^ #( |
3166 DndUnknown "/ 0 |
3166 DndUnknown "/ 0 |
3167 DndRawData "/ 1 |
3167 DndRawData "/ 1 |
3168 DndFile "/ 2 |
3168 DndFile "/ 2 |
3169 DndFiles "/ 3 |
3169 DndFiles "/ 3 |
3170 DndText "/ 4 |
3170 DndText "/ 4 |
3171 DndDir "/ 5 |
3171 DndDir "/ 5 |
3172 DndLink "/ 6 |
3172 DndLink "/ 6 |
3173 DndExe "/ 7 |
3173 DndExe "/ 7 |
3174 ) |
3174 ) |
3175 |
3175 |
3176 "Created: 6.4.1997 / 12:57:56 / cg" |
3176 "Created: 6.4.1997 / 12:57:56 / cg" |
3177 "Modified: 6.4.1997 / 13:38:52 / cg" |
3177 "Modified: 6.4.1997 / 13:38:52 / cg" |
3178 ! |
3178 ! |
3183 |
3183 |
3184 "/ |
3184 "/ |
3185 "/ see, if the display supports the DND protocol ... |
3185 "/ see, if the display supports the DND protocol ... |
3186 "/ |
3186 "/ |
3187 (self atomIDOf:#DndProtocol) notNil ifTrue:[ |
3187 (self atomIDOf:#DndProtocol) notNil ifTrue:[ |
3188 ^ self |
3188 ^ self |
3189 dndDrop:aCollectionOfDropObjects |
3189 dndDrop:aCollectionOfDropObjects |
3190 inWindowID:destinationId |
3190 inWindowID:destinationId |
3191 position:destinationPoint |
3191 position:destinationPoint |
3192 rootPosition:rootPoint |
3192 rootPosition:rootPoint |
3193 ]. |
3193 ]. |
3194 |
3194 |
3195 "/ add more drag&drop protocols here. |
3195 "/ add more drag&drop protocols here. |
3196 |
3196 |
3197 ^ false |
3197 ^ false |
3208 argument is not integer." |
3208 argument is not integer." |
3209 |
3209 |
3210 <context: #return> |
3210 <context: #return> |
3211 |
3211 |
3212 operationsUntilFlush notNil ifTrue:[ |
3212 operationsUntilFlush notNil ifTrue:[ |
3213 operationsUntilFlush <= 0 ifTrue:[ |
3213 operationsUntilFlush <= 0 ifTrue:[ |
3214 self flush. |
3214 self flush. |
3215 ] ifFalse:[ |
3215 ] ifFalse:[ |
3216 operationsUntilFlush := operationsUntilFlush - 1. |
3216 operationsUntilFlush := operationsUntilFlush - 1. |
3217 ]. |
3217 ]. |
3218 ]. |
3218 ]. |
3219 %{ |
3219 %{ |
3220 |
3220 |
3221 GC gc; |
3221 GC gc; |
3222 Drawable source, dest; |
3222 Drawable source, dest; |
3226 && __isExternalAddress(sourceId) |
3226 && __isExternalAddress(sourceId) |
3227 && __isExternalAddress(destId) |
3227 && __isExternalAddress(destId) |
3228 && __bothSmallInteger(w, h) |
3228 && __bothSmallInteger(w, h) |
3229 && __bothSmallInteger(srcX, srcY) |
3229 && __bothSmallInteger(srcX, srcY) |
3230 && __bothSmallInteger(dstX, dstY)) { |
3230 && __bothSmallInteger(dstX, dstY)) { |
3231 int _sX, _sY, _w, _h, _dX, _dY; |
3231 int _sX, _sY, _w, _h, _dX, _dY; |
3232 |
3232 |
3233 _sX = __intVal(srcX); |
3233 _sX = __intVal(srcX); |
3234 _sY = __intVal(srcY); |
3234 _sY = __intVal(srcY); |
3235 _w = __intVal(w); |
3235 _w = __intVal(w); |
3236 _h = __intVal(h); |
3236 _h = __intVal(h); |
3237 _dX = __intVal(dstX); |
3237 _dX = __intVal(dstX); |
3238 _dY = __intVal(dstY); |
3238 _dY = __intVal(dstY); |
3239 |
3239 |
3240 gc = __GCVal(dstGCId); |
3240 gc = __GCVal(dstGCId); |
3241 source = __DrawableVal(sourceId); |
3241 source = __DrawableVal(sourceId); |
3242 dest = __DrawableVal(destId); |
3242 dest = __DrawableVal(destId); |
3243 ENTER_XLIB(); |
3243 ENTER_XLIB(); |
3244 XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY); |
3244 XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY); |
3245 LEAVE_XLIB(); |
3245 LEAVE_XLIB(); |
3246 RETURN ( self ); |
3246 RETURN ( self ); |
3247 } |
3247 } |
3248 %}. |
3248 %}. |
3249 "badGC, bad sourceDrawableId or destDrawableID |
3249 "badGC, bad sourceDrawableId or destDrawableID |
3250 or any non integer coordinate" |
3250 or any non integer coordinate" |
3251 |
3251 |
3260 This is basically the same as copyFromId:..., but does not generate expose events." |
3260 This is basically the same as copyFromId:..., but does not generate expose events." |
3261 |
3261 |
3262 <context: #return> |
3262 <context: #return> |
3263 |
3263 |
3264 operationsUntilFlush notNil ifTrue:[ |
3264 operationsUntilFlush notNil ifTrue:[ |
3265 operationsUntilFlush <= 0 ifTrue:[ |
3265 operationsUntilFlush <= 0 ifTrue:[ |
3266 self flush. |
3266 self flush. |
3267 ] ifFalse:[ |
3267 ] ifFalse:[ |
3268 operationsUntilFlush := operationsUntilFlush - 1. |
3268 operationsUntilFlush := operationsUntilFlush - 1. |
3269 ]. |
3269 ]. |
3270 ]. |
3270 ]. |
3271 %{ |
3271 %{ |
3272 |
3272 |
3273 GC gc; |
3273 GC gc; |
3274 Drawable source, dest; |
3274 Drawable source, dest; |
3278 && __isExternalAddress(sourceId) |
3278 && __isExternalAddress(sourceId) |
3279 && __isExternalAddress(destId) |
3279 && __isExternalAddress(destId) |
3280 && __bothSmallInteger(w, h) |
3280 && __bothSmallInteger(w, h) |
3281 && __bothSmallInteger(srcX, srcY) |
3281 && __bothSmallInteger(srcX, srcY) |
3282 && __bothSmallInteger(dstX, dstY)) { |
3282 && __bothSmallInteger(dstX, dstY)) { |
3283 Display *dpy = myDpy; |
3283 Display *dpy = myDpy; |
3284 |
3284 |
3285 gc = __GCVal(dstGCId); |
3285 gc = __GCVal(dstGCId); |
3286 source = __DrawableVal(sourceId); |
3286 source = __DrawableVal(sourceId); |
3287 dest = __DrawableVal(destId); |
3287 dest = __DrawableVal(destId); |
3288 ENTER_XLIB(); |
3288 ENTER_XLIB(); |
3289 XSetGraphicsExposures(dpy, gc, 0); |
3289 XSetGraphicsExposures(dpy, gc, 0); |
3290 XCopyArea(dpy, source, dest, gc, |
3290 XCopyArea(dpy, source, dest, gc, |
3291 __intVal(srcX), __intVal(srcY), |
3291 __intVal(srcX), __intVal(srcY), |
3292 __intVal(w), __intVal(h), |
3292 __intVal(w), __intVal(h), |
3293 __intVal(dstX), __intVal(dstY)); |
3293 __intVal(dstX), __intVal(dstY)); |
3294 XSetGraphicsExposures(dpy, gc, 1); |
3294 XSetGraphicsExposures(dpy, gc, 1); |
3295 LEAVE_XLIB(); |
3295 LEAVE_XLIB(); |
3296 RETURN ( self ); |
3296 RETURN ( self ); |
3297 } |
3297 } |
3298 %}. |
3298 %}. |
3299 "badGC, bad sourceDrawableId or destDrawableID |
3299 "badGC, bad sourceDrawableId or destDrawableID |
3300 or any non integer coordinate" |
3300 or any non integer coordinate" |
3301 |
3301 |
3310 argument is not integer." |
3310 argument is not integer." |
3311 |
3311 |
3312 <context: #return> |
3312 <context: #return> |
3313 |
3313 |
3314 operationsUntilFlush notNil ifTrue:[ |
3314 operationsUntilFlush notNil ifTrue:[ |
3315 operationsUntilFlush <= 0 ifTrue:[ |
3315 operationsUntilFlush <= 0 ifTrue:[ |
3316 self flush. |
3316 self flush. |
3317 ] ifFalse:[ |
3317 ] ifFalse:[ |
3318 operationsUntilFlush := operationsUntilFlush - 1. |
3318 operationsUntilFlush := operationsUntilFlush - 1. |
3319 ]. |
3319 ]. |
3320 ]. |
3320 ]. |
3321 %{ |
3321 %{ |
3322 |
3322 |
3323 GC gc; |
3323 GC gc; |
3324 Drawable source, dest; |
3324 Drawable source, dest; |
3328 && __isExternalAddress(sourceId) |
3328 && __isExternalAddress(sourceId) |
3329 && __isExternalAddress(destId) |
3329 && __isExternalAddress(destId) |
3330 && __bothSmallInteger(w, h) |
3330 && __bothSmallInteger(w, h) |
3331 && __bothSmallInteger(srcX, srcY) |
3331 && __bothSmallInteger(srcX, srcY) |
3332 && __bothSmallInteger(dstX, dstY)) { |
3332 && __bothSmallInteger(dstX, dstY)) { |
3333 gc = __GCVal(dstGCId); |
3333 gc = __GCVal(dstGCId); |
3334 source = __DrawableVal(sourceId); |
3334 source = __DrawableVal(sourceId); |
3335 dest = __DrawableVal(destId); |
3335 dest = __DrawableVal(destId); |
3336 ENTER_XLIB(); |
3336 ENTER_XLIB(); |
3337 XCopyPlane(myDpy, source, dest, gc, |
3337 XCopyPlane(myDpy, source, dest, gc, |
3338 __intVal(srcX), __intVal(srcY), |
3338 __intVal(srcX), __intVal(srcY), |
3339 __intVal(w), __intVal(h), |
3339 __intVal(w), __intVal(h), |
3340 __intVal(dstX), __intVal(dstY), 1); |
3340 __intVal(dstX), __intVal(dstY), 1); |
3341 LEAVE_XLIB(); |
3341 LEAVE_XLIB(); |
3342 RETURN ( self ); |
3342 RETURN ( self ); |
3343 } |
3343 } |
3344 %}. |
3344 %}. |
3345 "badGC, bad sourceDrawableId or destDrawableID |
3345 "badGC, bad sourceDrawableId or destDrawableID |
3346 or any non integer coordinate" |
3346 or any non integer coordinate" |
3347 |
3347 |
3357 This is the same as copyPlaneFromId:..., but does not generate graphics exposes" |
3357 This is the same as copyPlaneFromId:..., but does not generate graphics exposes" |
3358 |
3358 |
3359 <context: #return> |
3359 <context: #return> |
3360 |
3360 |
3361 operationsUntilFlush notNil ifTrue:[ |
3361 operationsUntilFlush notNil ifTrue:[ |
3362 operationsUntilFlush <= 0 ifTrue:[ |
3362 operationsUntilFlush <= 0 ifTrue:[ |
3363 self flush. |
3363 self flush. |
3364 ] ifFalse:[ |
3364 ] ifFalse:[ |
3365 operationsUntilFlush := operationsUntilFlush - 1. |
3365 operationsUntilFlush := operationsUntilFlush - 1. |
3366 ]. |
3366 ]. |
3367 ]. |
3367 ]. |
3368 %{ |
3368 %{ |
3369 |
3369 |
3370 GC gc; |
3370 GC gc; |
3371 Drawable source, dest; |
3371 Drawable source, dest; |
3375 && __isExternalAddress(sourceId) |
3375 && __isExternalAddress(sourceId) |
3376 && __isExternalAddress(destId) |
3376 && __isExternalAddress(destId) |
3377 && __bothSmallInteger(w, h) |
3377 && __bothSmallInteger(w, h) |
3378 && __bothSmallInteger(srcX, srcY) |
3378 && __bothSmallInteger(srcX, srcY) |
3379 && __bothSmallInteger(dstX, dstY)) { |
3379 && __bothSmallInteger(dstX, dstY)) { |
3380 Display *dpy = myDpy; |
3380 Display *dpy = myDpy; |
3381 |
3381 |
3382 gc = __GCVal(dstGCId); |
3382 gc = __GCVal(dstGCId); |
3383 source = __DrawableVal(sourceId); |
3383 source = __DrawableVal(sourceId); |
3384 dest = __DrawableVal(destId); |
3384 dest = __DrawableVal(destId); |
3385 ENTER_XLIB(); |
3385 ENTER_XLIB(); |
3386 XSetGraphicsExposures(dpy, gc, 0); |
3386 XSetGraphicsExposures(dpy, gc, 0); |
3387 XCopyPlane(dpy, source, dest, gc, |
3387 XCopyPlane(dpy, source, dest, gc, |
3388 __intVal(srcX), __intVal(srcY), |
3388 __intVal(srcX), __intVal(srcY), |
3389 __intVal(w), __intVal(h), |
3389 __intVal(w), __intVal(h), |
3390 __intVal(dstX), __intVal(dstY), 1); |
3390 __intVal(dstX), __intVal(dstY), 1); |
3391 XSetGraphicsExposures(dpy, gc, 1); |
3391 XSetGraphicsExposures(dpy, gc, 1); |
3392 LEAVE_XLIB(); |
3392 LEAVE_XLIB(); |
3393 RETURN ( self ); |
3393 RETURN ( self ); |
3394 } |
3394 } |
3395 %}. |
3395 %}. |
3396 "badGC, bad sourceDrawableId or destDrawableID |
3396 "badGC, bad sourceDrawableId or destDrawableID |
3397 or any non integer coordinate" |
3397 or any non integer coordinate" |
3398 |
3398 |
3404 The angles may be floats or integer - they are given in degrees." |
3404 The angles may be floats or integer - they are given in degrees." |
3405 |
3405 |
3406 <context: #return> |
3406 <context: #return> |
3407 |
3407 |
3408 operationsUntilFlush notNil ifTrue:[ |
3408 operationsUntilFlush notNil ifTrue:[ |
3409 operationsUntilFlush <= 0 ifTrue:[ |
3409 operationsUntilFlush <= 0 ifTrue:[ |
3410 self flush. |
3410 self flush. |
3411 ] ifFalse:[ |
3411 ] ifFalse:[ |
3412 operationsUntilFlush := operationsUntilFlush - 1. |
3412 operationsUntilFlush := operationsUntilFlush - 1. |
3413 ]. |
3413 ]. |
3414 ]. |
3414 ]. |
3415 %{ |
3415 %{ |
3416 |
3416 |
3417 GC gc; |
3417 GC gc; |
3418 Window win; |
3418 Window win; |
3419 int w, h, angle1, angle2; |
3419 int w, h, angle1, angle2; |
3420 double f; |
3420 double f; |
3421 |
3421 |
3422 if (__isSmallInteger(startAngle)) |
3422 if (__isSmallInteger(startAngle)) |
3423 angle1 = __intVal(startAngle) * 64; |
3423 angle1 = __intVal(startAngle) * 64; |
3424 else if (__isFloat(startAngle)) { |
3424 else if (__isFloat(startAngle)) { |
3425 f = __floatVal(startAngle); |
3425 f = __floatVal(startAngle); |
3426 angle1 = f * 64; |
3426 angle1 = f * 64; |
3427 } else if (__isShortFloat(startAngle)) { |
3427 } else if (__isShortFloat(startAngle)) { |
3428 f = __shortFloatVal(startAngle); |
3428 f = __shortFloatVal(startAngle); |
3429 angle1 = f * 64; |
3429 angle1 = f * 64; |
3430 } else goto bad; |
3430 } else goto bad; |
3431 |
3431 |
3432 if (__isSmallInteger(angle)) |
3432 if (__isSmallInteger(angle)) |
3433 angle2 = __intVal(angle) * 64; |
3433 angle2 = __intVal(angle) * 64; |
3434 else if (__isFloat(angle)) { |
3434 else if (__isFloat(angle)) { |
3435 f = __floatVal(angle); |
3435 f = __floatVal(angle); |
3436 angle2 = f * 64; |
3436 angle2 = f * 64; |
3437 } else if (__isShortFloat(angle)) { |
3437 } else if (__isShortFloat(angle)) { |
3438 f = __shortFloatVal(angle); |
3438 f = __shortFloatVal(angle); |
3439 angle2 = f * 64; |
3439 angle2 = f * 64; |
3440 } else goto bad; |
3440 } else goto bad; |
3441 |
3441 |
3442 if (ISCONNECTED |
3442 if (ISCONNECTED |
3443 && __isExternalAddress(aGCId) |
3443 && __isExternalAddress(aGCId) |
3444 && __isExternalAddress(aDrawableId) |
3444 && __isExternalAddress(aDrawableId) |
3445 && __bothSmallInteger(x, y) |
3445 && __bothSmallInteger(x, y) |
3446 && __bothSmallInteger(width, height)) { |
3446 && __bothSmallInteger(width, height)) { |
3447 win = __WindowVal(aDrawableId); |
3447 win = __WindowVal(aDrawableId); |
3448 gc = __GCVal(aGCId); |
3448 gc = __GCVal(aGCId); |
3449 w = __intVal(width); |
3449 w = __intVal(width); |
3450 h = __intVal(height); |
3450 h = __intVal(height); |
3451 /* |
3451 /* |
3452 * need this check here: some servers simply dump core with bad args |
3452 * need this check here: some servers simply dump core with bad args |
3453 */ |
3453 */ |
3454 if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
3454 if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
3455 ENTER_XLIB(); |
3455 ENTER_XLIB(); |
3456 XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y), |
3456 XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y), |
3457 w, h, angle1, angle2); |
3457 w, h, angle1, angle2); |
3458 LEAVE_XLIB(); |
3458 LEAVE_XLIB(); |
3459 } |
3459 } |
3460 RETURN ( self ); |
3460 RETURN ( self ); |
3461 } |
3461 } |
3462 bad: ; |
3462 bad: ; |
3463 %}. |
3463 %}. |
3464 "badGC, badDrawable or coordinates not integer |
3464 "badGC, badDrawable or coordinates not integer |
3465 or angle(s) not integer or float." |
3465 or angle(s) not integer or float." |
3471 "draw a line. If the coordinates are not integers, an error is triggered." |
3471 "draw a line. If the coordinates are not integers, an error is triggered." |
3472 |
3472 |
3473 <context: #return> |
3473 <context: #return> |
3474 |
3474 |
3475 operationsUntilFlush notNil ifTrue:[ |
3475 operationsUntilFlush notNil ifTrue:[ |
3476 operationsUntilFlush <= 0 ifTrue:[ |
3476 operationsUntilFlush <= 0 ifTrue:[ |
3477 self flush. |
3477 self flush. |
3478 ] ifFalse:[ |
3478 ] ifFalse:[ |
3479 operationsUntilFlush := operationsUntilFlush - 1. |
3479 operationsUntilFlush := operationsUntilFlush - 1. |
3480 ]. |
3480 ]. |
3481 ]. |
3481 ]. |
3482 %{ |
3482 %{ |
3483 |
3483 |
3484 GC gc; |
3484 GC gc; |
3485 Window win; |
3485 Window win; |
3487 if (ISCONNECTED |
3487 if (ISCONNECTED |
3488 && __isExternalAddress(aGCId) |
3488 && __isExternalAddress(aGCId) |
3489 && __isExternalAddress(aDrawableId) |
3489 && __isExternalAddress(aDrawableId) |
3490 && __bothSmallInteger(x0, y0) |
3490 && __bothSmallInteger(x0, y0) |
3491 && __bothSmallInteger(x1, y1)) { |
3491 && __bothSmallInteger(x1, y1)) { |
3492 Display *dpy = myDpy; |
3492 Display *dpy = myDpy; |
3493 int ix0, iy0, ix1, iy1; |
3493 int ix0, iy0, ix1, iy1; |
3494 gc = __GCVal(aGCId); |
3494 gc = __GCVal(aGCId); |
3495 win = __WindowVal(aDrawableId); |
3495 win = __WindowVal(aDrawableId); |
3496 |
3496 |
3497 ix0 = __intVal(x0); |
3497 ix0 = __intVal(x0); |
3498 iy0 = __intVal(y0); |
3498 iy0 = __intVal(y0); |
3499 ix1 = __intVal(x1); |
3499 ix1 = __intVal(x1); |
3500 iy1 = __intVal(y1); |
3500 iy1 = __intVal(y1); |
3501 |
3501 |
3502 /* attention: coordinates in X are shorts and wrap; clamp here. */ |
3502 /* attention: coordinates in X are shorts and wrap; clamp here. */ |
3503 if (ix0 > 0x7FFF) ix0 = 0x7FFF; |
3503 if (ix0 > 0x7FFF) ix0 = 0x7FFF; |
3504 else if (ix0 < -0x8000) ix0 = -0x8000; |
3504 else if (ix0 < -0x8000) ix0 = -0x8000; |
3505 if (iy0 > 0x7FFF) iy0 = 0x7FFF; |
3505 if (iy0 > 0x7FFF) iy0 = 0x7FFF; |
3506 else if (iy0 < -0x8000) iy0 = -0x8000; |
3506 else if (iy0 < -0x8000) iy0 = -0x8000; |
3507 if (ix1 > 0x7FFF) ix1 = 0x7FFF; |
3507 if (ix1 > 0x7FFF) ix1 = 0x7FFF; |
3508 else if (ix1 < -0x8000) ix1 = -0x8000; |
3508 else if (ix1 < -0x8000) ix1 = -0x8000; |
3509 if (iy1 > 0x7FFF) iy1 = 0x7FFF; |
3509 if (iy1 > 0x7FFF) iy1 = 0x7FFF; |
3510 else if (iy1 < -0x8000) iy1 = -0x8000; |
3510 else if (iy1 < -0x8000) iy1 = -0x8000; |
3511 |
3511 |
3512 ENTER_XLIB(); |
3512 ENTER_XLIB(); |
3513 if ((ix0 == ix1) && (iy0 == iy1)) { |
3513 if ((ix0 == ix1) && (iy0 == iy1)) { |
3514 /* little bit shorter X-lib message (better with slow connections...) */ |
3514 /* little bit shorter X-lib message (better with slow connections...) */ |
3515 XDrawPoint(dpy, win, gc, ix0, iy0); |
3515 XDrawPoint(dpy, win, gc, ix0, iy0); |
3516 } else { |
3516 } else { |
3517 XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1); |
3517 XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1); |
3518 } |
3518 } |
3519 LEAVE_XLIB(); |
3519 LEAVE_XLIB(); |
3520 RETURN ( self ); |
3520 RETURN ( self ); |
3521 } |
3521 } |
3522 %}. |
3522 %}. |
3523 "badGC, badDrawable or coordinates not integer" |
3523 "badGC, badDrawable or coordinates not integer" |
3524 self primitiveFailedOrClosedConnection |
3524 self primitiveFailedOrClosedConnection |
3525 ! |
3525 ! |
3532 <context: #return> |
3532 <context: #return> |
3533 |
3533 |
3534 |noY| |
3534 |noY| |
3535 |
3535 |
3536 (noY := yValues size) < 2 ifTrue:[ |
3536 (noY := yValues size) < 2 ifTrue:[ |
3537 ^ self |
3537 ^ self |
3538 ]. |
3538 ]. |
3539 |
3539 |
3540 operationsUntilFlush notNil ifTrue:[ |
3540 operationsUntilFlush notNil ifTrue:[ |
3541 operationsUntilFlush <= 0 ifTrue:[ |
3541 operationsUntilFlush <= 0 ifTrue:[ |
3542 self flush. |
3542 self flush. |
3543 ] ifFalse:[ |
3543 ] ifFalse:[ |
3544 operationsUntilFlush := operationsUntilFlush - 1. |
3544 operationsUntilFlush := operationsUntilFlush - 1. |
3545 ]. |
3545 ]. |
3546 ]. |
3546 ]. |
3547 %{ |
3547 %{ |
3548 OBJ yA, t; |
3548 OBJ yA, t; |
3549 int i, num; |
3549 int i, num; |
3550 float y, x, sY, tY, step; |
3550 float y, x, sY, tY, step; |
3556 Window win; |
3556 Window win; |
3557 |
3557 |
3558 if (ISCONNECTED |
3558 if (ISCONNECTED |
3559 && __isExternalAddress(aGCId) |
3559 && __isExternalAddress(aGCId) |
3560 && __isExternalAddress(aDrawableId) ) { |
3560 && __isExternalAddress(aDrawableId) ) { |
3561 gc = __GCVal(aGCId); |
3561 gc = __GCVal(aGCId); |
3562 win = __WindowVal(aDrawableId); |
3562 win = __WindowVal(aDrawableId); |
3563 |
3563 |
3564 if( __isSmallInteger(scaleY) ) |
3564 if( __isSmallInteger(scaleY) ) |
3565 sY = (float) __intVal( scaleY ); |
3565 sY = (float) __intVal( scaleY ); |
3566 else if (__isFloat(scaleY)) |
3566 else if (__isFloat(scaleY)) |
3567 sY = __floatVal( scaleY ); |
3567 sY = __floatVal( scaleY ); |
3568 else if (__isShortFloat(scaleY)) |
3568 else if (__isShortFloat(scaleY)) |
3569 sY = __shortFloatVal( scaleY ); |
3569 sY = __shortFloatVal( scaleY ); |
3570 else { |
3570 else { |
3571 t = __SSEND0(scaleY, @symbol(asFloat), 0); |
3571 t = __SSEND0(scaleY, @symbol(asFloat), 0); |
3572 if (! __isFloat(t)) goto fail; |
3572 if (! __isFloat(t)) goto fail; |
3573 sY = __floatVal( t ); |
3573 sY = __floatVal( t ); |
3574 } |
3574 } |
3575 |
3575 |
3576 if( __isSmallInteger(transY) ) |
3576 if( __isSmallInteger(transY) ) |
3577 tY = (float) __intVal( transY ); |
3577 tY = (float) __intVal( transY ); |
3578 else if (__isFloat(transY)) |
3578 else if (__isFloat(transY)) |
3579 tY = __floatVal( transY ); |
3579 tY = __floatVal( transY ); |
3580 else if (__isShortFloat(transY)) |
3580 else if (__isShortFloat(transY)) |
3581 tY = __shortFloatVal( transY ); |
3581 tY = __shortFloatVal( transY ); |
3582 else { |
3582 else { |
3583 t = __SSEND0(transY, @symbol(asFloat), 0); |
3583 t = __SSEND0(transY, @symbol(asFloat), 0); |
3584 if (! __isFloat(t)) goto fail; |
3584 if (! __isFloat(t)) goto fail; |
3585 tY = __floatVal( t ); |
3585 tY = __floatVal( t ); |
3586 } |
3586 } |
3587 |
3587 |
3588 if( __isSmallInteger(startX) ) |
3588 if( __isSmallInteger(startX) ) |
3589 x = (float) __intVal( startX ); |
3589 x = (float) __intVal( startX ); |
3590 else if (__isFloat(startX)) |
3590 else if (__isFloat(startX)) |
3591 x = __floatVal( startX ); |
3591 x = __floatVal( startX ); |
3592 else if (__isShortFloat(startX)) |
3592 else if (__isShortFloat(startX)) |
3593 x = __shortFloatVal( startX ); |
3593 x = __shortFloatVal( startX ); |
3594 else { |
3594 else { |
3595 t = __SSEND0(startX, @symbol(asFloat), 0); |
3595 t = __SSEND0(startX, @symbol(asFloat), 0); |
3596 if (! __isFloat(t)) goto fail; |
3596 if (! __isFloat(t)) goto fail; |
3597 x = __floatVal( t ); |
3597 x = __floatVal( t ); |
3598 } |
3598 } |
3599 |
3599 |
3600 if( __isSmallInteger(stepX) ) |
3600 if( __isSmallInteger(stepX) ) |
3601 step = (float) __intVal( stepX ); |
3601 step = (float) __intVal( stepX ); |
3602 else if (__isFloat(stepX)) |
3602 else if (__isFloat(stepX)) |
3603 step = __floatVal( stepX ); |
3603 step = __floatVal( stepX ); |
3604 else if (__isShortFloat(stepX)) |
3604 else if (__isShortFloat(stepX)) |
3605 step = __shortFloatVal( stepX ); |
3605 step = __shortFloatVal( stepX ); |
3606 else { |
3606 else { |
3607 t = __SSEND0(stepX, @symbol(asFloat), 0); |
3607 t = __SSEND0(stepX, @symbol(asFloat), 0); |
3608 if (! __isFloat(t)) goto fail; |
3608 if (! __isFloat(t)) goto fail; |
3609 step = __floatVal( t ); |
3609 step = __floatVal( t ); |
3610 } |
3610 } |
3611 |
3611 |
3612 num = __intVal( noY ); |
3612 num = __intVal( noY ); |
3613 |
3613 if( num > 200 ) { |
3614 if( num > 200 ) { |
3614 if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) ) |
3615 if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) ) |
3615 goto fail; |
3616 goto fail; |
3616 mustFree = 1; |
3617 mustFree = 1; |
3617 } else { |
3618 } else { |
3618 points = qPoints; |
3619 points = qPoints; |
3619 } |
3620 } |
3620 for( i = 0; i < num; ++i ) { |
3621 for( i = 0; i < num; ++i ) { |
3621 int px, py; |
3622 int px, py; |
3622 |
3623 |
3623 yA = __AT_(yValues, __MKSMALLINT(i+1) ); |
3624 yA = __AT_(yValues, __MKSMALLINT(i+1) ); |
3624 |
3625 |
3625 if( __isFloat(yA) ) |
3626 if( __isFloat(yA) ) |
3626 y = __floatVal( yA ); |
3627 y = __floatVal( yA ); |
3627 else if( __isSmallInteger(yA) ) |
3628 else if( __isSmallInteger(yA) ) |
3628 y = (float) __intVal( yA ); |
3629 y = (float) __intVal( yA ); |
3629 else if( __isShortFloat( yA) ) |
3630 else if( __isShortFloat( yA) ) |
3630 y = __shortFloatVal( yA ); |
3631 y = __shortFloatVal( yA ); |
3631 else { |
3632 else { |
3632 t = __SSEND0(yA, @symbol(asFloat), 0); |
3633 t = __SSEND0(yA, @symbol(asFloat), 0); |
3633 if (! __isFloat(t)) goto fail; |
3634 if (! __isFloat(t)) goto fail; |
3634 y = __floatVal( t ); |
3635 y = __floatVal( t ); |
3635 } |
3636 } |
3636 |
3637 |
3637 px = (int) (x + 0.5); |
3638 px = (int) (x + 0.5); |
3638 py = (int) ((y * sY) + tY + 0.5); |
3639 py = (int) ((y * sY) + tY + 0.5); |
3639 |
3640 |
3640 /* attention: coordinates in X are shorts and wrap; clamp here. */ |
3641 /* attention: coordinates in X are shorts and wrap; clamp here. */ |
3641 if (px > 0x7FFF) px = 0x7FFF; |
3642 if (px > 0x7FFF) px = 0x7FFF; |
3642 else if (px < -0x8000) px = -0x8000; |
3643 else if (px < -0x8000) px = -0x8000; |
3643 if (py > 0x7FFF) py = 0x7FFF; |
3644 if (py > 0x7FFF) py = 0x7FFF; |
3644 else if (py < -0x8000) py = -0x8000; |
3645 else if (py < -0x8000) py = -0x8000; |
3645 |
3646 |
3646 points[i].x = px; |
3647 points[i].x = px; |
3647 points[i].y = py; |
3648 points[i].y = py; |
3648 x = x + step; |
3649 x = x + step; |
3649 } |
3650 } |
3650 |
3651 |
3651 ENTER_XLIB(); |
3652 ENTER_XLIB(); |
3652 XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
3653 XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
3653 LEAVE_XLIB(); |
3654 LEAVE_XLIB(); |
3654 |
3655 |
3655 if( mustFree ) { |
3656 if( mustFree ) { |
3656 free( points ); |
3657 free( points ); |
3657 } |
3658 } |
3658 RETURN ( self ); |
3659 RETURN ( self ); |
|
3660 } |
3659 } |
3661 |
3660 |
3662 fail: |
3661 fail: |
3663 if( mustFree ) |
3662 if( mustFree ) |
3664 free( points ); |
3663 free( points ); |
3665 %}. |
3664 %}. |
3666 ^ super displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId |
3665 ^ super displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId |
3667 |
3666 |
3668 "Modified: / 13.6.1998 / 13:51:39 / cg" |
3667 "Modified: / 13.6.1998 / 13:51:39 / cg" |
3669 ! |
3668 ! |
3672 "draw a point. If x/y are not integers, an error is triggered." |
3671 "draw a point. If x/y are not integers, an error is triggered." |
3673 |
3672 |
3674 <context: #return> |
3673 <context: #return> |
3675 |
3674 |
3676 operationsUntilFlush notNil ifTrue:[ |
3675 operationsUntilFlush notNil ifTrue:[ |
3677 operationsUntilFlush <= 0 ifTrue:[ |
3676 operationsUntilFlush <= 0 ifTrue:[ |
3678 self flush. |
3677 self flush. |
3679 ] ifFalse:[ |
3678 ] ifFalse:[ |
3680 operationsUntilFlush := operationsUntilFlush - 1. |
3679 operationsUntilFlush := operationsUntilFlush - 1. |
3681 ]. |
3680 ]. |
3682 ]. |
3681 ]. |
3683 %{ |
3682 %{ |
3684 |
3683 |
3685 GC gc; |
3684 GC gc; |
3686 Window win; |
3685 Window win; |
3687 |
3686 |
3688 if (ISCONNECTED |
3687 if (ISCONNECTED |
3689 && __isExternalAddress(aGCId) |
3688 && __isExternalAddress(aGCId) |
3690 && __isExternalAddress(aDrawableId) |
3689 && __isExternalAddress(aDrawableId) |
3691 && __bothSmallInteger(x, y)) { |
3690 && __bothSmallInteger(x, y)) { |
3692 int px, py; |
3691 int px, py; |
3693 |
3692 |
3694 gc = __GCVal(aGCId); |
3693 gc = __GCVal(aGCId); |
3695 win = __WindowVal(aDrawableId); |
3694 win = __WindowVal(aDrawableId); |
3696 |
3695 px = __intVal(x); |
3697 px = __intVal(x); |
3696 py = __intVal(y); |
3698 py = __intVal(y); |
3697 if (px > 0x7FFF) px = 0x7FFF; |
3699 if (px > 0x7FFF) px = 0x7FFF; |
3698 else if (px < -0x8000) px = -0x8000; |
3700 else if (px < -0x8000) px = -0x8000; |
3699 if (py > 0x7FFF) py = 0x7FFF; |
3701 if (py > 0x7FFF) py = 0x7FFF; |
3700 else if (py < -0x8000) py = -0x8000; |
3702 else if (py < -0x8000) py = -0x8000; |
3701 ENTER_XLIB(); |
3703 |
3702 XDrawPoint(myDpy, win, gc, px, py); |
3704 ENTER_XLIB(); |
3703 LEAVE_XLIB(); |
3705 XDrawPoint(myDpy, win, gc, px, py); |
3704 RETURN ( self ); |
3706 LEAVE_XLIB(); |
|
3707 |
|
3708 RETURN ( self ); |
|
3709 } |
3705 } |
3710 %}. |
3706 %}. |
3711 "badGC, badDrawable or x/y not integer" |
3707 "badGC, badDrawable or x/y not integer" |
3712 self primitiveFailedOrClosedConnection |
3708 self primitiveFailedOrClosedConnection |
3713 ! |
3709 ! |
3720 <context: #return> |
3716 <context: #return> |
3721 |
3717 |
3722 |numberOfPoints newPoints| |
3718 |numberOfPoints newPoints| |
3723 |
3719 |
3724 operationsUntilFlush notNil ifTrue:[ |
3720 operationsUntilFlush notNil ifTrue:[ |
3725 operationsUntilFlush <= 0 ifTrue:[ |
3721 operationsUntilFlush <= 0 ifTrue:[ |
3726 self flush. |
3722 self flush. |
3727 ] ifFalse:[ |
3723 ] ifFalse:[ |
3728 operationsUntilFlush := operationsUntilFlush - 1. |
3724 operationsUntilFlush := operationsUntilFlush - 1. |
3729 ]. |
3725 ]. |
3730 ]. |
3726 ]. |
3731 numberOfPoints := aPolygon size. |
3727 numberOfPoints := aPolygon size. |
3732 %{ |
3728 %{ |
3733 GC gc; |
3729 GC gc; |
3734 Window win; |
3730 Window win; |
3740 |
3736 |
3741 if (ISCONNECTED |
3737 if (ISCONNECTED |
3742 && __isExternalAddress(aGCId) |
3738 && __isExternalAddress(aGCId) |
3743 && __isExternalAddress(aDrawableId) |
3739 && __isExternalAddress(aDrawableId) |
3744 && __isSmallInteger(numberOfPoints)) { |
3740 && __isSmallInteger(numberOfPoints)) { |
3745 gc = __GCVal(aGCId); |
3741 gc = __GCVal(aGCId); |
3746 win = __WindowVal(aDrawableId); |
3742 win = __WindowVal(aDrawableId); |
3747 num = __intVal(numberOfPoints); |
3743 num = __intVal(numberOfPoints); |
3748 /* |
3744 /* |
3749 * avoid a (slow) malloc, if the number of points is small |
3745 * avoid a (slow) malloc, if the number of points is small |
3750 */ |
3746 */ |
3751 if (num > 100) { |
3747 if (num > 100) { |
3752 points = (XPoint *)malloc(sizeof(XPoint) * num); |
3748 points = (XPoint *)malloc(sizeof(XPoint) * num); |
3753 if (! points) goto fail; |
3749 if (! points) goto fail; |
3754 mustFree = 1; |
3750 mustFree = 1; |
3755 } else |
3751 } else |
3756 points = qPoints; |
3752 points = qPoints; |
3757 |
3753 |
3758 for (i=0; i<num; i++) { |
3754 for (i=0; i<num; i++) { |
3759 int px, py; |
3755 int px, py; |
3760 |
3756 |
3761 point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
3757 point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
3762 if (! __isPoint(point)) goto fail; |
3758 if (! __isPoint(point)) goto fail; |
3763 x = _point_X(point); |
3759 x = _point_X(point); |
3764 y = _point_Y(point); |
3760 y = _point_Y(point); |
3765 if (! __bothSmallInteger(x, y)) |
3761 if (! __bothSmallInteger(x, y)) |
3766 goto fail; |
3762 goto fail; |
3767 |
3763 |
3768 px = __intVal(x); |
3764 px = __intVal(x); |
3769 py = __intVal(y); |
3765 py = __intVal(y); |
3770 |
3766 |
3771 /* attention: coordinates in X are shorts and wrap; clamp here. */ |
3767 /* attention: coordinates in X are shorts and wrap; clamp here. */ |
3772 if (px > 0x7FFF) px = 0x7FFF; |
3768 if (px > 0x7FFF) px = 0x7FFF; |
3773 else if (px < -0x8000) px = -0x8000; |
3769 else if (px < -0x8000) px = -0x8000; |
3774 if (py > 0x7FFF) py = 0x7FFF; |
3770 if (py > 0x7FFF) py = 0x7FFF; |
3775 else if (py < -0x8000) py = -0x8000; |
3771 else if (py < -0x8000) py = -0x8000; |
3776 |
3772 |
3777 points[i].x = px; |
3773 points[i].x = px; |
3778 points[i].y = py; |
3774 points[i].y = py; |
3779 } |
3775 } |
3780 |
3776 |
3781 ENTER_XLIB(); |
3777 ENTER_XLIB(); |
3782 XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
3778 XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
3783 LEAVE_XLIB(); |
3779 LEAVE_XLIB(); |
3784 |
3780 |
3785 if (mustFree) |
3781 if (mustFree) |
3786 free(points); |
3782 free(points); |
3787 RETURN ( self ); |
3783 RETURN ( self ); |
3788 } |
3784 } |
3789 fail: ; |
3785 fail: ; |
3790 if (mustFree) |
3786 if (mustFree) |
3791 free(points); |
3787 free(points); |
3792 %}. |
3788 %}. |
3793 "badGC, badDrawable or coordinates not integer" |
3789 "badGC, badDrawable or coordinates not integer" |
3794 self primitiveFailedOrClosedConnection |
3790 self primitiveFailedOrClosedConnection |
3795 ! |
3791 ! |
3796 |
3792 |
3798 "draw a rectangle. If the coordinates are not integers, an error is triggered." |
3794 "draw a rectangle. If the coordinates are not integers, an error is triggered." |
3799 |
3795 |
3800 <context: #return> |
3796 <context: #return> |
3801 |
3797 |
3802 operationsUntilFlush notNil ifTrue:[ |
3798 operationsUntilFlush notNil ifTrue:[ |
3803 operationsUntilFlush <= 0 ifTrue:[ |
3799 operationsUntilFlush <= 0 ifTrue:[ |
3804 self flush. |
3800 self flush. |
3805 ] ifFalse:[ |
3801 ] ifFalse:[ |
3806 operationsUntilFlush := operationsUntilFlush - 1. |
3802 operationsUntilFlush := operationsUntilFlush - 1. |
3807 ]. |
3803 ]. |
3808 ]. |
3804 ]. |
3809 %{ |
3805 %{ |
3810 |
3806 |
3811 GC gc; |
3807 GC gc; |
3812 Window win; |
3808 Window win; |
3815 if (ISCONNECTED |
3811 if (ISCONNECTED |
3816 && __isExternalAddress(aGCId) |
3812 && __isExternalAddress(aGCId) |
3817 && __isExternalAddress(aDrawableId) |
3813 && __isExternalAddress(aDrawableId) |
3818 && __bothSmallInteger(x, y) |
3814 && __bothSmallInteger(x, y) |
3819 && __bothSmallInteger(width, height)) { |
3815 && __bothSmallInteger(width, height)) { |
3820 int px, py; |
3816 int px, py; |
3821 |
3817 |
3822 gc = __GCVal(aGCId); |
3818 gc = __GCVal(aGCId); |
3823 win = __WindowVal(aDrawableId); |
3819 win = __WindowVal(aDrawableId); |
3824 w = __intVal(width); |
3820 w = __intVal(width); |
3825 h = __intVal(height); |
3821 h = __intVal(height); |
3826 |
3822 |
3827 /* |
3823 /* |
3828 * need this check here: some servers simply dump core with bad args |
3824 * need this check here: some servers simply dump core with bad args |
3829 */ |
3825 */ |
3830 if ((w >= 0) && (h >= 0)) { |
3826 if ((w >= 0) && (h >= 0)) { |
3831 px = __intVal(x); |
3827 px = __intVal(x); |
3832 py = __intVal(y); |
3828 py = __intVal(y); |
3833 |
3829 |
3834 /* attention: coordinates in X are shorts and wrap; clamp here. */ |
3830 /* attention: coordinates in X are shorts and wrap; clamp here. */ |
3835 if (px > 0x7FFF) px = 0x7FFF; |
3831 if (px > 0x7FFF) px = 0x7FFF; |
3836 else if (px < -0x8000) px = -0x8000; |
3832 else if (px < -0x8000) px = -0x8000; |
3837 if (py > 0x7FFF) py = 0x7FFF; |
3833 if (py > 0x7FFF) py = 0x7FFF; |
3838 else if (py < -0x8000) py = -0x8000; |
3834 else if (py < -0x8000) py = -0x8000; |
3839 |
3835 |
3840 ENTER_XLIB(); |
3836 ENTER_XLIB(); |
3841 XDrawRectangle(myDpy, win, gc, px, py, w, h); |
3837 XDrawRectangle(myDpy, win, gc, px, py, w, h); |
3842 LEAVE_XLIB(); |
3838 LEAVE_XLIB(); |
3843 } |
3839 } |
3844 RETURN ( self ); |
3840 RETURN ( self ); |
3845 } |
3841 } |
3846 %}. |
3842 %}. |
3847 "badGC, badDrawable or coordinates not integer" |
3843 "badGC, badDrawable or coordinates not integer" |
3848 self primitiveFailedOrClosedConnection |
3844 self primitiveFailedOrClosedConnection |
3849 ! |
3845 ! |
3854 If the coordinates are not integers, an error is triggered." |
3850 If the coordinates are not integers, an error is triggered." |
3855 |
3851 |
3856 <context: #return> |
3852 <context: #return> |
3857 |
3853 |
3858 operationsUntilFlush notNil ifTrue:[ |
3854 operationsUntilFlush notNil ifTrue:[ |
3859 operationsUntilFlush <= 0 ifTrue:[ |
3855 operationsUntilFlush <= 0 ifTrue:[ |
3860 self flush. |
3856 self flush. |
3861 ] ifFalse:[ |
3857 ] ifFalse:[ |
3862 operationsUntilFlush := operationsUntilFlush - 1. |
3858 operationsUntilFlush := operationsUntilFlush - 1. |
3863 ]. |
3859 ]. |
3864 ]. |
3860 ]. |
3865 %{ |
3861 %{ |
3866 |
3862 |
3867 GC gc; |
3863 GC gc; |
3868 Window win; |
3864 Window win; |
3876 && __isExternalAddress(aGCId) |
3872 && __isExternalAddress(aGCId) |
3877 && __isExternalAddress(aDrawableId) |
3873 && __isExternalAddress(aDrawableId) |
3878 && __isNonNilObject(aString) |
3874 && __isNonNilObject(aString) |
3879 && __bothSmallInteger(index1, index2) |
3875 && __bothSmallInteger(index1, index2) |
3880 && __bothSmallInteger(x, y)) { |
3876 && __bothSmallInteger(x, y)) { |
3881 int lMax = __intVal(@global(MaxStringLength)); |
3877 int lMax = __intVal(@global(MaxStringLength)); |
3882 Display *dpy = myDpy; |
3878 Display *dpy = myDpy; |
3883 gc = __GCVal(aGCId); |
3879 gc = __GCVal(aGCId); |
3884 win = __WindowVal(aDrawableId); |
3880 win = __WindowVal(aDrawableId); |
3885 |
3881 |
3886 i1 = __intVal(index1) - 1; |
3882 i1 = __intVal(index1) - 1; |
3887 if (i1 >= 0) { |
3883 if (i1 >= 0) { |
3888 OBJ cls; |
3884 OBJ cls; |
3889 |
3885 |
3890 i2 = __intVal(index2) - 1; |
3886 i2 = __intVal(index2) - 1; |
3891 if (i2 < i1) { |
3887 if (i2 < i1) { |
3892 RETURN (self); |
3888 RETURN (self); |
3893 } |
3889 } |
3894 |
3890 cp = (char *) __stringVal(aString); |
3895 cp = (char *) __stringVal(aString); |
3891 l = i2 - i1 + 1; |
3896 l = i2 - i1 + 1; |
3892 |
3897 |
3893 if (__isStringLike(aString)) { |
3898 if (__isStringLike(aString)) { |
3894 n = __stringSize(aString); |
3899 n = __stringSize(aString); |
3895 if (i2 < n) { |
3900 if (i2 < n) { |
3896 cp += i1; |
3901 cp += i1; |
3897 if (l > lMax) l = lMax; |
3902 if (l > lMax) l = lMax; |
3898 ENTER_XLIB(); |
3903 ENTER_XLIB(); |
3899 if (opaque == true) |
3904 if (opaque == true) |
3900 XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
3905 XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
3901 else |
3906 else |
3902 XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
3907 XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
3903 LEAVE_XLIB(); |
3908 LEAVE_XLIB(); |
3904 RETURN ( self ); |
3909 RETURN ( self ); |
3905 } |
3910 } |
3906 } |
3911 } |
3907 |
3912 |
3908 cls = __qClass(aString); |
3913 cls = __qClass(aString); |
3909 nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
3914 nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
3910 cp += nInstBytes; |
3915 cp += nInstBytes; |
3911 |
3916 |
3912 if (__isBytes(aString)) { |
3917 if (__isBytes(aString)) { |
3913 n = __byteArraySize(aString) - nInstBytes - 1; |
3918 n = __byteArraySize(aString) - nInstBytes - 1; |
3914 |
3919 |
3915 if (i2 < n) { |
3920 if (i2 < n) { |
3916 cp += i1; |
3921 cp += i1; |
3917 if (l > lMax) l = lMax; |
3922 if (l > lMax) l = lMax; |
3918 ENTER_XLIB(); |
3923 ENTER_XLIB(); |
3919 if (opaque == true) |
3924 if (opaque == true) |
3920 XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
3925 XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
3921 else |
3926 else |
3922 XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
3927 XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
3923 LEAVE_XLIB(); |
3928 LEAVE_XLIB(); |
3924 RETURN ( self ); |
3929 RETURN ( self ); |
3925 } |
3930 } |
3926 } |
3931 } |
3927 |
3932 |
3928 /* TWOBYTESTRINGS */ |
3933 /* TWOBYTESTRINGS */ |
3929 if (__isWords(aString)) { |
3934 if (__isWords(aString)) { |
3930 n = (__byteArraySize(aString) - nInstBytes) / 2; |
3935 n = (__byteArraySize(aString) - nInstBytes) / 2; |
3931 if (i2 < n) { |
3936 if (i2 < n) { |
3932 union { |
3937 union { |
3933 char b[2]; |
3938 char b[2]; |
3934 unsigned short s; |
3939 unsigned short s; |
3935 } u; |
3940 } u; |
3936 int i; |
3941 int i; |
3937 XChar2b *cp2 = (XChar2b *)0; |
3942 XChar2b *cp2 = (XChar2b *)0; |
3938 int mustFree = 0; |
3943 int mustFree = 0; |
3939 |
3944 |
3940 cp += (i1 * 2); |
3945 cp += (i1 * 2); |
3941 if (l > lMax) l = lMax; |
3946 if (l > lMax) l = lMax; |
|
3947 |
3942 |
3948 #if defined(MSBFIRST) || defined(__MSBFIRST) |
3943 #if defined(MSBFIRST) || defined(__MSBFIRST) |
3949 /* |
3944 /* |
3950 * chars already in correct order |
3945 * chars already in correct order |
3951 */ |
3946 */ |
3952 #else |
3947 #else |
3953 # if ! (defined(LSBFIRST) || defined(__LSBFIRST)) |
3948 # if ! (defined(LSBFIRST) || defined(__LSBFIRST)) |
3954 /* |
3949 /* |
3955 * ST/X TwoByteStrings store the asciiValue in native byteOrder; |
3950 * ST/X TwoByteStrings store the asciiValue in native byteOrder; |
3956 * X expects them MSB first |
3951 * X expects them MSB first |
3957 * convert as required |
3952 * convert as required |
3958 */ |
3953 */ |
3959 u.s = 0x1234; |
3954 u.s = 0x1234; |
3960 if (u.b[0] != 0x12) |
3955 if (u.b[0] != 0x12) |
3961 # endif |
3956 # endif |
3962 { |
3957 { |
3963 if (l <= NLOCALBUFFER) { |
3958 if (l <= NLOCALBUFFER) { |
3964 cp2 = xlatebuffer; |
3959 cp2 = xlatebuffer; |
3965 } else { |
3960 } else { |
3966 cp2 = (XChar2b *)(malloc(l * 2)); |
3961 cp2 = (XChar2b *)(malloc(l * 2)); |
3967 mustFree = 1; |
3962 mustFree = 1; |
3968 } |
3963 } |
3969 for (i=0; i<l; i++) { |
3964 for (i=0; i<l; i++) { |
3970 cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
3965 cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
3971 cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
3966 cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
3972 } |
3967 } |
3973 cp = (char *) cp2; |
3968 cp = (char *) cp2; |
3974 } |
3969 } |
3975 #endif |
3970 #endif |
3976 ENTER_XLIB(); |
3971 ENTER_XLIB(); |
3977 if (opaque == true) |
3972 if (opaque == true) |
3978 XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
3973 XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
3979 else |
3974 else |
3980 XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
3975 XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
3981 LEAVE_XLIB(); |
3976 LEAVE_XLIB(); |
3982 |
3977 |
3983 if (mustFree) { |
3978 if (mustFree) { |
3984 free(cp2); |
3979 free(cp2); |
3985 } |
3980 } |
3986 |
3981 |
3987 RETURN ( self ); |
3982 RETURN ( self ); |
3988 } |
3983 } |
3989 } |
3984 } |
3990 |
3985 |
3991 /* FOURBYTESTRINGS */ |
3986 /* FOURBYTESTRINGS */ |
3992 if (__isLongs(aString)) { |
3987 if (__isLongs(aString)) { |
3993 n = (__byteArraySize(aString) - nInstBytes) / 4; |
3988 n = (__byteArraySize(aString) - nInstBytes) / 4; |
3994 if (i2 < n) { |
3989 if (i2 < n) { |
3995 union { |
3990 union { |
3996 char b[2]; |
3991 char b[2]; |
3997 unsigned short s; |
3992 unsigned short s; |
3998 } u; |
3993 } u; |
3999 int i; |
3994 int i; |
4000 XChar2b *cp2 = (XChar2b *)0; |
3995 XChar2b *cp2 = (XChar2b *)0; |
4001 int32 *ip; |
3996 int32 *ip; |
4002 int mustFree = 0; |
3997 int mustFree = 0; |
4003 |
3998 |
4004 cp += (i1 * 4); |
3999 cp += (i1 * 4); |
4005 if (l > lMax) l = lMax; |
4000 if (l > lMax) l = lMax; |
4006 |
4001 |
4007 /* |
4002 /* |
4008 * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF. |
4003 * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF. |
4009 */ |
4004 */ |
4010 if (l <= NLOCALBUFFER) { |
4005 if (l <= NLOCALBUFFER) { |
4011 cp2 = xlatebuffer; |
4006 cp2 = xlatebuffer; |
4012 } else { |
4007 } else { |
4013 cp2 = (XChar2b *)(malloc(l * 2)); |
4008 cp2 = (XChar2b *)(malloc(l * 2)); |
4014 mustFree = 1; |
4009 mustFree = 1; |
4015 } |
4010 } |
4016 for (i=0; i<l; i++) { |
4011 for (i=0; i<l; i++) { |
4017 int32 codePoint = ((int32 *)cp)[i]; |
4012 int32 codePoint = ((int32 *)cp)[i]; |
4018 |
4013 |
4019 if (codePoint > 0xFFFF) { |
4014 if (codePoint > 0xFFFF) { |
4020 codePoint = 0xFFFF; |
4015 codePoint = 0xFFFF; |
4021 } |
4016 } |
4022 cp2[i].byte1 = (codePoint >> 8) & 0xFF; |
4017 cp2[i].byte1 = (codePoint >> 8) & 0xFF; |
4023 cp2[i].byte2 = codePoint & 0xFF; |
4018 cp2[i].byte2 = codePoint & 0xFF; |
4024 } |
4019 } |
4025 cp = (char *) cp2; |
4020 cp = (char *) cp2; |
4026 |
4021 |
4027 ENTER_XLIB(); |
4022 ENTER_XLIB(); |
4028 if (opaque == true) |
4023 if (opaque == true) |
4029 XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
4024 XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
4030 else |
4025 else |
4031 XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
4026 XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
4032 LEAVE_XLIB(); |
4027 LEAVE_XLIB(); |
4033 |
4028 |
4034 if (mustFree) { |
4029 if (mustFree) { |
4035 free(cp2); |
4030 free(cp2); |
4036 } |
4031 } |
4037 |
4032 |
4038 RETURN ( self ); |
4033 RETURN ( self ); |
4039 } |
4034 } |
4040 } |
4035 } |
4041 } |
4036 } |
4042 } |
4037 } |
4043 #undef NLOCALBUFFER |
4038 #undef NLOCALBUFFER |
4044 %}. |
4039 %}. |
4045 (aString isString and:[aString bitsPerCharacter > 16]) ifTrue:[ |
4040 (aString isString and:[aString bitsPerCharacter > 16]) ifTrue:[ |
4046 self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter) |
4041 self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter) |
4047 from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque. |
4042 from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque. |
4048 ^ self. |
4043 ^ self. |
4049 ]. |
4044 ]. |
4050 |
4045 |
4051 "x/y not integer, badGC or drawable, or not a string" |
4046 "x/y not integer, badGC or drawable, or not a string" |
4052 self primitiveFailedOrClosedConnection |
4047 self primitiveFailedOrClosedConnection |
4053 ! |
4048 ! |
4058 If the coordinates are not integers, an error is triggered." |
4053 If the coordinates are not integers, an error is triggered." |
4059 |
4054 |
4060 <context: #return> |
4055 <context: #return> |
4061 |
4056 |
4062 operationsUntilFlush notNil ifTrue:[ |
4057 operationsUntilFlush notNil ifTrue:[ |
4063 operationsUntilFlush <= 0 ifTrue:[ |
4058 operationsUntilFlush <= 0 ifTrue:[ |
4064 self flush. |
4059 self flush. |
4065 ] ifFalse:[ |
4060 ] ifFalse:[ |
4066 operationsUntilFlush := operationsUntilFlush - 1. |
4061 operationsUntilFlush := operationsUntilFlush - 1. |
4067 ]. |
4062 ]. |
4068 ]. |
4063 ]. |
4069 %{ |
4064 %{ |
4070 |
4065 |
4071 GC gc; |
4066 GC gc; |
4072 Window win; |
4067 Window win; |
4080 if (ISCONNECTED |
4075 if (ISCONNECTED |
4081 && __isExternalAddress(aGCId) |
4076 && __isExternalAddress(aGCId) |
4082 && __isExternalAddress(aDrawableId) |
4077 && __isExternalAddress(aDrawableId) |
4083 && __isNonNilObject(aString) |
4078 && __isNonNilObject(aString) |
4084 && __bothSmallInteger(x, y)) { |
4079 && __bothSmallInteger(x, y)) { |
4085 int lMax = __intVal(@global(MaxStringLength)); |
4080 int lMax = __intVal(@global(MaxStringLength)); |
4086 Display *dpy = myDpy; |
4081 Display *dpy = myDpy; |
4087 gc = __GCVal(aGCId); |
4082 gc = __GCVal(aGCId); |
4088 win = __WindowVal(aDrawableId); |
4083 win = __WindowVal(aDrawableId); |
4089 |
4084 |
4090 cp = (char *) __stringVal(aString); |
4085 cp = (char *) __stringVal(aString); |
4091 |
4086 |
4092 if (__isStringLike(aString)) { |
4087 if (__isStringLike(aString)) { |
4093 n = __stringSize(aString); |
4088 n = __stringSize(aString); |
4094 if (n > lMax) n = lMax; |
4089 if (n > lMax) n = lMax; |
4095 ENTER_XLIB(); |
4090 ENTER_XLIB(); |
4096 if (opaque == true) |
4091 if (opaque == true) |
4097 XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
4092 XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
4098 else |
4093 else |
4099 XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
4094 XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
4100 LEAVE_XLIB(); |
4095 LEAVE_XLIB(); |
4101 RETURN ( self ); |
4096 RETURN ( self ); |
4102 } |
4097 } |
4103 |
4098 |
4104 cls = __qClass(aString); |
4099 cls = __qClass(aString); |
4105 nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
4100 nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
4106 cp += nInstBytes; |
4101 cp += nInstBytes; |
4107 |
4102 |
4108 if (__isBytes(aString)) { |
4103 if (__isBytes(aString)) { |
4109 n = __byteArraySize(aString) - nInstBytes - 1; |
4104 n = __byteArraySize(aString) - nInstBytes - 1; |
4110 |
4105 |
4111 if (n > lMax) n = lMax; |
4106 if (n > lMax) n = lMax; |
4112 ENTER_XLIB(); |
4107 ENTER_XLIB(); |
4113 if (opaque == true) |
4108 if (opaque == true) |
4114 XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
4109 XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
4115 else |
4110 else |
4116 XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
4111 XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
4117 LEAVE_XLIB(); |
4112 LEAVE_XLIB(); |
4118 RETURN ( self ); |
4113 RETURN ( self ); |
4119 } |
4114 } |
4120 |
4115 |
4121 /* TWOBYTESTRINGS */ |
4116 /* TWOBYTESTRINGS */ |
4122 if (__isWords(aString)) { |
4117 if (__isWords(aString)) { |
4123 union { |
4118 union { |
4124 char b[2]; |
4119 char b[2]; |
4125 unsigned short s; |
4120 unsigned short s; |
4126 } u; |
4121 } u; |
4127 int i; |
4122 int i; |
4128 XChar2b *cp2; |
4123 XChar2b *cp2; |
4129 int mustFree = 0; |
4124 int mustFree = 0; |
4130 |
4125 |
4131 n = (__byteArraySize(aString) - nInstBytes) / 2; |
4126 n = (__byteArraySize(aString) - nInstBytes) / 2; |
4132 if (n > lMax) n = lMax; |
4127 if (n > lMax) n = lMax; |
4133 |
4128 |
4134 #if defined(MSBFIRST) || defined(__MSBFIRST) |
4129 #if defined(MSBFIRST) || defined(__MSBFIRST) |
4135 /* |
4130 /* |
4136 * chars already in correct order |
4131 * chars already in correct order |
4137 */ |
4132 */ |
4138 #else |
4133 #else |
4139 # if ! (defined(LSBFIRST) || defined(__LSBFIRST)) |
4134 # if ! (defined(LSBFIRST) || defined(__LSBFIRST)) |
4140 /* |
4135 /* |
4141 * ST/X TwoByteStrings store the asciiValue in native byteOrder; |
4136 * ST/X TwoByteStrings store the asciiValue in native byteOrder; |
4142 * X expects them MSB first |
4137 * X expects them MSB first |
4143 * convert as required |
4138 * convert as required |
4144 */ |
4139 */ |
4145 u.s = 0x1234; |
4140 u.s = 0x1234; |
4146 if (u.b[0] != 0x12) |
4141 if (u.b[0] != 0x12) |
4147 # endif |
4142 # endif |
4148 { |
4143 { |
4149 if (n <= NLOCALBUFFER) { |
4144 if (n <= NLOCALBUFFER) { |
4150 cp2 = xlatebuffer; |
4145 cp2 = xlatebuffer; |
4151 } else { |
4146 } else { |
4152 cp2 = (XChar2b *)(malloc(n * 2)); |
4147 cp2 = (XChar2b *)(malloc(n * 2)); |
4153 mustFree = 1; |
4148 mustFree = 1; |
4154 } |
4149 } |
4155 |
4150 |
4156 for (i=0; i<n; i++) { |
4151 for (i=0; i<n; i++) { |
4157 cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
4152 cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
4158 cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
4153 cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
4159 } |
4154 } |
4160 cp = (char *) cp2; |
4155 cp = (char *) cp2; |
4161 } |
4156 } |
4162 #endif |
4157 #endif |
4163 ENTER_XLIB(); |
4158 ENTER_XLIB(); |
4164 if (opaque == true) |
4159 if (opaque == true) |
4165 XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
4160 XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
4166 else |
4161 else |
4167 XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
4162 XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
4168 LEAVE_XLIB(); |
4163 LEAVE_XLIB(); |
4169 |
4164 |
4170 |
4165 if (mustFree) { |
4171 if (mustFree) { |
4166 free(cp2); |
4172 free(cp2); |
4167 } |
4173 } |
4168 |
4174 |
4169 RETURN ( self ); |
4175 RETURN ( self ); |
4170 } |
4176 } |
|
4177 } |
4171 } |
4178 #undef NLOCALBUFFER |
4172 #undef NLOCALBUFFER |
4179 %}. |
4173 %}. |
4180 ^ super displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
4174 ^ super displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
4181 ! |
4175 ! |
4182 |
4176 |
4183 drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding |
4177 drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding |
4184 width:imageWidth height:imageHeight |
4178 width:imageWidth height:imageHeight |
4185 x:srcx y:srcy |
4179 x:srcx y:srcy |
4186 into:aDrawableId |
4180 into:aDrawableId |
4187 x:dstx y:dsty |
4181 x:dstx y:dsty |
4188 width:w height:h |
4182 width:w height:h |
4189 with:aGCId |
4183 with:aGCId |
4190 |
4184 |
4191 "draw a bitImage which has depth id, width iw and height ih into |
4185 "draw a bitImage which has depth id, width iw and height ih into |
4192 the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
4186 the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
4193 Individual source pixels have bitsPerPixel bits, allowing to draw |
4187 Individual source pixels have bitsPerPixel bits, allowing to draw |
4194 depth and pixel-units to be different. |
4188 depth and pixel-units to be different. |
4206 "/ 8-bit padded image. (it wants it 32bit padded). |
4200 "/ 8-bit padded image. (it wants it 32bit padded). |
4207 "/ as a workaround, repad it here (although, the server and/or Xlib should |
4201 "/ as a workaround, repad it here (although, the server and/or Xlib should |
4208 "/ care for that. |
4202 "/ care for that. |
4209 |
4203 |
4210 ((imageDepth == 4) and:[depth == 4]) ifTrue:[ |
4204 ((imageDepth == 4) and:[depth == 4]) ifTrue:[ |
4211 fmt := self supportedImageFormatForDepth:4. |
4205 fmt := self supportedImageFormatForDepth:4. |
4212 fmt isNil ifTrue:[ |
4206 fmt isNil ifTrue:[ |
4213 self primitiveFailed. "/ cannot represent this image |
4207 self primitiveFailed. "/ cannot represent this image |
4214 ^ nil |
4208 ^ nil |
4215 ]. |
4209 ]. |
4216 wantedPadding := fmt at:#padding. |
4210 wantedPadding := fmt at:#padding. |
4217 wantedPadding > givenPadding ifTrue:[ |
4211 wantedPadding > givenPadding ifTrue:[ |
4218 bits := self |
4212 bits := self |
4219 repadBits:givenBits |
4213 repadBits:givenBits |
4220 width:imageWidth |
4214 width:imageWidth |
4221 height:imageHeight |
4215 height:imageHeight |
4222 depth:imageDepth |
4216 depth:imageDepth |
4223 from:givenPadding |
4217 from:givenPadding |
4224 to:wantedPadding. |
4218 to:wantedPadding. |
4225 padding := wantedPadding. |
4219 padding := wantedPadding. |
4226 ] |
4220 ] |
4227 ]. |
4221 ]. |
4228 |
4222 |
4229 |
4223 |
4230 operationsUntilFlush notNil ifTrue:[ |
4224 operationsUntilFlush notNil ifTrue:[ |
4231 operationsUntilFlush <= 0 ifTrue:[ |
4225 operationsUntilFlush <= 0 ifTrue:[ |
4232 self flush. |
4226 self flush. |
4233 ] ifFalse:[ |
4227 ] ifFalse:[ |
4234 operationsUntilFlush := operationsUntilFlush - 1. |
4228 operationsUntilFlush := operationsUntilFlush - 1. |
4235 ]. |
4229 ]. |
4236 ]. |
4230 ]. |
4237 " |
4231 " |
4238 sorry; I had to separate it into 2 methods, since XPutImage needs |
4232 sorry; I had to separate it into 2 methods, since XPutImage needs |
4239 an unlimited stack, and thus cannot send primitiveFailed |
4233 an unlimited stack, and thus cannot send primitiveFailed |
4240 " |
4234 " |
4241 (self |
4235 (self |
4242 primDrawBits:bits |
4236 primDrawBits:bits |
4243 bitsPerPixel:bitsPerPixel |
4237 bitsPerPixel:bitsPerPixel |
4244 depth:imageDepth |
4238 depth:imageDepth |
4245 msb:true |
4239 msb:true |
4246 padding:padding |
4240 padding:padding |
4247 width:imageWidth height:imageHeight |
4241 width:imageWidth height:imageHeight |
4248 x:srcx y:srcy |
4242 x:srcx y:srcy |
4249 into:aDrawableId |
4243 into:aDrawableId |
4250 x:dstx y:dsty |
4244 x:dstx y:dsty |
4251 width:w height:h |
4245 width:w height:h |
4252 with:aGCId) |
4246 with:aGCId) |
4253 ifFalse:[ |
4247 ifFalse:[ |
4254 " |
4248 " |
4255 also happens, if a segmentation violation occurs in the |
4249 also happens, if a segmentation violation occurs in the |
4256 XPutImage ... |
4250 XPutImage ... |
4257 " |
4251 " |
4258 self primitiveFailedOrClosedConnection |
4252 self primitiveFailedOrClosedConnection |
4259 ]. |
4253 ]. |
4260 ! |
4254 ! |
4261 |
4255 |
4262 fillArcX:x y:y width:width height:height from:startAngle angle:angle |
4256 fillArcX:x y:y width:width height:height from:startAngle angle:angle |
4263 in:aDrawableId with:aGCId |
4257 in:aDrawableId with:aGCId |
4264 "fill an arc. If any coordinate is not integer, an error is triggered. |
4258 "fill an arc. If any coordinate is not integer, an error is triggered. |
4265 The angles may be floats or integer - they are given in degrees." |
4259 The angles may be floats or integer - they are given in degrees." |
4266 |
4260 |
4267 <context: #return> |
4261 <context: #return> |
4268 |
4262 |
4269 operationsUntilFlush notNil ifTrue:[ |
4263 operationsUntilFlush notNil ifTrue:[ |
4270 operationsUntilFlush <= 0 ifTrue:[ |
4264 operationsUntilFlush <= 0 ifTrue:[ |
4271 self flush. |
4265 self flush. |
4272 ] ifFalse:[ |
4266 ] ifFalse:[ |
4273 operationsUntilFlush := operationsUntilFlush - 1. |
4267 operationsUntilFlush := operationsUntilFlush - 1. |
4274 ]. |
4268 ]. |
4275 ]. |
4269 ]. |
4276 %{ |
4270 %{ |
4277 |
4271 |
4278 GC gc; |
4272 GC gc; |
4279 Window win; |
4273 Window win; |
4280 int w, h, angle1, angle2; |
4274 int w, h, angle1, angle2; |
4281 double f; |
4275 double f; |
4282 |
4276 |
4283 if (__isSmallInteger(startAngle)) |
4277 if (__isSmallInteger(startAngle)) |
4284 angle1 = __intVal(startAngle) * 64; |
4278 angle1 = __intVal(startAngle) * 64; |
4285 else if (__isFloat(startAngle)) { |
4279 else if (__isFloat(startAngle)) { |
4286 f = __floatVal(startAngle); |
4280 f = __floatVal(startAngle); |
4287 angle1 = f * 64; |
4281 angle1 = f * 64; |
4288 } else if (__isShortFloat(startAngle)) { |
4282 } else if (__isShortFloat(startAngle)) { |
4289 f = __shortFloatVal(startAngle); |
4283 f = __shortFloatVal(startAngle); |
4290 angle1 = f * 64; |
4284 angle1 = f * 64; |
4291 } else goto bad; |
4285 } else goto bad; |
4292 |
4286 |
4293 if (__isSmallInteger(angle)) |
4287 if (__isSmallInteger(angle)) |
4294 angle2 = __intVal(angle) * 64; |
4288 angle2 = __intVal(angle) * 64; |
4295 else if (__isFloat(angle)) { |
4289 else if (__isFloat(angle)) { |
4296 f = __floatVal(angle); |
4290 f = __floatVal(angle); |
4297 angle2 = f * 64; |
4291 angle2 = f * 64; |
4298 } else if (__isShortFloat(angle)) { |
4292 } else if (__isShortFloat(angle)) { |
4299 f = __shortFloatVal(angle); |
4293 f = __shortFloatVal(angle); |
4300 angle2 = f * 64; |
4294 angle2 = f * 64; |
4301 } else goto bad; |
4295 } else goto bad; |
4302 |
4296 |
4303 if (ISCONNECTED |
4297 if (ISCONNECTED |
4304 && __isExternalAddress(aGCId) |
4298 && __isExternalAddress(aGCId) |
4305 && __isExternalAddress(aDrawableId) |
4299 && __isExternalAddress(aDrawableId) |
4306 && __bothSmallInteger(x, y) |
4300 && __bothSmallInteger(x, y) |
4307 && __bothSmallInteger(width, height)) { |
4301 && __bothSmallInteger(width, height)) { |
4308 gc = __GCVal(aGCId); |
4302 gc = __GCVal(aGCId); |
4309 win = __WindowVal(aDrawableId); |
4303 win = __WindowVal(aDrawableId); |
4310 w = __intVal(width); |
4304 w = __intVal(width); |
4311 h = __intVal(height); |
4305 h = __intVal(height); |
4312 /* |
4306 /* |
4313 * need this check here: some servers simply dump core with bad args |
4307 * need this check here: some servers simply dump core with bad args |
4314 */ |
4308 */ |
4315 if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
4309 if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
4316 ENTER_XLIB(); |
4310 ENTER_XLIB(); |
4317 XFillArc(myDpy, win, gc, __intVal(x), __intVal(y), |
4311 XFillArc(myDpy, win, gc, __intVal(x), __intVal(y), |
4318 w, h, angle1, angle2); |
4312 w, h, angle1, angle2); |
4319 LEAVE_XLIB(); |
4313 LEAVE_XLIB(); |
4320 } |
4314 } |
4321 RETURN ( self ); |
4315 RETURN ( self ); |
4322 } |
4316 } |
4323 bad: ; |
4317 bad: ; |
4324 %}. |
4318 %}. |
4325 "badGC, badDrawable or coordinates not integer |
4319 "badGC, badDrawable or coordinates not integer |
4326 or non float angle(s)" |
4320 or non float angle(s)" |
4335 <context: #return> |
4329 <context: #return> |
4336 |
4330 |
4337 |numberOfPoints| |
4331 |numberOfPoints| |
4338 |
4332 |
4339 operationsUntilFlush notNil ifTrue:[ |
4333 operationsUntilFlush notNil ifTrue:[ |
4340 operationsUntilFlush <= 0 ifTrue:[ |
4334 operationsUntilFlush <= 0 ifTrue:[ |
4341 self flush. |
4335 self flush. |
4342 ] ifFalse:[ |
4336 ] ifFalse:[ |
4343 operationsUntilFlush := operationsUntilFlush - 1. |
4337 operationsUntilFlush := operationsUntilFlush - 1. |
4344 ]. |
4338 ]. |
4345 ]. |
4339 ]. |
4346 numberOfPoints := aPolygon size. |
4340 numberOfPoints := aPolygon size. |
4347 %{ |
4341 %{ |
4348 GC gc; |
4342 GC gc; |
4349 Window win; |
4343 Window win; |
4355 |
4349 |
4356 if (ISCONNECTED |
4350 if (ISCONNECTED |
4357 && __isExternalAddress(aGCId) |
4351 && __isExternalAddress(aGCId) |
4358 && __isExternalAddress(aDrawableId) |
4352 && __isExternalAddress(aDrawableId) |
4359 && __isSmallInteger(numberOfPoints)) { |
4353 && __isSmallInteger(numberOfPoints)) { |
4360 gc = __GCVal(aGCId); |
4354 gc = __GCVal(aGCId); |
4361 win = __WindowVal(aDrawableId); |
4355 win = __WindowVal(aDrawableId); |
4362 num = __intVal(numberOfPoints); |
4356 num = __intVal(numberOfPoints); |
4363 if (num < 3) { |
4357 if (num < 3) { |
4364 RETURN ( self ); |
4358 RETURN ( self ); |
4365 } |
4359 } |
4366 /* |
4360 /* |
4367 * avoid (slow) malloc, if not many points |
4361 * avoid (slow) malloc, if not many points |
4368 */ |
4362 */ |
4369 if (num > 100) { |
4363 if (num > 100) { |
4370 points = (XPoint *) malloc(sizeof(XPoint) * num); |
4364 points = (XPoint *) malloc(sizeof(XPoint) * num); |
4371 if (! points) goto fail; |
4365 if (! points) goto fail; |
4372 mustFree = 1; |
4366 mustFree = 1; |
4373 } else |
4367 } else |
4374 points = qPoints; |
4368 points = qPoints; |
4375 for (i=0; i<num; i++) { |
4369 for (i=0; i<num; i++) { |
4376 point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
4370 point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
4377 if (! __isPoint(point)) goto fail; |
4371 if (! __isPoint(point)) goto fail; |
4378 x = _point_X(point); |
4372 x = _point_X(point); |
4379 y = _point_Y(point); |
4373 y = _point_Y(point); |
4380 if (! __bothSmallInteger(x, y)) |
4374 if (! __bothSmallInteger(x, y)) |
4381 goto fail; |
4375 goto fail; |
4382 points[i].x = __intVal(x); |
4376 points[i].x = __intVal(x); |
4383 points[i].y = __intVal(y); |
4377 points[i].y = __intVal(y); |
4384 } |
4378 } |
4385 ENTER_XLIB(); |
4379 ENTER_XLIB(); |
4386 XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin); |
4380 XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin); |
4387 LEAVE_XLIB(); |
4381 LEAVE_XLIB(); |
4388 if (mustFree) |
4382 if (mustFree) |
4389 free(points); |
4383 free(points); |
4390 RETURN ( self ); |
4384 RETURN ( self ); |
4391 |
4385 |
4392 fail: ; |
4386 fail: ; |
4393 if (mustFree) |
4387 if (mustFree) |
4394 free(points); |
4388 free(points); |
4395 } |
4389 } |
4396 %}. |
4390 %}. |
4397 "badGC, badDrawable or coordinates not integer" |
4391 "badGC, badDrawable or coordinates not integer" |
4398 self primitiveFailedOrClosedConnection |
4392 self primitiveFailedOrClosedConnection |
4399 ! |
4393 ! |
4402 "fill a rectangle. If any coordinate is not integer, an error is triggered." |
4396 "fill a rectangle. If any coordinate is not integer, an error is triggered." |
4403 |
4397 |
4404 <context: #return> |
4398 <context: #return> |
4405 |
4399 |
4406 operationsUntilFlush notNil ifTrue:[ |
4400 operationsUntilFlush notNil ifTrue:[ |
4407 operationsUntilFlush <= 0 ifTrue:[ |
4401 operationsUntilFlush <= 0 ifTrue:[ |
4408 self flush. |
4402 self flush. |
4409 ] ifFalse:[ |
4403 ] ifFalse:[ |
4410 operationsUntilFlush := operationsUntilFlush - 1. |
4404 operationsUntilFlush := operationsUntilFlush - 1. |
4411 ]. |
4405 ]. |
4412 ]. |
4406 ]. |
4413 %{ |
4407 %{ |
4414 |
4408 |
4415 int w, h; |
4409 int w, h; |
4416 |
4410 |
4417 if (ISCONNECTED |
4411 if (ISCONNECTED |
4418 && __isExternalAddress(aGCId) |
4412 && __isExternalAddress(aGCId) |
4419 && __isExternalAddress(aDrawableId) |
4413 && __isExternalAddress(aDrawableId) |
4420 && __bothSmallInteger(x, y) |
4414 && __bothSmallInteger(x, y) |
4421 && __bothSmallInteger(width, height)) { |
4415 && __bothSmallInteger(width, height)) { |
4422 w = __intVal(width); |
4416 w = __intVal(width); |
4423 h = __intVal(height); |
4417 h = __intVal(height); |
4424 /* |
4418 /* |
4425 * need this check here: some servers simply dump core with bad args |
4419 * need this check here: some servers simply dump core with bad args |
4426 */ |
4420 */ |
4427 if ((w >= 0) && (h >= 0)) { |
4421 if ((w >= 0) && (h >= 0)) { |
4428 ENTER_XLIB(); |
4422 ENTER_XLIB(); |
4429 XFillRectangle(myDpy, |
4423 XFillRectangle(myDpy, |
4430 __DrawableVal(aDrawableId), __GCVal(aGCId), |
4424 __DrawableVal(aDrawableId), __GCVal(aGCId), |
4431 __intVal(x), __intVal(y), w, h); |
4425 __intVal(x), __intVal(y), w, h); |
4432 LEAVE_XLIB(); |
4426 LEAVE_XLIB(); |
4433 } |
4427 } |
4434 RETURN ( self ); |
4428 RETURN ( self ); |
4435 } |
4429 } |
4436 %}. |
4430 %}. |
4437 "badGC, badDrawable or coordinates not integer" |
4431 "badGC, badDrawable or coordinates not integer" |
4438 self primitiveFailedOrClosedConnection |
4432 self primitiveFailedOrClosedConnection |
4439 ! |
4433 ! |
4440 |
4434 |
4441 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb masks:maskArray padding:bitPadding |
4435 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb masks:maskArray padding:bitPadding |
4442 extent:imageExtent sourceOrigin:srcOrg |
4436 extent:imageExtent sourceOrigin:srcOrg |
4443 into:aDrawableId |
4437 into:aDrawableId |
4444 destinationOrigin:dstOrg extent:dstExtent |
4438 destinationOrigin:dstOrg extent:dstExtent |
4445 with:aGCId |
4439 with:aGCId |
4446 |
4440 |
4447 <context: #return> |
4441 <context: #return> |
4448 |
4442 |
4449 |imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h| |
4443 |imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h| |
4450 |
4444 |
4484 && __bothSmallInteger(imageDepth, bitsPerPixel) |
4478 && __bothSmallInteger(imageDepth, bitsPerPixel) |
4485 && __isSmallInteger(bitPadding) |
4479 && __isSmallInteger(bitPadding) |
4486 && __bothSmallInteger(rm, gm) |
4480 && __bothSmallInteger(rm, gm) |
4487 && __isSmallInteger(bm) |
4481 && __isSmallInteger(bm) |
4488 && __isByteArrayLike(imageBits)) { |
4482 && __isByteArrayLike(imageBits)) { |
4489 Display *dpy = myDpy; |
4483 Display *dpy = myDpy; |
4490 int pad = __intVal(bitPadding); |
4484 int pad = __intVal(bitPadding); |
4491 |
4485 |
4492 gc = __GCVal(aGCId); |
4486 gc = __GCVal(aGCId); |
4493 win = __WindowVal(aDrawableId); |
4487 win = __WindowVal(aDrawableId); |
4494 if (! gc || !win) |
4488 if (! gc || !win) |
4495 goto fail; |
4489 goto fail; |
4496 #ifdef ARGDEBUG |
4490 #ifdef ARGDEBUG |
4497 console_printf("args ok\n"); |
4491 console_printf("args ok\n"); |
4498 #endif |
4492 #endif |
4499 image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
4493 image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
4500 image.width = imgWdth = __intVal(imageWidth); |
4494 image.width = imgWdth = __intVal(imageWidth); |
4501 image.height = __intVal(imageHeight); |
4495 image.height = __intVal(imageHeight); |
4502 image.xoffset = 0; |
4496 image.xoffset = 0; |
4503 image.format = ZPixmap; |
4497 image.format = ZPixmap; |
4504 image.byte_order = (msb == true) ? MSBFirst : LSBFirst; |
4498 image.byte_order = (msb == true) ? MSBFirst : LSBFirst; |
4505 image.bitmap_unit = 8; |
4499 image.bitmap_unit = 8; |
4506 image.bitmap_bit_order = MSBFirst; |
4500 image.bitmap_bit_order = MSBFirst; |
4507 image.bitmap_pad = pad; |
4501 image.bitmap_pad = pad; |
4508 image.depth = __intVal(imageDepth); |
4502 image.depth = __intVal(imageDepth); |
4509 image.bits_per_pixel = __intVal(bitsPerPixel); |
4503 image.bits_per_pixel = __intVal(bitsPerPixel); |
4510 image.red_mask = __intVal(rm); |
4504 image.red_mask = __intVal(rm); |
4511 image.green_mask = __intVal(gm); |
4505 image.green_mask = __intVal(gm); |
4512 image.blue_mask = __intVal(bm); |
4506 image.blue_mask = __intVal(bm); |
4513 |
4507 |
4514 image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8; |
4508 image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8; |
4515 |
4509 |
4516 switch (image.bits_per_pixel) { |
4510 switch (image.bits_per_pixel) { |
4517 case 1: |
4511 case 1: |
4518 case 2: |
4512 case 2: |
4519 case 4: |
4513 case 4: |
4520 case 8: |
4514 case 8: |
4521 case 16: |
4515 case 16: |
4522 case 24: |
4516 case 24: |
4523 case 32: |
4517 case 32: |
4524 break; |
4518 break; |
4525 |
4519 |
4526 default: |
4520 default: |
4527 #ifdef ARGDEBUG |
4521 #ifdef ARGDEBUG |
4528 console_printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
4522 console_printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
4529 #endif |
4523 #endif |
4530 goto fail; |
4524 goto fail; |
4531 } |
4525 } |
4532 |
4526 |
4533 /* ENTER_XLIB(); */ |
4527 /* ENTER_XLIB(); */ |
4534 XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), |
4528 XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), |
4535 __intVal(dstx), __intVal(dsty), |
4529 __intVal(dstx), __intVal(dsty), |
4536 __intVal(w), __intVal(h)); |
4530 __intVal(w), __intVal(h)); |
4537 /* LEAVE_XLIB(); */ |
4531 /* LEAVE_XLIB(); */ |
4538 |
4532 |
4539 RETURN ( true ); |
4533 RETURN ( true ); |
4540 } |
4534 } |
4541 #ifdef ARGDEBUG |
4535 #ifdef ARGDEBUG |
4542 if (!! __isExternalAddress(aGCId)) console_printf("GC\n"); |
4536 if (!! __isExternalAddress(aGCId)) console_printf("GC\n"); |
4543 if (!! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n"); |
4537 if (!! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n"); |
4544 if (!! __isSmallInteger(srcx)) console_printf("srcx\n"); |
4538 if (!! __isSmallInteger(srcx)) console_printf("srcx\n"); |
4559 . |
4553 . |
4560 ^ false |
4554 ^ false |
4561 ! |
4555 ! |
4562 |
4556 |
4563 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding |
4557 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding |
4564 width:imageWidth height:imageHeight |
4558 width:imageWidth height:imageHeight |
4565 x:srcx y:srcy |
4559 x:srcx y:srcy |
4566 into:aDrawableId |
4560 into:aDrawableId |
4567 x:dstx y:dsty |
4561 x:dstx y:dsty |
4568 width:w height:h |
4562 width:w height:h |
4569 with:aGCId |
4563 with:aGCId |
4570 |
4564 |
4571 <context: #return> |
4565 <context: #return> |
4572 |
4566 |
4573 "since XPutImage may allocate huge amount of stack space |
4567 "since XPutImage may allocate huge amount of stack space |
4574 (some implementations use alloca), this must run with unlimited stack." |
4568 (some implementations use alloca), this must run with unlimited stack." |
4592 && __bothSmallInteger(w, h) |
4586 && __bothSmallInteger(w, h) |
4593 && __bothSmallInteger(imageWidth, imageHeight) |
4587 && __bothSmallInteger(imageWidth, imageHeight) |
4594 && __bothSmallInteger(imageDepth, bitsPerPixel) |
4588 && __bothSmallInteger(imageDepth, bitsPerPixel) |
4595 && __isSmallInteger(bitPadding) |
4589 && __isSmallInteger(bitPadding) |
4596 && __isByteArrayLike(imageBits)) { |
4590 && __isByteArrayLike(imageBits)) { |
4597 Display *dpy = myDpy; |
4591 Display *dpy = myDpy; |
4598 int pad = __intVal(bitPadding); |
4592 int pad = __intVal(bitPadding); |
4599 |
4593 |
4600 gc = __GCVal(aGCId); |
4594 gc = __GCVal(aGCId); |
4601 win = __WindowVal(aDrawableId); |
4595 win = __WindowVal(aDrawableId); |
4602 if (! gc || !win) |
4596 if (! gc || !win) |
4603 goto fail; |
4597 goto fail; |
4604 #ifdef ARGDEBUG |
4598 #ifdef ARGDEBUG |
4605 console_printf("args ok\n"); |
4599 console_printf("args ok\n"); |
4606 #endif |
4600 #endif |
4607 image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
4601 image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
4608 image.width = imgWdth = __intVal(imageWidth); |
4602 image.width = imgWdth = __intVal(imageWidth); |
4609 image.height = __intVal(imageHeight); |
4603 image.height = __intVal(imageHeight); |
4610 image.xoffset = 0; |
4604 image.xoffset = 0; |
4611 image.format = ZPixmap; |
4605 image.format = ZPixmap; |
4612 image.byte_order = (msb == true) ? MSBFirst : LSBFirst; |
4606 image.byte_order = (msb == true) ? MSBFirst : LSBFirst; |
4613 image.bitmap_unit = 8; |
4607 image.bitmap_unit = 8; |
4614 image.bitmap_bit_order = MSBFirst; |
4608 image.bitmap_bit_order = MSBFirst; |
4615 image.bitmap_pad = pad; |
4609 image.bitmap_pad = pad; |
4616 image.depth = __intVal(imageDepth); |
4610 image.depth = __intVal(imageDepth); |
4617 image.bits_per_pixel = __intVal(bitsPerPixel); |
4611 image.bits_per_pixel = __intVal(bitsPerPixel); |
4618 |
4612 |
4619 /* |
4613 /* |
4620 image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8; |
4614 image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8; |
4621 */ |
4615 */ |
4622 image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8; |
4616 image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8; |
4623 |
4617 |
4624 switch (image.bits_per_pixel) { |
4618 switch (image.bits_per_pixel) { |
4625 case 1: |
4619 case 1: |
4626 case 2: |
4620 case 2: |
4627 case 4: |
4621 case 4: |
4628 case 8: |
4622 case 8: |
4629 case 16: |
4623 case 16: |
4630 case 24: |
4624 case 24: |
4631 case 32: |
4625 case 32: |
4632 break; |
4626 break; |
4633 |
4627 |
4634 default: |
4628 default: |
4635 #ifdef ARGDEBUG |
4629 #ifdef ARGDEBUG |
4636 console_printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
4630 console_printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
4637 #endif |
4631 #endif |
4638 goto fail; |
4632 goto fail; |
4639 } |
4633 } |
4640 |
4634 |
4641 image.red_mask = 0xFFFF; |
4635 image.red_mask = 0xFFFF; |
4642 image.green_mask = 0xFFFF; |
4636 image.green_mask = 0xFFFF; |
4643 image.blue_mask = 0xFFFF; |
4637 image.blue_mask = 0xFFFF; |
4644 |
4638 |
4645 /* ENTER_XLIB(); */ |
4639 /* ENTER_XLIB(); */ |
4646 XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), |
4640 XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), |
4647 __intVal(dstx), __intVal(dsty), |
4641 __intVal(dstx), __intVal(dsty), |
4648 __intVal(w), __intVal(h)); |
4642 __intVal(w), __intVal(h)); |
4649 /* LEAVE_XLIB(); */ |
4643 /* LEAVE_XLIB(); */ |
4650 |
4644 |
4651 RETURN ( true ); |
4645 RETURN ( true ); |
4652 } |
4646 } |
4653 #ifdef ARGDEBUG |
4647 #ifdef ARGDEBUG |
4654 if (!! __isExternalAddress(aGCId)) console_printf("GC\n"); |
4648 if (!! __isExternalAddress(aGCId)) console_printf("GC\n"); |
4655 if (!! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n"); |
4649 if (!! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n"); |
4656 if (!! __isSmallInteger(srcx)) console_printf("srcx\n"); |
4650 if (!! __isSmallInteger(srcx)) console_printf("srcx\n"); |
4703 self mouseWheelMotion:state x:x y:y amount:(logicalButton == #wheelFwd ifTrue:[10] ifFalse:[-10]) deltaTime:10 view:view. |
4697 self mouseWheelMotion:state x:x y:y amount:(logicalButton == #wheelFwd ifTrue:[10] ifFalse:[-10]) deltaTime:10 view:view. |
4704 ^ self. |
4698 ^ self. |
4705 ]. |
4699 ]. |
4706 |
4700 |
4707 logicalButton isInteger ifTrue:[ |
4701 logicalButton isInteger ifTrue:[ |
4708 buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1). |
4702 buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1). |
4709 ]. |
4703 ]. |
4710 |
4704 |
4711 (multiClickTimeDelta notNil and:[lastButtonPressTime notNil]) ifTrue:[ |
4705 (multiClickTimeDelta notNil and:[lastButtonPressTime notNil]) ifTrue:[ |
4712 time < (lastButtonPressTime + multiClickTimeDelta) ifTrue:[ |
4706 time < (lastButtonPressTime + multiClickTimeDelta) ifTrue:[ |
4713 lastButtonPressTime := time. |
4707 lastButtonPressTime := time. |
4714 self buttonMultiPress:logicalButton x:x y:y view:view. |
4708 self buttonMultiPress:logicalButton x:x y:y view:view. |
4715 ^ self. |
4709 ^ self. |
4716 ]. |
4710 ]. |
4717 ]. |
4711 ]. |
4718 lastButtonPressTime := time. |
4712 lastButtonPressTime := time. |
4719 |
4713 |
4720 view isNil ifTrue:[ |
4714 view isNil ifTrue:[ |
4721 "/ event arrived, after I destroyed it myself |
4715 "/ event arrived, after I destroyed it myself |
4722 ^ self |
4716 ^ self |
4723 ]. |
4717 ]. |
4724 logicalButton == 1 ifTrue:[ |
4718 logicalButton == 1 ifTrue:[ |
4725 activateOnClick == true ifTrue:[ |
4719 activateOnClick == true ifTrue:[ |
4726 "/ dont raise above an active popup view. |
4720 "/ dont raise above an active popup view. |
4727 (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[ |
4721 (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[ |
4728 view topView raise. |
4722 view topView raise. |
4729 ] |
4723 ] |
4730 ]. |
4724 ]. |
4731 ]. |
4725 ]. |
4732 super buttonPress:logicalButton x:x y:y view:view |
4726 super buttonPress:logicalButton x:x y:y view:view |
4733 ! |
4727 ! |
4734 |
4728 |
4735 buttonRelease:view button:button state:state x:x y:y rootX:rX rootY:rY time:time |
4729 buttonRelease:view button:button state:state x:x y:y rootX:rX rootY:rY time:time |
4753 (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[ |
4747 (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[ |
4754 ^ self |
4748 ^ self |
4755 ]. |
4749 ]. |
4756 |
4750 |
4757 logicalButton isInteger ifTrue:[ |
4751 logicalButton isInteger ifTrue:[ |
4758 buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1). |
4752 buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1). |
4759 ]. |
4753 ]. |
4760 self buttonRelease:logicalButton x:x y:y view:view |
4754 self buttonRelease:logicalButton x:x y:y view:view |
4761 ! |
4755 ! |
4762 |
4756 |
4763 clientMessage:targetView type:typeAtom format:format data:data |
4757 clientMessage:targetView type:typeAtom format:format data:data |
4764 |sensor| |
4758 |sensor| |
4765 |
4759 |
4766 targetView isNil ifTrue:[ |
4760 targetView isNil ifTrue:[ |
4767 "targetView is gone? Anyway, cannot do anything with this event..." |
4761 "targetView is gone? Anyway, cannot do anything with this event..." |
4768 ^ self. |
4762 ^ self. |
4769 ]. |
4763 ]. |
4770 |
4764 |
4771 "DND drag&drop protocol" |
4765 "DND drag&drop protocol" |
4772 (format == 32 and:[typeAtom == (self atomIDOf:#DndProtocol)]) ifTrue:[ |
4766 (format == 32 and:[typeAtom == (self atomIDOf:#DndProtocol)]) ifTrue:[ |
4773 self dndMessage:nil data:data view:targetView. |
4767 self dndMessage:nil data:data view:targetView. |
4774 ^ self. |
4768 ^ self. |
4775 ]. |
4769 ]. |
4776 |
4770 |
4777 sensor := targetView sensor. |
4771 sensor := targetView sensor. |
4778 "not posted, if there is no sensor ..." |
4772 "not posted, if there is no sensor ..." |
4779 sensor notNil ifTrue:[ |
4773 sensor notNil ifTrue:[ |
4780 sensor clientMessage:typeAtom format:format eventData:data view:targetView |
4774 sensor clientMessage:typeAtom format:format eventData:data view:targetView |
4781 ]. |
4775 ]. |
4782 |
4776 |
4783 "Created: 4.4.1997 / 17:49:26 / cg" |
4777 "Created: 4.4.1997 / 17:49:26 / cg" |
4784 ! |
4778 ! |
4785 |
4779 |
4786 configure:view x:x y:y width:w height:h above:above |
4780 configure:view x:x y:y width:w height:h above:above |
4787 "forward a size-change event for some view" |
4781 "forward a size-change event for some view" |
4788 |
4782 |
4789 self configureX:x y:y width:w height:h view:view. |
4783 self configureX:x y:y width:w height:h view:view. |
4790 above notNil ifTrue:[ |
4784 above notNil ifTrue:[ |
4791 |aboveView| |
4785 |aboveView| |
4792 aboveView := self viewFromId:above. |
4786 aboveView := self viewFromId:above. |
4793 aboveView notNil ifTrue:[ |
4787 aboveView notNil ifTrue:[ |
4794 "view is now on the top of the window stack" |
4788 "view is now on the top of the window stack" |
4795 self coveredBy:view view:aboveView. |
4789 self coveredBy:view view:aboveView. |
4796 ]. |
4790 ]. |
4797 ]. |
4791 ]. |
4798 ! |
4792 ! |
4799 |
4793 |
4800 createWindow:view x:x y:y width:w height:h |
4794 createWindow:view x:x y:y width:w height:h |
4801 |
4795 |
4802 view isNil ifTrue:[ |
4796 view isNil ifTrue:[ |
4803 "/ event arrived, after I destroyed it myself |
4797 "/ event arrived, after I destroyed it myself |
4804 ^ self |
4798 ^ self |
4805 ]. |
4799 ]. |
4806 view sensor createWindow:view x:x y:y width:w height:h |
4800 view sensor createWindow:view x:x y:y width:w height:h |
4807 |
4801 |
4808 "Created: / 30-05-2011 / 16:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4802 "Created: / 30-05-2011 / 16:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4809 "Modified: / 30-05-2011 / 19:00:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4803 "Modified: / 30-05-2011 / 19:00:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4818 |
4812 |
4819 "/ see def's in DragAndDropTypes.h |
4813 "/ see def's in DragAndDropTypes.h |
4820 dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd. |
4814 dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd. |
4821 |
4815 |
4822 property := self |
4816 property := self |
4823 getProperty:(self atomIDOf:#DndSelection) |
4817 getProperty:(self atomIDOf:#DndSelection) |
4824 from:rootId |
4818 from:rootId |
4825 delete:false. |
4819 delete:false. |
4826 |
4820 |
4827 propertyType := property key. |
4821 propertyType := property key. |
4828 dropValue := property value. |
4822 dropValue := property value. |
4829 |
4823 |
4830 "/ preconvert into a collection |
4824 "/ preconvert into a collection |
4834 "/ redefined dropMessage methods in applications. |
4828 "/ redefined dropMessage methods in applications. |
4835 "/ Conversion is done for some well known types |
4829 "/ Conversion is done for some well known types |
4836 "/ in the default dropMessage handling of SimpleView. |
4830 "/ in the default dropMessage handling of SimpleView. |
4837 |
4831 |
4838 dropType == #DndFiles ifTrue:[ |
4832 dropType == #DndFiles ifTrue:[ |
4839 "/ actually, a list of fileNames |
4833 "/ actually, a list of fileNames |
4840 propertyType ~~ stringAtom ifTrue:[ |
4834 propertyType ~~ stringAtom ifTrue:[ |
4841 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4835 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4842 ^ self |
4836 ^ self |
4843 ]. |
4837 ]. |
4844 |
4838 |
4845 names := OrderedCollection new. |
4839 names := OrderedCollection new. |
4846 i1 := 1. |
4840 i1 := 1. |
4847 [i1 ~~ 0] whileTrue:[ |
4841 [i1 ~~ 0] whileTrue:[ |
4848 i2 := dropValue indexOf:(Character value:0) startingAt:i1. |
4842 i2 := dropValue indexOf:(Character value:0) startingAt:i1. |
4849 i2 ~~ 0 ifTrue:[ |
4843 i2 ~~ 0 ifTrue:[ |
4850 names add:(dropValue copyFrom:i1 to:(i2-1)). |
4844 names add:(dropValue copyFrom:i1 to:(i2-1)). |
4851 i1 := i2 + 1. |
4845 i1 := i2 + 1. |
4852 ] ifFalse:[ |
4846 ] ifFalse:[ |
4853 i1 := i2 |
4847 i1 := i2 |
4854 ]. |
4848 ]. |
4855 ]. |
4849 ]. |
4856 dropValue := names. |
4850 dropValue := names. |
4857 dropValue := dropValue collect:[:nm | nm asFilename]. |
4851 dropValue := dropValue collect:[:nm | nm asFilename]. |
4858 dropType := #files. |
4852 dropType := #files. |
4859 ] ifFalse:[ (dropType == #DndFile) ifTrue:[ |
4853 ] ifFalse:[ (dropType == #DndFile) ifTrue:[ |
4860 propertyType ~~ stringAtom ifTrue:[ |
4854 propertyType ~~ stringAtom ifTrue:[ |
4861 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4855 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4862 ^ self |
4856 ^ self |
4863 ]. |
4857 ]. |
4864 dropValue := dropValue asFilename. |
4858 dropValue := dropValue asFilename. |
4865 dropType := #file. |
4859 dropType := #file. |
4866 ] ifFalse:[ (dropType == #DndDir) ifTrue:[ |
4860 ] ifFalse:[ (dropType == #DndDir) ifTrue:[ |
4867 propertyType ~~ stringAtom ifTrue:[ |
4861 propertyType ~~ stringAtom ifTrue:[ |
4868 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4862 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4869 ^ self |
4863 ^ self |
4870 ]. |
4864 ]. |
4871 dropValue := dropValue asFilename. |
4865 dropValue := dropValue asFilename. |
4872 dropType := #directory. |
4866 dropType := #directory. |
4873 ] ifFalse:[ (dropType == #DndText) ifTrue:[ |
4867 ] ifFalse:[ (dropType == #DndText) ifTrue:[ |
4874 propertyType ~~ stringAtom ifTrue:[ |
4868 propertyType ~~ stringAtom ifTrue:[ |
4875 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4869 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4876 ^ self |
4870 ^ self |
4877 ]. |
4871 ]. |
4878 dropType := #text. |
4872 dropType := #text. |
4879 ] ifFalse:[ (dropType == #DndExe) ifTrue:[ |
4873 ] ifFalse:[ (dropType == #DndExe) ifTrue:[ |
4880 propertyType ~~ stringAtom ifTrue:[ |
4874 propertyType ~~ stringAtom ifTrue:[ |
4881 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4875 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4882 ^ self |
4876 ^ self |
4883 ]. |
4877 ]. |
4884 dropType := #executable. |
4878 dropType := #executable. |
4885 ] ifFalse:[ (dropType == #DndLink) ifTrue:[ |
4879 ] ifFalse:[ (dropType == #DndLink) ifTrue:[ |
4886 propertyType ~~ stringAtom ifTrue:[ |
4880 propertyType ~~ stringAtom ifTrue:[ |
4887 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4881 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
4888 ^ self |
4882 ^ self |
4889 ]. |
4883 ]. |
4890 dropType := #link. |
4884 dropType := #link. |
4891 ] ifFalse:[ (dropType == #DndRawData) ifTrue:[ |
4885 ] ifFalse:[ (dropType == #DndRawData) ifTrue:[ |
4892 dropType := #rawData. |
4886 dropType := #rawData. |
4893 ] ifFalse:[ |
4887 ] ifFalse:[ |
4894 'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR. |
4888 'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR. |
4895 'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR. |
4889 'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR. |
4896 dropType := #unknown. |
4890 dropType := #unknown. |
4897 ]]]]]]]. |
4891 ]]]]]]]. |
4898 |
4892 |
4899 sensor := targetView sensor. |
4893 sensor := targetView sensor. |
4900 "not posted, if there is no sensor ..." |
4894 "not posted, if there is no sensor ..." |
4901 sensor notNil ifTrue:[ |
4895 sensor notNil ifTrue:[ |
4902 sensor dropMessage:dropType data:dropValue view:targetView position:nil handle:nil |
4896 sensor dropMessage:dropType data:dropValue view:targetView position:nil handle:nil |
4903 ]. |
4897 ]. |
4904 |
4898 |
4905 "Created: 4.4.1997 / 17:59:37 / cg" |
4899 "Created: 4.4.1997 / 17:59:37 / cg" |
4906 ! |
4900 ! |
4907 |
4901 |
4917 |
4911 |
4918 focusIn:view mode:mode detail:detail |
4912 focusIn:view mode:mode detail:detail |
4919 "a view got the keyboard focus" |
4913 "a view got the keyboard focus" |
4920 |
4914 |
4921 mode ~~ 1 "NotifyGrab" ifTrue:[ |
4915 mode ~~ 1 "NotifyGrab" ifTrue:[ |
4922 "mode NotifyGrab is set for pseudo-focus-changes, when a view grabs the keyboard" |
4916 "mode NotifyGrab is set for pseudo-focus-changes, when a view grabs the keyboard" |
4923 self focusInView:view |
4917 self focusInView:view |
4924 ]. |
4918 ]. |
4925 ! |
4919 ! |
4926 |
4920 |
4927 focusOut:view mode:mode detail:detail |
4921 focusOut:view mode:mode detail:detail |
4928 "a view lost the keyboard focus" |
4922 "a view lost the keyboard focus" |
4929 |
4923 |
4930 mode ~~ 1 "NotifyGrab" ifTrue:[ |
4924 mode ~~ 1 "NotifyGrab" ifTrue:[ |
4931 "mode NotifyGrab is set for pseudo-focus-changes, when a view grabs the keyboard" |
4925 "mode NotifyGrab is set for pseudo-focus-changes, when a view grabs the keyboard" |
4932 self focusOutView:view |
4926 self focusOutView:view |
4933 ]. |
4927 ]. |
4934 ! |
4928 ! |
4935 |
4929 |
4936 graphicsExpose:view x:x y:y width:w height:h count:count |
4930 graphicsExpose:view x:x y:y width:w height:h count:count |
4937 "forward a graphics-expose event for some view" |
4931 "forward a graphics-expose event for some view" |
4952 altDown := state bitTest:altModifierMask. |
4946 altDown := state bitTest:altModifierMask. |
4953 metaDown := state bitTest:metaModifierMask. |
4947 metaDown := state bitTest:metaModifierMask. |
4954 shiftDown := state bitTest:(self shiftModifierMask). |
4948 shiftDown := state bitTest:(self shiftModifierMask). |
4955 ctrlDown := state bitTest:(self ctrlModifierMask). |
4949 ctrlDown := state bitTest:(self ctrlModifierMask). |
4956 key isNil ifTrue:[ |
4950 key isNil ifTrue:[ |
4957 "/ happens sometimes on some systems |
4951 "/ happens sometimes on some systems |
4958 "/ (alt-graph on sun has no keysym) |
4952 "/ (alt-graph on sun has no keysym) |
4959 ^ self |
4953 ^ self |
4960 ]. |
4954 ]. |
4961 eventRootX := rX. |
4955 eventRootX := rX. |
4962 eventRootY := rY. |
4956 eventRootY := rY. |
4963 |
4957 |
4964 "very low-level mapping of X11 event symbols to common ST/X event symbols" |
4958 "very low-level mapping of X11 event symbols to common ST/X event symbols" |
4977 metaDown := state bitTest:metaModifierMask. |
4971 metaDown := state bitTest:metaModifierMask. |
4978 shiftDown := state bitTest:(self shiftModifierMask). |
4972 shiftDown := state bitTest:(self shiftModifierMask). |
4979 ctrlDown := state bitTest:(self ctrlModifierMask). |
4973 ctrlDown := state bitTest:(self ctrlModifierMask). |
4980 |
4974 |
4981 key isNil ifTrue:[ |
4975 key isNil ifTrue:[ |
4982 "/ happens sometimes on some systems |
4976 "/ happens sometimes on some systems |
4983 "/ (alt-graph on sun has no keysym) |
4977 "/ (alt-graph on sun has no keysym) |
4984 ^ self |
4978 ^ self |
4985 ]. |
4979 ]. |
4986 eventRootX := rX. |
4980 eventRootX := rX. |
4987 eventRootY := rY. |
4981 eventRootY := rY. |
4988 |
4982 |
4989 "very low-level mapping of X11 event symbols to common ST/X event symbols" |
4983 "very low-level mapping of X11 event symbols to common ST/X event symbols" |
4995 mappingNotify:view request:what event:eB |
4989 mappingNotify:view request:what event:eB |
4996 "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap. |
4990 "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap. |
4997 Tell xlib about the fact." |
4991 Tell xlib about the fact." |
4998 |
4992 |
4999 (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ |
4993 (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ |
5000 self refreshKeyboardMapping:eB. |
4994 self refreshKeyboardMapping:eB. |
5001 "Maybe some of our modifiers have been changed" |
4995 "Maybe some of our modifiers have been changed" |
5002 self initializeModifierMappings. |
4996 self initializeModifierMappings. |
5003 ]. |
4997 ]. |
5004 |
4998 |
5005 ! |
4999 ! |
5006 |
5000 |
5007 pointerEnter:view x:x y:y rootX:rX rootY:rY state:state mode:mode detail:detail time:time |
5001 pointerEnter:view x:x y:y rootX:rX rootY:rY state:state mode:mode detail:detail time:time |
5038 |
5032 |
5039 |selectionFetcher| |
5033 |selectionFetcher| |
5040 |
5034 |
5041 lastEventTime := time. |
5035 lastEventTime := time. |
5042 aView isNil ifTrue:[ |
5036 aView isNil ifTrue:[ |
5043 "event arrived, after aView has been destroyed" |
5037 "event arrived, after aView has been destroyed" |
5044 ^ self |
5038 ^ self |
5045 ]. |
5039 ]. |
5046 |
5040 |
5047 "/ 'propertyChange ' infoPrint. (self atomName:propertyId) print. ': ' print. aSymbol printCR. |
5041 "/ 'propertyChange ' infoPrint. (self atomName:propertyId) print. ': ' print. aSymbol printCR. |
5048 "/ aView propertyChange:atom state:aSymbol. |
5042 "/ aView propertyChange:atom state:aSymbol. |
5049 |
5043 |
5051 be interested (for now, only XEmbedSiteView is)" |
5045 be interested (for now, only XEmbedSiteView is)" |
5052 |
5046 |
5053 aView sensor propertyChange:aView property:propertyId state:aSymbol time:time. |
5047 aView sensor propertyChange:aView property:propertyId state:aSymbol time:time. |
5054 |
5048 |
5055 aSymbol ~~ #newValue ifTrue:[ |
5049 aSymbol ~~ #newValue ifTrue:[ |
5056 "I am not interested in delete notifications" |
5050 "I am not interested in delete notifications" |
5057 ^ self. |
5051 ^ self. |
5058 ]. |
5052 ]. |
5059 selectionFetcher := self findSelectionFetcher:aView id. |
5053 selectionFetcher := self findSelectionFetcher:aView id. |
5060 selectionFetcher notNil ifTrue:[ |
5054 selectionFetcher notNil ifTrue:[ |
5061 selectionFetcher message:thisContext message. |
5055 selectionFetcher message:thisContext message. |
5062 ]. |
5056 ]. |
5063 |
5057 |
5064 "Modified: / 01-06-2011 / 13:40:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5058 "Modified: / 01-06-2011 / 13:40:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5065 ! |
5059 ! |
5066 |
5060 |
5104 "/ Transcript endEntry. |
5098 "/ Transcript endEntry. |
5105 |
5099 |
5106 lastEventTime := time. |
5100 lastEventTime := time. |
5107 |
5101 |
5108 aView isNil ifTrue:[ |
5102 aView isNil ifTrue:[ |
5109 "event arrived, after aView has been destroyed" |
5103 "event arrived, after aView has been destroyed" |
5110 ^ self |
5104 ^ self |
5111 ]. |
5105 ]. |
5112 selectionFetcher := self findSelectionFetcher:aView id. |
5106 selectionFetcher := self findSelectionFetcher:aView id. |
5113 selectionFetcher notNil ifTrue:[ |
5107 selectionFetcher notNil ifTrue:[ |
5114 selectionFetcher message:thisContext message. |
5108 selectionFetcher message:thisContext message. |
5115 ]. |
5109 ]. |
5116 ! |
5110 ! |
5117 |
5111 |
5118 selectionRequest:aView requestor:requestorID selection:selectionID target:targetID property:propertyID time:time |
5112 selectionRequest:aView requestor:requestorID selection:selectionID target:targetID property:propertyID time:time |
5119 "sent by some other X-client to ask for the selection. |
5113 "sent by some other X-client to ask for the selection. |
5120 This is a very X-specific mechanism." |
5114 This is a very X-specific mechanism." |
5121 |
5115 |
5122 |selection property| |
5116 |selection property bufferGetSelector responseTargetID selectionTime| |
5123 |
5117 |
5124 'Selection: ' print. (self atomName:selectionID) printCR. ' TargetId: ' print. (self atomName:targetID) printCR. |
5118 "/'Selection: ' print. (self atomName:selectionID) printCR. ' TargetId: ' print. (self atomName:targetID) printCR. |
5125 ' Property: ' print. (self atomName:propertyID) printCR. ' Requestor: ' print. requestorID printCR. |
5119 "/' Property: ' print. (self atomName:propertyID) printCR. ' Requestor: ' print. requestorID printCR. |
5126 |
5120 |
5127 lastEventTime := time. |
5121 lastEventTime := time. |
5122 |
|
5128 "JV@2012-03-27: Support both PRIMARY and CLIPBOARD selections" |
5123 "JV@2012-03-27: Support both PRIMARY and CLIPBOARD selections" |
5129 selectionID == primaryAtom ifTrue:[ |
5124 selectionID == primaryAtom ifTrue:[ |
5130 selection := self primaryBufferAs:targetID. |
5125 bufferGetSelector := #getPrimaryBuffer. |
5126 selectionTime := primarySelectionTime. |
|
5131 ] ifFalse:[ |
5127 ] ifFalse:[ |
5132 selection := self copyBufferAs:targetID. |
5128 bufferGetSelector := #getCopyBuffer. |
5133 ]. |
5129 selectionTime := clipboardSelectionTime. |
5130 ]. |
|
5131 |
|
5132 (targetID == (self atomIDOf:#TIMESTAMP)) ifTrue:[ |
|
5133 "the other view wants to know when we acquired ownership of the selection" |
|
5134 responseTargetID := self atomIDOf:#INTEGER. |
|
5135 selection := selectionTime. |
|
5136 ] ifFalse:[(targetID == (self atomIDOf:#TARGETS)) ifTrue:[ |
|
5137 "the other view wants to know which targets we support" |
|
5138 responseTargetID := self atomIDOf:#ATOM. |
|
5139 selection := self supportedTargetAtoms. |
|
5140 ] ifFalse:[ |
|
5141 selection := self selectionBuffer:bufferGetSelector as:targetID. |
|
5142 responseTargetID := selection key. |
|
5143 selection := selection value. |
|
5144 ]]. |
|
5134 |
5145 |
5135 "/'Send selection: ' print. selection printCR. |
5146 "/'Send selection: ' print. selection printCR. |
5136 |
5147 |
5137 property := propertyID. |
5148 property := propertyID. |
5138 |
5149 |
5143 property := nil. |
5154 property := nil. |
5144 ] ifFalse:[ |
5155 ] ifFalse:[ |
5145 property == 0 ifTrue:[ |
5156 property == 0 ifTrue:[ |
5146 "Support old (obsolete) clients requesting a None property. |
5157 "Support old (obsolete) clients requesting a None property. |
5147 Set the propertyID to the targetID" |
5158 Set the propertyID to the targetID" |
5148 property := targetID. |
5159 property := responseTargetID. |
5149 ]. |
5160 ]. |
5150 self setProperty:property |
5161 self setProperty:property |
5151 type:targetID |
5162 type:responseTargetID |
5152 value:selection |
5163 value:selection |
5153 for:requestorID. |
5164 for:requestorID. |
5154 ]. |
5165 ]. |
5155 |
5166 |
5156 self sendNotifySelection:selectionID |
5167 self sendNotifySelection:selectionID |
5157 property:property |
5168 property:property |
5158 target:targetID |
5169 target:responseTargetID |
5159 time:time |
5170 time:time |
5160 to:requestorID. |
5171 to:requestorID. |
5161 |
5172 |
5162 "Modified: / 27-03-2012 / 15:22:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5173 "Modified: / 27-03-2012 / 15:22:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5163 ! |
5174 ! |
5164 |
5175 |
5165 visibilityNotify:aView state:how |
5176 visibilityNotify:aView state:how |
5166 |
5177 |
5167 aView notNil ifTrue:[ |
5178 aView notNil ifTrue:[ |
5168 aView visibilityChange:how |
5179 aView visibilityChange:how |
5169 ] |
5180 ] |
5170 ! ! |
5181 ! ! |
5171 |
5182 |
5172 !XWorkstation methodsFor:'event forwarding-ignored events'! |
5183 !XWorkstation methodsFor:'event forwarding-ignored events'! |
5173 |
5184 |
5185 colorMapNotify:aView state:aBoolean |
5196 colorMapNotify:aView state:aBoolean |
5186 "sent, when another colormap is installed. |
5197 "sent, when another colormap is installed. |
5187 This is a very X-specific mechanism." |
5198 This is a very X-specific mechanism." |
5188 |
5199 |
5189 aView isNil ifTrue:[ |
5200 aView isNil ifTrue:[ |
5190 "/ event arrived, after I destroyed it myself |
5201 "/ event arrived, after I destroyed it myself |
5191 ^ self |
5202 ^ self |
5192 ]. |
5203 ]. |
5193 "/ not yet implemented |
5204 "/ not yet implemented |
5194 "/ aView colorMapChange |
5205 "/ aView colorMapChange |
5195 ! |
5206 ! |
5196 |
5207 |
5234 defaultEventMask |
5245 defaultEventMask |
5235 "return a mask to enable some events by default." |
5246 "return a mask to enable some events by default." |
5236 |
5247 |
5237 %{ /* NOCONTEXT */ |
5248 %{ /* NOCONTEXT */ |
5238 RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask | |
5249 RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask | |
5239 KeyPressMask | KeyReleaseMask | |
5250 KeyPressMask | KeyReleaseMask | |
5240 PointerMotionMask | |
5251 PointerMotionMask | |
5241 EnterWindowMask | LeaveWindowMask | |
5252 EnterWindowMask | LeaveWindowMask | |
5242 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask | |
5253 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask | |
5243 PropertyChangeMask )); |
5254 PropertyChangeMask )); |
5244 %} |
5255 %} |
5245 ! |
5256 ! |
5246 |
5257 |
5247 dispatchEvent:evArray |
5258 dispatchEvent:evArray |
5248 |viewId view evType arguments| |
5259 |viewId view evType arguments| |
5249 |
5260 |
5250 viewId := evArray at:1. |
5261 viewId := evArray at:1. |
5251 viewId notNil ifTrue:[ |
5262 viewId notNil ifTrue:[ |
5252 viewId = lastId ifTrue:[ |
5263 viewId = lastId ifTrue:[ |
5253 view := lastView |
5264 view := lastView |
5254 ] ifFalse:[ |
5265 ] ifFalse:[ |
5255 view := self viewFromId:viewId |
5266 view := self viewFromId:viewId |
5256 ]. |
5267 ]. |
5257 ]. |
5268 ]. |
5258 |
5269 |
5259 evType := evArray at:3. |
5270 evType := evArray at:3. |
5260 |
5271 |
5261 (self respondsTo:evType) ifTrue:[ |
5272 (self respondsTo:evType) ifTrue:[ |
5262 arguments := evArray copyFrom:3 to:(3 + evType numArgs - 1). |
5273 arguments := evArray copyFrom:3 to:(3 + evType numArgs - 1). |
5263 arguments at:1 put:view. |
5274 arguments at:1 put:view. |
5264 |
5275 |
5265 self perform:evType withArguments:arguments. |
5276 self perform:evType withArguments:arguments. |
5266 ^ true. |
5277 ^ true. |
5267 ]. |
5278 ]. |
5268 '********** unhandled event:' errorPrintCR. |
5279 '********** unhandled event:' errorPrintCR. |
5269 evType errorPrintCR. (evArray at:2) errorPrintCR. |
5280 evType errorPrintCR. (evArray at:2) errorPrintCR. |
5270 '********** see dispatchEvent' errorPrintCR. |
5281 '********** see dispatchEvent' errorPrintCR. |
5271 ^ false |
5282 ^ false |
5277 If the argument aViewIdOrNil is nil, events for any view are processed, |
5288 If the argument aViewIdOrNil is nil, events for any view are processed, |
5278 otherwise only events for the view with given id are processed. |
5289 otherwise only events for the view with given id are processed. |
5279 If the argument aMask is nonNil, only events for this eventMask are |
5290 If the argument aMask is nonNil, only events for this eventMask are |
5280 handled. |
5291 handled. |
5281 WARNING: this may block to wait for an event - you better check for a |
5292 WARNING: this may block to wait for an event - you better check for a |
5282 pending event before calling this." |
5293 pending event before calling this." |
5283 |
5294 |
5284 |eventArray| |
5295 |eventArray| |
5285 |
5296 |
5286 eventArray := Array new:13. |
5297 eventArray := Array new:13. |
5287 |
5298 |
5288 (self getEventFor:aViewIdOrNil withMask:eventMask into:eventArray) ifTrue:[ |
5299 (self getEventFor:aViewIdOrNil withMask:eventMask into:eventArray) ifTrue:[ |
5289 AbortOperationRequest handle:[:ex | |
5300 AbortOperationRequest handle:[:ex | |
5290 ex return |
5301 ex return |
5291 ] do:[ |
5302 ] do:[ |
5292 self dispatchEvent:eventArray. |
5303 self dispatchEvent:eventArray. |
5293 ] |
5304 ] |
5294 ]. |
5305 ]. |
5295 |
5306 |
5296 "Modified: 19.8.1997 / 17:10:42 / cg" |
5307 "Modified: 19.8.1997 / 17:10:42 / cg" |
5297 ! |
5308 ! |
5298 |
5309 |
5299 dispatchExposeEventFor:aViewIdOrNil |
5310 dispatchExposeEventFor:aViewIdOrNil |
5300 "get next expose event and send appropriate message to the sensor or view. |
5311 "get next expose event and send appropriate message to the sensor or view. |
5301 If the argument aViewIdOrNil is nil, events for any view are processed, |
5312 If the argument aViewIdOrNil is nil, events for any view are processed, |
5302 otherwise only events for the view with given id are processed. |
5313 otherwise only events for the view with given id are processed. |
5303 WARNING: this may block to wait for an event - you better check for a |
5314 WARNING: this may block to wait for an event - you better check for a |
5304 pending event before calling this." |
5315 pending event before calling this." |
5305 |
5316 |
5306 self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose) |
5317 self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose) |
5307 |
5318 |
5308 "Modified: 19.8.1997 / 17:10:26 / cg" |
5319 "Modified: 19.8.1997 / 17:10:26 / cg" |
5309 ! |
5320 ! |
5310 |
5321 |
5311 dispatchLoop |
5322 dispatchLoop |
5312 preWaitAction := [self flush]. |
5323 preWaitAction := [self flush]. |
5313 Processor addPreWaitAction:preWaitAction. |
5324 Processor addPreWaitAction:preWaitAction. |
5314 [ |
5325 [ |
5315 super dispatchLoop |
5326 super dispatchLoop |
5316 ] ensure:[ |
5327 ] ensure:[ |
5317 Processor removePreWaitAction:preWaitAction. |
5328 Processor removePreWaitAction:preWaitAction. |
5318 preWaitAction := nil. |
5329 preWaitAction := nil. |
5319 ]. |
5330 ]. |
5320 ! |
5331 ! |
5321 |
5332 |
5322 dispatchPendingEvents |
5333 dispatchPendingEvents |
5323 "central event handling method for modal operation. |
5334 "central event handling method for modal operation. |
5331 "interested in exposes only ?" |
5342 "interested in exposes only ?" |
5332 |
5343 |
5333 |eventArray| |
5344 |eventArray| |
5334 |
5345 |
5335 dispatchingExpose notNil ifTrue:[ |
5346 dispatchingExpose notNil ifTrue:[ |
5336 [self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[ |
5347 [self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[ |
5337 self dispatchExposeEventFor:dispatchingExpose |
5348 self dispatchExposeEventFor:dispatchingExpose |
5338 ]. |
5349 ]. |
5339 ^ self |
5350 ^ self |
5340 ]. |
5351 ]. |
5341 |
5352 |
5342 [self eventPendingWithSync:false] whileTrue:[ |
5353 [self eventPendingWithSync:false] whileTrue:[ |
5343 eventArray isNil ifTrue:[ |
5354 eventArray isNil ifTrue:[ |
5344 eventArray := Array new:13. |
5355 eventArray := Array new:13. |
5345 ]. |
5356 ]. |
5346 (self getEventFor:nil withMask:nil into:eventArray) ifTrue:[ |
5357 (self getEventFor:nil withMask:nil into:eventArray) ifTrue:[ |
5347 AbortOperationRequest handle:[:ex | |
5358 AbortOperationRequest handle:[:ex | |
5348 ex return |
5359 ex return |
5349 ] do:[ |
5360 ] do:[ |
5350 self dispatchEvent:eventArray. |
5361 self dispatchEvent:eventArray. |
5351 "/ multi-screen config: give others a chance |
5362 "/ multi-screen config: give others a chance |
5352 "/ (needed because we run at high (non-timesliced) prio) |
5363 "/ (needed because we run at high (non-timesliced) prio) |
5353 Processor yield. |
5364 Processor yield. |
5354 ] |
5365 ] |
5355 ]. |
5366 ]. |
5356 ] |
5367 ] |
5357 |
5368 |
5358 "Modified: 19.8.1997 / 17:11:18 / cg" |
5369 "Modified: 19.8.1997 / 17:11:18 / cg" |
5359 ! |
5370 ! |
5360 |
5371 |
5370 XEvent ev; |
5381 XEvent ev; |
5371 Window win; |
5382 Window win; |
5372 |
5383 |
5373 if (ISCONNECTED |
5384 if (ISCONNECTED |
5374 && __isSmallInteger(aMask)) { |
5385 && __isSmallInteger(aMask)) { |
5375 Display *dpy = myDpy; |
5386 Display *dpy = myDpy; |
5376 |
5387 |
5377 ENTER_XLIB(); |
5388 ENTER_XLIB(); |
5378 if (__isExternalAddress(aWindowIdOrNil)) { |
5389 if (__isExternalAddress(aWindowIdOrNil)) { |
5379 win = __WindowVal(aWindowIdOrNil); |
5390 win = __WindowVal(aWindowIdOrNil); |
5380 while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;; |
5391 while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;; |
5381 } else { |
5392 } else { |
5382 while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;; |
5393 while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;; |
5383 } |
5394 } |
5384 LEAVE_XLIB(); |
5395 LEAVE_XLIB(); |
5385 RETURN ( self ); |
5396 RETURN ( self ); |
5386 } |
5397 } |
5387 %}. |
5398 %}. |
5388 self primitiveFailedOrClosedConnection |
5399 self primitiveFailedOrClosedConnection |
5389 ! |
5400 ! |
5390 |
5401 |
5426 "/ (especially Win32 & Xlib) |
5437 "/ (especially Win32 & Xlib) |
5427 |
5438 |
5428 ConservativeSync == true ifTrue:[self sync]. |
5439 ConservativeSync == true ifTrue:[self sync]. |
5429 |
5440 |
5430 dispatchingExpose notNil ifTrue:[ |
5441 dispatchingExpose notNil ifTrue:[ |
5431 ^ self exposeEventPendingFor:dispatchingExpose withSync:false |
5442 ^ self exposeEventPendingFor:dispatchingExpose withSync:false |
5432 ]. |
5443 ]. |
5433 ^ self eventPendingWithSync:false |
5444 ^ self eventPendingWithSync:false |
5434 |
5445 |
5435 "Modified: / 28.4.1999 / 11:08:12 / cg" |
5446 "Modified: / 28.4.1999 / 11:08:12 / cg" |
5436 ! |
5447 ! |
5451 Window win; |
5462 Window win; |
5452 int thereIsOne; |
5463 int thereIsOne; |
5453 OBJ rslt = false; |
5464 OBJ rslt = false; |
5454 |
5465 |
5455 if (ISCONNECTED && __isSmallInteger(anEventMask)) { |
5466 if (ISCONNECTED && __isSmallInteger(anEventMask)) { |
5456 Display *dpy = myDpy; |
5467 Display *dpy = myDpy; |
5457 |
5468 |
5458 ENTER_XLIB(); |
5469 ENTER_XLIB(); |
5459 if (doSync == true) { |
5470 if (doSync == true) { |
5460 XSync(dpy, 0); /* make certain everything is flushed */ |
5471 XSync(dpy, 0); /* make certain everything is flushed */ |
5461 } |
5472 } |
5462 if (__isExternalAddress(aWindowIdOrNil)) { |
5473 if (__isExternalAddress(aWindowIdOrNil)) { |
5463 win = __WindowVal(aWindowIdOrNil); |
5474 win = __WindowVal(aWindowIdOrNil); |
5464 thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev); |
5475 thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev); |
5465 } else { |
5476 } else { |
5466 thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev); |
5477 thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev); |
5467 } |
5478 } |
5468 if (thereIsOne) { |
5479 if (thereIsOne) { |
5469 XPutBackEvent(dpy, &ev); |
5480 XPutBackEvent(dpy, &ev); |
5470 rslt = true; |
5481 rslt = true; |
5471 } |
5482 } |
5472 LEAVE_XLIB(); |
5483 LEAVE_XLIB(); |
5473 } |
5484 } |
5474 RETURN ( rslt ); |
5485 RETURN ( rslt ); |
5475 %} |
5486 %} |
5476 ! |
5487 ! |
5477 |
5488 |
5483 <context: #return> |
5494 <context: #return> |
5484 %{ /* UNLIMITEDSTACK */ |
5495 %{ /* UNLIMITEDSTACK */ |
5485 OBJ rslt = false; |
5496 OBJ rslt = false; |
5486 |
5497 |
5487 if (ISCONNECTED) { |
5498 if (ISCONNECTED) { |
5488 Display *dpy = myDpy; |
5499 Display *dpy = myDpy; |
5489 |
5500 |
5490 if (XEventsQueued(dpy, QueuedAlready)) { |
5501 if (XEventsQueued(dpy, QueuedAlready)) { |
5491 RETURN (true); |
5502 RETURN (true); |
5492 } |
5503 } |
5493 |
5504 |
5494 ENTER_XLIB(); |
5505 ENTER_XLIB(); |
5495 if (doSync == true) { |
5506 if (doSync == true) { |
5496 XSync(dpy, 0); /* make certain everything is flushed */ |
5507 XSync(dpy, 0); /* make certain everything is flushed */ |
5497 } |
5508 } |
5498 if (XPending(dpy)) { |
5509 if (XPending(dpy)) { |
5499 rslt = true; |
5510 rslt = true; |
5500 } |
5511 } |
5501 LEAVE_XLIB(); |
5512 LEAVE_XLIB(); |
5502 } |
5513 } |
5503 RETURN ( rslt ); |
5514 RETURN ( rslt ); |
5504 %} |
5515 %} |
5505 ! |
5516 ! |
5506 |
5517 |
5507 eventQueued |
5518 eventQueued |
5508 "return true, if any event is queued" |
5519 "return true, if any event is queued" |
5509 |
5520 |
5510 dispatchingExpose notNil ifTrue:[ |
5521 dispatchingExpose notNil ifTrue:[ |
5511 ^ self exposeEventPendingFor:dispatchingExpose withSync:false |
5522 ^ self exposeEventPendingFor:dispatchingExpose withSync:false |
5512 ]. |
5523 ]. |
5513 ^ self eventQueuedAlready |
5524 ^ self eventQueuedAlready |
5514 |
5525 |
5515 "Created: 12.12.1995 / 21:43:00 / stefan" |
5526 "Created: 12.12.1995 / 21:43:00 / stefan" |
5516 ! |
5527 ! |
5523 |
5534 |
5524 %{ /* UNLIMITEDSTACK */ |
5535 %{ /* UNLIMITEDSTACK */ |
5525 OBJ rslt = false; |
5536 OBJ rslt = false; |
5526 |
5537 |
5527 if (ISCONNECTED) { |
5538 if (ISCONNECTED) { |
5528 /* ENTER ... LEAVE not needed; XEventsQueued will not block */ |
5539 /* ENTER ... LEAVE not needed; XEventsQueued will not block */ |
5529 /* ENTER_XLIB(); */ |
5540 /* ENTER_XLIB(); */ |
5530 if (XEventsQueued(myDpy, QueuedAlready)) { |
5541 if (XEventsQueued(myDpy, QueuedAlready)) { |
5531 rslt = true; |
5542 rslt = true; |
5532 } |
5543 } |
5533 /* LEAVE_XLIB(); */ |
5544 /* LEAVE_XLIB(); */ |
5534 } |
5545 } |
5535 RETURN ( rslt ); |
5546 RETURN ( rslt ); |
5536 %} |
5547 %} |
5537 ! |
5548 ! |
5538 |
5549 |
5549 Window win; |
5560 Window win; |
5550 int thereIsOne; |
5561 int thereIsOne; |
5551 OBJ rslt = false; |
5562 OBJ rslt = false; |
5552 |
5563 |
5553 if (ISCONNECTED) { |
5564 if (ISCONNECTED) { |
5554 Display *dpy = myDpy; |
5565 Display *dpy = myDpy; |
5555 |
5566 |
5556 ENTER_XLIB(); |
5567 ENTER_XLIB(); |
5557 if (doSync == true) { |
5568 if (doSync == true) { |
5558 XSync(dpy, 0); /* make certain everything is flushed */ |
5569 XSync(dpy, 0); /* make certain everything is flushed */ |
5559 } |
5570 } |
5560 if (__isExternalAddress(aWindowIdOrNil)) { |
5571 if (__isExternalAddress(aWindowIdOrNil)) { |
5561 win = __WindowVal(aWindowIdOrNil); |
5572 win = __WindowVal(aWindowIdOrNil); |
5562 thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); |
5573 thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); |
5563 } else { |
5574 } else { |
5564 thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); |
5575 thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); |
5565 } |
5576 } |
5566 if (thereIsOne) { |
5577 if (thereIsOne) { |
5567 XPutBackEvent(dpy, &ev); |
5578 XPutBackEvent(dpy, &ev); |
5568 rslt = true; |
5579 rslt = true; |
5569 } |
5580 } |
5570 LEAVE_XLIB(); |
5581 LEAVE_XLIB(); |
5571 } |
5582 } |
5572 RETURN ( rslt ); |
5583 RETURN ( rslt ); |
5573 %} |
5584 %} |
5574 ! |
5585 ! |
5575 |
5586 |
5581 This method may block - so you better check for pending events |
5592 This method may block - so you better check for pending events |
5582 before calling for it. |
5593 before calling for it. |
5583 |
5594 |
5584 The event fields are placed them into anEventArray (must be at least size 13): |
5595 The event fields are placed them into anEventArray (must be at least size 13): |
5585 the fields are: |
5596 the fields are: |
5586 1: windowID |
5597 1: windowID |
5587 2: eventType-ID |
5598 2: eventType-ID |
5588 3: eventTypeSymbol |
5599 3: eventTypeSymbol |
5589 |
5600 |
5590 4.. args |
5601 4.. args |
5591 |
5602 |
5592 Sorry I had to split dispatch into this fetch method and a separate |
5603 Sorry I had to split dispatch into this fetch method and a separate |
5593 handler method to allow UNLIMITEDSTACK here. |
5604 handler method to allow UNLIMITEDSTACK here. |
5594 (some Xlibs do a big alloca there which cannot be done in |
5605 (some Xlibs do a big alloca there which cannot be done in |
5595 #dispatchEvent:, since it dispatches out into ST-methods). |
5606 #dispatchEvent:, since it dispatches out into ST-methods). |
5607 int i, nchars; |
5618 int i, nchars; |
5608 char *keySymString; |
5619 char *keySymString; |
5609 OBJ arg, sym, t, windowID; |
5620 OBJ arg, sym, t, windowID; |
5610 |
5621 |
5611 if (! ISCONNECTED) { |
5622 if (! ISCONNECTED) { |
5612 RETURN (false); |
5623 RETURN (false); |
5613 } |
5624 } |
5614 |
5625 |
5615 dpy = myDpy; |
5626 dpy = myDpy; |
5616 |
5627 |
5617 ev.type = 0; |
5628 ev.type = 0; |
5618 |
5629 |
5619 if (__isSmallInteger(eventMask)) { |
5630 if (__isSmallInteger(eventMask)) { |
5620 evMask = __intVal(eventMask); |
5631 evMask = __intVal(eventMask); |
5621 } else { |
5632 } else { |
5622 evMask = ~0; |
5633 evMask = ~0; |
5623 } |
5634 } |
5624 |
5635 |
5625 if (__isExternalAddress(aViewIdOrNil)) { |
5636 if (__isExternalAddress(aViewIdOrNil)) { |
5626 wWanted = __WindowVal(aViewIdOrNil); |
5637 wWanted = __WindowVal(aViewIdOrNil); |
5627 returnValue = XCheckWindowEvent(dpy, wWanted, evMask, &ev); |
5638 returnValue = XCheckWindowEvent(dpy, wWanted, evMask, &ev); |
5628 } else { |
5639 } else { |
5629 if (evMask == ~0) { |
5640 if (evMask == ~0) { |
5630 XNextEvent(dpy, &ev); |
5641 XNextEvent(dpy, &ev); |
5631 returnValue = 1; |
5642 returnValue = 1; |
5632 } else { |
5643 } else { |
5633 returnValue = XCheckMaskEvent(dpy, evMask, &ev); |
5644 returnValue = XCheckMaskEvent(dpy, evMask, &ev); |
5634 } |
5645 } |
5635 } |
5646 } |
5636 if (!returnValue) { |
5647 if (!returnValue) { |
5637 /* there is no event */ |
5648 /* there is no event */ |
5638 RETURN (false); |
5649 RETURN (false); |
5639 } |
5650 } |
5640 |
5651 |
5641 if (anEventArray == nil) { |
5652 if (anEventArray == nil) { |
5642 /* sender is not interested in the event */ |
5653 /* sender is not interested in the event */ |
5643 RETURN(true); |
5654 RETURN(true); |
5644 } |
5655 } |
5645 |
5656 |
5646 if (!__isArray(anEventArray)) { |
5657 if (!__isArray(anEventArray)) { |
5647 console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__); |
5658 console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__); |
5648 RETURN (false); |
5659 RETURN (false); |
5649 } |
5660 } |
5650 if (__arraySize(anEventArray) < 11) { |
5661 if (__arraySize(anEventArray) < 11) { |
5651 console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__); |
5662 console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__); |
5652 RETURN (false); |
5663 RETURN (false); |
5653 } |
5664 } |
5654 |
5665 |
5655 # define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask) |
5666 # define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask) |
5656 |
5667 |
5657 # define ae ((XAnyEvent *)&ev) |
5668 # define ae ((XAnyEvent *)&ev) |
5674 # define pe ((XPropertyEvent *)&ev) |
5685 # define pe ((XPropertyEvent *)&ev) |
5675 # define sce ((XSelectionClearEvent *)&ev) |
5686 # define sce ((XSelectionClearEvent *)&ev) |
5676 # define cme ((XColormapEvent *)&ev) |
5687 # define cme ((XColormapEvent *)&ev) |
5677 |
5688 |
5678 if (((t = __INST(lastId)) != nil) |
5689 if (((t = __INST(lastId)) != nil) |
5679 && __isExternalAddress(t) |
5690 && __isExternalAddress(t) |
5680 && (__WindowVal(t) == ae->window)) { |
5691 && (__WindowVal(t) == ae->window)) { |
5681 windowID = t; |
5692 windowID = t; |
5682 } else { |
5693 } else { |
5683 windowID = __MKEXTERNALADDRESS(ae->window); |
5694 windowID = __MKEXTERNALADDRESS(ae->window); |
5684 } |
5695 } |
5685 |
5696 |
5686 __ArrayInstPtr(anEventArray)->a_element[0] = windowID; __STORE(anEventArray, windowID); |
5697 __ArrayInstPtr(anEventArray)->a_element[0] = windowID; __STORE(anEventArray, windowID); |
5687 __ArrayInstPtr(anEventArray)->a_element[1] = __MKSMALLINT(ev.type); |
5698 __ArrayInstPtr(anEventArray)->a_element[1] = __MKSMALLINT(ev.type); |
5688 |
5699 |
5689 switch (ev.type) { |
5700 switch (ev.type) { |
5690 case KeyRelease: |
5701 case KeyRelease: |
5691 sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:); |
5702 sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:); |
5692 goto keyPressAndRelease; |
5703 goto keyPressAndRelease; |
5693 |
5704 |
5694 case KeyPress: |
5705 case KeyPress: |
5695 sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:); |
5706 sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:); |
5696 /* FALL INTO */ |
5707 /* FALL INTO */ |
5697 |
5708 |
5698 keyPressAndRelease: |
5709 keyPressAndRelease: |
5699 arg = nil; |
5710 arg = nil; |
5700 nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL); |
5711 nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL); |
5701 if (nchars == 1 && (((buffer[0] >= ' ') && (buffer[0] <= '~')) |
5712 if (nchars == 1 && (((buffer[0] >= ' ') && (buffer[0] <= '~')) |
5702 || (buffer[0] >= 0x80))) { |
5713 || (buffer[0] >= 0x80))) { |
5703 arg = __MKCHARACTER(buffer[0]); |
5714 arg = __MKCHARACTER(buffer[0]); |
5704 // } else if (nchars > 2) { |
5715 // } else if (nchars > 2) { |
5705 // arg = __MKSTRING_L(buffer, nchars); |
5716 // arg = __MKSTRING_L(buffer, nchars); |
5706 } else { |
5717 } else { |
5707 keySymString = XKeysymToString(keySym); |
5718 keySymString = XKeysymToString(keySym); |
5708 if (keySymString) { |
5719 if (keySymString) { |
5709 arg = __MKSYMBOL(keySymString, 0); |
5720 arg = __MKSYMBOL(keySymString, 0); |
5710 } |
5721 } |
5711 } |
5722 } |
5712 |
5723 |
5713 #ifdef IGNORE_UNKNOWN_KEYCODES |
5724 #ifdef IGNORE_UNKNOWN_KEYCODES |
5714 if (arg == nil) { |
5725 if (arg == nil) { |
5715 /* happens sometimes (alt-graph on sun has no keysym) */ |
5726 /* happens sometimes (alt-graph on sun has no keysym) */ |
5716 RETURN (false); |
5727 RETURN (false); |
5717 } |
5728 } |
5718 #endif |
5729 #endif |
5719 __ArrayInstPtr(anEventArray)->a_element[2] = sym; |
5730 __ArrayInstPtr(anEventArray)->a_element[2] = sym; |
5720 |
5731 |
5721 __ArrayInstPtr(anEventArray)->a_element[3] = arg; __STORE(anEventArray, arg); |
5732 __ArrayInstPtr(anEventArray)->a_element[3] = arg; __STORE(anEventArray, arg); |
5722 t = __MKUINT(ke->keycode); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t); |
5733 t = __MKUINT(ke->keycode); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t); |
5723 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ke->state); |
5734 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ke->state); |
5724 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ke->x); |
5735 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ke->x); |
5725 __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ke->y); |
5736 __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ke->y); |
5726 __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ke->x_root); |
5737 __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ke->x_root); |
5727 __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ke->y_root); |
5738 __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ke->y_root); |
5728 t = __MKUINT(ke->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t); |
5739 t = __MKUINT(ke->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t); |
5729 break; |
5740 break; |
5730 |
5741 |
5731 case ButtonPress: |
5742 case ButtonPress: |
5732 sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:); |
5743 sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:); |
5733 goto buttonPressAndRelease; |
5744 goto buttonPressAndRelease; |
5734 |
5745 |
5735 case ButtonRelease: |
5746 case ButtonRelease: |
5736 sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:); |
5747 sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:); |
5737 /* fall into */ |
5748 /* fall into */ |
5738 |
5749 |
5739 buttonPressAndRelease: |
5750 buttonPressAndRelease: |
5740 __ArrayInstPtr(anEventArray)->a_element[2] = sym; |
5751 __ArrayInstPtr(anEventArray)->a_element[2] = sym; |
5741 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(be->button); |
5752 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(be->button); |
5742 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ke->state); |
5753 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ke->state); |
5743 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(be->x); |
5754 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(be->x); |
5744 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(be->y); |
5755 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(be->y); |
5745 __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(be->x_root); |
5756 __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(be->x_root); |
5746 __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(be->y_root); |
5757 __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(be->y_root); |
5747 t = __MKUINT(be->time); __ArrayInstPtr(anEventArray)->a_element[9] = t; __STORE(anEventArray, t); |
5758 t = __MKUINT(be->time); __ArrayInstPtr(anEventArray)->a_element[9] = t; __STORE(anEventArray, t); |
5748 break; |
5759 break; |
5749 |
5760 |
5750 case MotionNotify: |
5761 case MotionNotify: |
5751 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(buttonMotion:state:x:y:rootX:rootY:time:); |
5762 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(buttonMotion:state:x:y:rootX:rootY:time:); |
5752 |
5763 |
5753 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(me->state); |
5764 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(me->state); |
5754 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(me->x); |
5765 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(me->x); |
5755 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(me->y); |
5766 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(me->y); |
5756 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(me->x_root); |
5767 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(me->x_root); |
5757 __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(me->y_root); |
5768 __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(me->y_root); |
5758 t = __MKUINT(me->time); __ArrayInstPtr(anEventArray)->a_element[8] = t; __STORE(anEventArray, t); |
5769 t = __MKUINT(me->time); __ArrayInstPtr(anEventArray)->a_element[8] = t; __STORE(anEventArray, t); |
5759 break; |
5770 break; |
5760 |
5771 |
5761 case FocusIn: |
5772 case FocusIn: |
5762 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusIn:mode:detail:); |
5773 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusIn:mode:detail:); |
5763 goto focusInOut; |
5774 goto focusInOut; |
5764 |
5775 |
5765 case FocusOut: |
5776 case FocusOut: |
5766 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusOut:mode:detail:); |
5777 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusOut:mode:detail:); |
5767 /* fall into */ |
5778 /* fall into */ |
5768 |
5779 |
5769 focusInOut: |
5780 focusInOut: |
5770 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(fe->mode); |
5781 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(fe->mode); |
5771 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(fe->detail); |
5782 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(fe->detail); |
5772 break; |
5783 break; |
5773 |
5784 |
5774 case EnterNotify: |
5785 case EnterNotify: |
5775 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerEnter:x:y:rootX:rootY:state:mode:detail:time:); |
5786 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerEnter:x:y:rootX:rootY:state:mode:detail:time:); |
5776 goto enterLeave; |
5787 goto enterLeave; |
5777 |
5788 |
5778 case LeaveNotify: |
5789 case LeaveNotify: |
5779 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerLeave:x:y:rootX:rootY:state:mode:detail:time:); |
5790 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerLeave:x:y:rootX:rootY:state:mode:detail:time:); |
5780 /* fall into */ |
5791 /* fall into */ |
5781 |
5792 |
5782 enterLeave: |
5793 enterLeave: |
5783 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ele->x); |
5794 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ele->x); |
5784 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ele->y); |
5795 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ele->y); |
5785 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ele->x_root); |
5796 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ele->x_root); |
5786 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ele->y_root); |
5797 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ele->y_root); |
5787 __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ele->state); |
5798 __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ele->state); |
5788 __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ele->mode); |
5799 __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ele->mode); |
5789 __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ele->detail); |
5800 __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ele->detail); |
5790 t = __MKUINT(ele->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t); |
5801 t = __MKUINT(ele->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t); |
5791 break; |
5802 break; |
5792 |
5803 |
5793 case Expose: |
5804 case Expose: |
5794 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(expose:x:y:width:height:count:); |
5805 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(expose:x:y:width:height:count:); |
5795 goto expose; |
5806 goto expose; |
5796 |
5807 |
5797 case GraphicsExpose: |
5808 case GraphicsExpose: |
5798 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(graphicsExpose:x:y:width:height:count:); |
5809 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(graphicsExpose:x:y:width:height:count:); |
5799 /* fall into */ |
5810 /* fall into */ |
5800 |
5811 |
5801 expose: |
5812 expose: |
5802 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ee->x); |
5813 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ee->x); |
5803 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ee->y); |
5814 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ee->y); |
5804 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ee->width); |
5815 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ee->width); |
5805 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ee->height); |
5816 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ee->height); |
5806 __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ee->count); |
5817 __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ee->count); |
5807 break; |
5818 break; |
5808 |
5819 |
5809 case NoExpose: |
5820 case NoExpose: |
5810 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(noExposeView:); |
5821 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(noExposeView:); |
5811 break; |
5822 break; |
5812 |
5823 |
5813 case VisibilityNotify: |
5824 case VisibilityNotify: |
5814 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(visibilityNotify:state:); |
5825 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(visibilityNotify:state:); |
5815 switch (ve->state) { |
5826 switch (ve->state) { |
5816 case VisibilityUnobscured: |
5827 case VisibilityUnobscured: |
5817 __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(unobscured); |
5828 __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(unobscured); |
5818 break; |
5829 break; |
5819 case VisibilityPartiallyObscured: |
5830 case VisibilityPartiallyObscured: |
5820 __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(partiallyObscured); |
5831 __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(partiallyObscured); |
5821 break; |
5832 break; |
5822 case VisibilityFullyObscured: |
5833 case VisibilityFullyObscured: |
5823 __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(fullyObscured); |
5834 __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(fullyObscured); |
5824 break; |
5835 break; |
5825 default: |
5836 default: |
5826 __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(ve->state); |
5837 __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(ve->state); |
5827 break; |
5838 break; |
5828 } |
5839 } |
5829 break; |
5840 break; |
5830 |
5841 |
5831 case CreateNotify: |
5842 case CreateNotify: |
5832 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(createWindow:x:y:width:height:); |
5843 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(createWindow:x:y:width:height:); |
5833 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cre->x); |
5844 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cre->x); |
5834 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cre->y); |
5845 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cre->y); |
5835 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cre->width); |
5846 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cre->width); |
5836 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cre->height); |
5847 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cre->height); |
5837 break; |
5848 break; |
5838 |
5849 |
5839 case DestroyNotify: |
5850 case DestroyNotify: |
5840 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(destroyedView:); |
5851 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(destroyedView:); |
5841 break; |
5852 break; |
5842 |
5853 |
5843 case UnmapNotify: |
5854 case UnmapNotify: |
5844 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unmappedView:); |
5855 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unmappedView:); |
5845 break; |
5856 break; |
5846 |
5857 |
5847 case MapNotify: |
5858 case MapNotify: |
5848 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappedView:); |
5859 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappedView:); |
5849 break; |
5860 break; |
5850 |
5861 |
5851 case ConfigureNotify: |
5862 case ConfigureNotify: |
5852 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configure:x:y:width:height:above:); |
5863 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configure:x:y:width:height:above:); |
5853 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ce->x); |
5864 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ce->x); |
5854 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ce->y); |
5865 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ce->y); |
5855 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ce->width); |
5866 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ce->width); |
5856 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ce->height); |
5867 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ce->height); |
5857 __ArrayInstPtr(anEventArray)->a_element[7] = nil; |
5868 __ArrayInstPtr(anEventArray)->a_element[7] = nil; |
5858 if (ce->above != None) { |
5869 if (ce->above != None) { |
5859 t = __MKEXTERNALADDRESS(ce->above); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t); |
5870 t = __MKEXTERNALADDRESS(ce->above); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t); |
5860 } |
5871 } |
5861 break; |
5872 break; |
5862 |
5873 |
5863 case GravityNotify: |
5874 case GravityNotify: |
5864 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(gravityNotify:x:y:); |
5875 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(gravityNotify:x:y:); |
5865 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(gre->x); |
5876 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(gre->x); |
5866 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(gre->y); |
5877 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(gre->y); |
5867 break; |
5878 break; |
5868 |
5879 |
5869 case ResizeRequest: |
5880 case ResizeRequest: |
5870 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(resizeRequest:width:height:); |
5881 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(resizeRequest:width:height:); |
5871 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(rr->width); |
5882 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(rr->width); |
5872 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rr->height); |
5883 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rr->height); |
5873 break; |
5884 break; |
5874 |
5885 |
5875 case ConfigureRequest: |
5886 case ConfigureRequest: |
5876 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configureRequest:x:y:width:height:above:detail:); |
5887 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configureRequest:x:y:width:height:above:detail:); |
5877 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cr->x); |
5888 __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cr->x); |
5878 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cr->y); |
5889 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cr->y); |
5879 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cr->width); |
5890 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cr->width); |
5880 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cr->height); |
5891 __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cr->height); |
5881 __ArrayInstPtr(anEventArray)->a_element[7] = nil; |
5892 __ArrayInstPtr(anEventArray)->a_element[7] = nil; |
5882 if (cr->above != None) { |
5893 if (cr->above != None) { |
5883 t = __MKEXTERNALADDRESS(cr->above); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t); |
5894 t = __MKEXTERNALADDRESS(cr->above); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t); |
5884 } |
5895 } |
5885 switch (cr->detail) { |
5896 switch (cr->detail) { |
5886 case Above: |
5897 case Above: |
5887 __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(above); |
5898 __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(above); |
5888 break; |
5899 break; |
5889 case Below: |
5900 case Below: |
5890 __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(below); |
5901 __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(below); |
5891 break; |
5902 break; |
5892 case TopIf: |
5903 case TopIf: |
5893 __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(topIf); |
5904 __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(topIf); |
5894 break; |
5905 break; |
5895 case BottomIf: |
5906 case BottomIf: |
5896 __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(bottomIf); |
5907 __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(bottomIf); |
5897 break; |
5908 break; |
5898 case Opposite: |
5909 case Opposite: |
5899 __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(opposite); |
5910 __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(opposite); |
5900 break; |
5911 break; |
5901 default: |
5912 default: |
5902 __ArrayInstPtr(anEventArray)->a_element[8] = __MKSMALLINT(cr->detail); |
5913 __ArrayInstPtr(anEventArray)->a_element[8] = __MKSMALLINT(cr->detail); |
5903 break; |
5914 break; |
5904 } |
5915 } |
5905 break; |
5916 break; |
5906 |
5917 |
5907 case CirculateNotify: |
5918 case CirculateNotify: |
5908 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateNotify:place:); |
5919 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateNotify:place:); |
5909 goto circulate; |
5920 goto circulate; |
5910 |
5921 |
5911 case CirculateRequest: |
5922 case CirculateRequest: |
5912 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateRequest:place:); |
5923 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateRequest:place:); |
5913 /* fall into */ |
5924 /* fall into */ |
5914 circulate: |
5925 circulate: |
5915 switch (cie->place) { |
5926 switch (cie->place) { |
5916 case PlaceOnTop: |
5927 case PlaceOnTop: |
5917 __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnTop); |
5928 __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnTop); |
5918 break; |
5929 break; |
5919 case PlaceOnBottom: |
5930 case PlaceOnBottom: |
5920 __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnBottom); |
5931 __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnBottom); |
5921 break; |
5932 break; |
5922 default: |
5933 default: |
5923 __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(cie->place); |
5934 __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(cie->place); |
5924 break; |
5935 break; |
5925 } |
5936 } |
5926 break; |
5937 break; |
5927 |
5938 |
5928 case PropertyNotify: |
5939 case PropertyNotify: |
5929 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(propertyChange:property:state:time:); |
5940 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(propertyChange:property:state:time:); |
5930 __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(pe->atom); |
5941 __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(pe->atom); |
5931 switch (pe->state) { |
5942 switch (pe->state) { |
5932 case PropertyNewValue: |
5943 case PropertyNewValue: |
5933 __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(newValue); |
5944 __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(newValue); |
5934 break; |
5945 break; |
5935 case PropertyDelete: |
5946 case PropertyDelete: |
5936 __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(deleted); |
5947 __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(deleted); |
5937 break; |
5948 break; |
5938 default: |
5949 default: |
5939 __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(pe->state); |
5950 __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(pe->state); |
5940 break; |
5951 break; |
5941 } |
5952 } |
5942 t = __MKUINT(pe->time); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t); |
5953 t = __MKUINT(pe->time); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t); |
5943 break; |
5954 break; |
5944 |
5955 |
5945 case SelectionClear: |
5956 case SelectionClear: |
5946 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionClear:selection:time:); |
5957 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionClear:selection:time:); |
5947 __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(sce->selection); |
5958 __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(sce->selection); |
5948 t = __MKUINT(sce->time); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t); |
5959 t = __MKUINT(sce->time); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t); |
5949 break; |
5960 break; |
5950 |
5961 |
5951 case SelectionRequest: |
5962 case SelectionRequest: |
5952 /* |
5963 /* |
5953 * someone wants the selection |
5964 * someone wants the selection |
5954 */ |
5965 */ |
5955 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:); |
5966 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:); |
5956 t = __MKEXTERNALADDRESS(ev.xselectionrequest.requestor); __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t); |
5967 t = __MKEXTERNALADDRESS(ev.xselectionrequest.requestor); __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t); |
5957 __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselectionrequest.selection); |
5968 __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselectionrequest.selection); |
5958 __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselectionrequest.target); |
5969 __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselectionrequest.target); |
5959 __ArrayInstPtr(anEventArray)->a_element[6] = __MKATOMOBJ(ev.xselectionrequest.property); |
5970 __ArrayInstPtr(anEventArray)->a_element[6] = __MKATOMOBJ(ev.xselectionrequest.property); |
5960 t = __MKUINT(ev.xselectionrequest.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t); |
5971 t = __MKUINT(ev.xselectionrequest.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t); |
5961 break; |
5972 break; |
5962 |
5973 |
5963 case SelectionNotify: |
5974 case SelectionNotify: |
5964 /* |
5975 /* |
5965 * returned selection value (answer from SelectionRequest) |
5976 * returned selection value (answer from SelectionRequest) |
5966 */ |
5977 */ |
5967 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:); |
5978 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:); |
5968 __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xselection.selection); |
5979 __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xselection.selection); |
5969 __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselection.target); |
5980 __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselection.target); |
5970 __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselection.property); |
5981 __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselection.property); |
5971 t = __MKEXTERNALADDRESS(ev.xselection.requestor); __ArrayInstPtr(anEventArray)->a_element[6] = t; __STORE(anEventArray, t); |
5982 t = __MKEXTERNALADDRESS(ev.xselection.requestor); __ArrayInstPtr(anEventArray)->a_element[6] = t; __STORE(anEventArray, t); |
5972 t = __MKUINT(ev.xselection.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t); |
5983 t = __MKUINT(ev.xselection.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t); |
5973 break; |
5984 break; |
5974 |
5985 |
5975 case ColormapNotify: |
5986 case ColormapNotify: |
5976 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(colormapNotify:state:); |
5987 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(colormapNotify:state:); |
5977 __ArrayInstPtr(anEventArray)->a_element[3] = cme->state == ColormapInstalled ? true : false; |
5988 __ArrayInstPtr(anEventArray)->a_element[3] = cme->state == ColormapInstalled ? true : false; |
5978 break; |
5989 break; |
5979 |
5990 |
5980 case ClientMessage: |
5991 case ClientMessage: |
5981 if (ev.xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) { |
5992 if (ev.xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) { |
5982 if ((ev.xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom))) |
5993 if ((ev.xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom))) |
5983 || (ev.xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) { |
5994 || (ev.xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) { |
5984 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(terminateView:); |
5995 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(terminateView:); |
5985 break; |
5996 break; |
5986 } |
5997 } |
5987 if (ev.xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) { |
5998 if (ev.xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) { |
5988 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(saveAndTerminateView:); |
5999 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(saveAndTerminateView:); |
5989 break; |
6000 break; |
5990 } |
6001 } |
5991 } |
6002 } |
5992 /* |
6003 /* |
5993 * any other client message |
6004 * any other client message |
5994 */ |
6005 */ |
5995 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(clientMessage:type:format:data:); |
6006 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(clientMessage:type:format:data:); |
5996 __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xclient.message_type); |
6007 __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xclient.message_type); |
5997 __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(ev.xclient.format); |
6008 __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(ev.xclient.format); |
5998 t = __MKBYTEARRAY(&ev.xclient.data, sizeof(ev.xclient.data)); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t); |
6009 t = __MKBYTEARRAY(&ev.xclient.data, sizeof(ev.xclient.data)); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t); |
5999 break; |
6010 break; |
6000 |
6011 |
6001 case MappingNotify: |
6012 case MappingNotify: |
6002 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappingNotify:request:event:); |
6013 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappingNotify:request:event:); |
6003 switch(mape->request) { |
6014 switch(mape->request) { |
6004 case MappingModifier: |
6015 case MappingModifier: |
6005 arg = @symbol(mappingModifier); |
6016 arg = @symbol(mappingModifier); |
6006 break; |
6017 break; |
6007 case MappingKeyboard: |
6018 case MappingKeyboard: |
6008 arg = @symbol(mappingKeyboard); |
6019 arg = @symbol(mappingKeyboard); |
6009 break; |
6020 break; |
6010 case MappingPointer: |
6021 case MappingPointer: |
6011 arg = @symbol(mappingPointer); |
6022 arg = @symbol(mappingPointer); |
6012 break; |
6023 break; |
6013 default: |
6024 default: |
6014 arg = __MKSMALLINT(mape->request); |
6025 arg = __MKSMALLINT(mape->request); |
6015 break; |
6026 break; |
6016 } |
6027 } |
6017 __ArrayInstPtr(anEventArray)->a_element[3] = arg; |
6028 __ArrayInstPtr(anEventArray)->a_element[3] = arg; |
6018 t = __MKBYTEARRAY(&ev, sizeof(*mape)); __ArrayInstPtr(anEventArray)->a_element[4] = t; |
6029 t = __MKBYTEARRAY(&ev, sizeof(*mape)); __ArrayInstPtr(anEventArray)->a_element[4] = t; |
6019 __STORE(anEventArray, t); |
6030 __STORE(anEventArray, t); |
6020 break; |
6031 break; |
6021 |
6032 |
6022 case KeymapNotify: |
6033 case KeymapNotify: |
6023 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(keymapNotify:); |
6034 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(keymapNotify:); |
6024 break; |
6035 break; |
6025 |
6036 |
6026 case MapRequest: |
6037 case MapRequest: |
6027 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mapRequest:); |
6038 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mapRequest:); |
6028 break; |
6039 break; |
6029 |
6040 |
6030 case ReparentNotify: |
6041 case ReparentNotify: |
6031 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(reparentedView:parentId:x:y:); |
6042 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(reparentedView:parentId:x:y:); |
6032 t = __MKEXTERNALADDRESS(rpe->parent); |
6043 t = __MKEXTERNALADDRESS(rpe->parent); |
6033 __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t); |
6044 __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t); |
6034 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rpe->x); |
6045 __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rpe->x); |
6035 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(rpe->y); |
6046 __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(rpe->y); |
6036 break; |
6047 break; |
6037 |
6048 |
6038 default: |
6049 default: |
6039 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unknownX11Event); |
6050 __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unknownX11Event); |
6040 break; |
6051 break; |
6041 } |
6052 } |
6042 #undef ae |
6053 #undef ae |
6043 #undef ee |
6054 #undef ee |
6044 #undef ke |
6055 #undef ke |
6045 #undef be |
6056 #undef be |
6099 int mask; |
6110 int mask; |
6100 |
6111 |
6101 if (ISCONNECTED |
6112 if (ISCONNECTED |
6102 && __isExternalAddress(aWindowId) |
6113 && __isExternalAddress(aWindowId) |
6103 && __isSmallInteger(aMask)) { |
6114 && __isSmallInteger(aMask)) { |
6104 mask = __intVal(aMask); |
6115 mask = __intVal(aMask); |
6105 |
6116 |
6106 #ifdef OLD |
6117 #ifdef OLD |
6107 /* these may not be disabled */ |
6118 /* these may not be disabled */ |
6108 mask |= ExposureMask | StructureNotifyMask | |
6119 mask |= ExposureMask | StructureNotifyMask | |
6109 KeyPressMask | KeyReleaseMask | |
6120 KeyPressMask | KeyReleaseMask | |
6110 EnterWindowMask | LeaveWindowMask | |
6121 EnterWindowMask | LeaveWindowMask | |
6111 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
6122 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
6112 #endif |
6123 #endif |
6113 |
6124 |
6114 ENTER_XLIB(); |
6125 ENTER_XLIB(); |
6115 XSelectInput(myDpy, __WindowVal(aWindowId), mask); |
6126 XSelectInput(myDpy, __WindowVal(aWindowId), mask); |
6116 LEAVE_XLIB(); |
6127 LEAVE_XLIB(); |
6117 RETURN ( self ); |
6128 RETURN ( self ); |
6118 } |
6129 } |
6119 %}. |
6130 %}. |
6120 self primitiveFailedOrClosedConnection |
6131 self primitiveFailedOrClosedConnection |
6121 ! |
6132 ! |
6122 |
6133 |
6141 |
6152 |
6142 buttonPress:button x:x y:y view:aView |
6153 buttonPress:button x:x y:y view:aView |
6143 "forward a button-press event for some view" |
6154 "forward a button-press event for some view" |
6144 |
6155 |
6145 aView isNil ifTrue:[ |
6156 aView isNil ifTrue:[ |
6146 "/ event arrived, after I destroyed it myself |
6157 "/ event arrived, after I destroyed it myself |
6147 ^ self |
6158 ^ self |
6148 ]. |
6159 ]. |
6149 button == 1 ifTrue:[ |
6160 button == 1 ifTrue:[ |
6150 activateOnClick == true ifTrue:[ |
6161 activateOnClick == true ifTrue:[ |
6151 "/ dont raise above an active popup view. |
6162 "/ dont raise above an active popup view. |
6152 (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[ |
6163 (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[ |
6153 aView topView raise. |
6164 aView topView raise. |
6154 "/ ] ifFalse:[ |
6165 "/ ] ifFalse:[ |
6155 "/ activeKeyboardGrab printCR. |
6166 "/ activeKeyboardGrab printCR. |
6156 "/ activePointerGrab printCR. |
6167 "/ activePointerGrab printCR. |
6157 ] |
6168 ] |
6158 ]. |
6169 ]. |
6159 ]. |
6170 ]. |
6160 super buttonPress:button x:x y:y view:aView |
6171 super buttonPress:button x:x y:y view:aView |
6161 |
6172 |
6162 |
6173 |
6163 |
6174 |
6196 && __isInteger(msgType) |
6207 && __isInteger(msgType) |
6197 && __isInteger(msgFormat) |
6208 && __isInteger(msgFormat) |
6198 && (eventMask == nil || __isInteger(eventMask)) |
6209 && (eventMask == nil || __isInteger(eventMask)) |
6199 && (__isExternalAddress(windowID) || __isInteger(windowID)) |
6210 && (__isExternalAddress(windowID) || __isInteger(windowID)) |
6200 && (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) { |
6211 && (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) { |
6201 Display *dpy = myDpy; |
6212 Display *dpy = myDpy; |
6202 XEvent ev; |
6213 XEvent ev; |
6203 Status result; |
6214 Status result; |
6204 Window targetWindow; |
6215 Window targetWindow; |
6205 |
6216 |
6206 if (__isInteger(d1)) { |
6217 if (__isInteger(d1)) { |
6207 ev.xclient.data.l[0] = __longIntVal(d1); |
6218 ev.xclient.data.l[0] = __longIntVal(d1); |
6208 } else { |
6219 } else { |
6209 if (__isExternalAddress(d1)) { |
6220 if (__isExternalAddress(d1)) { |
6210 ev.xclient.data.l[0] = (INT)__externalAddressVal(d1); |
6221 ev.xclient.data.l[0] = (INT)__externalAddressVal(d1); |
6211 } else { |
6222 } else { |
6212 ev.xclient.data.l[0] = 0; |
6223 ev.xclient.data.l[0] = 0; |
6213 } |
6224 } |
6214 } |
6225 } |
6215 if (__isInteger(d2)) { |
6226 if (__isInteger(d2)) { |
6216 ev.xclient.data.l[1] = __longIntVal(d2); |
6227 ev.xclient.data.l[1] = __longIntVal(d2); |
6217 } else { |
6228 } else { |
6218 if (__isExternalAddress(d2)) { |
6229 if (__isExternalAddress(d2)) { |
6219 ev.xclient.data.l[1] = (INT)__externalAddressVal(d2); |
6230 ev.xclient.data.l[1] = (INT)__externalAddressVal(d2); |
6220 } else { |
6231 } else { |
6221 ev.xclient.data.l[1] = 0; |
6232 ev.xclient.data.l[1] = 0; |
6222 } |
6233 } |
6223 } |
6234 } |
6224 if (__isInteger(d3)) { |
6235 if (__isInteger(d3)) { |
6225 ev.xclient.data.l[2] = __longIntVal(d3); |
6236 ev.xclient.data.l[2] = __longIntVal(d3); |
6226 } else { |
6237 } else { |
6227 if (__isExternalAddress(d3)) { |
6238 if (__isExternalAddress(d3)) { |
6228 ev.xclient.data.l[2] = (INT)__externalAddressVal(d3); |
6239 ev.xclient.data.l[2] = (INT)__externalAddressVal(d3); |
6229 } else { |
6240 } else { |
6230 ev.xclient.data.l[2] = 0; |
6241 ev.xclient.data.l[2] = 0; |
6231 } |
6242 } |
6232 } |
6243 } |
6233 if (__isInteger(d4)) { |
6244 if (__isInteger(d4)) { |
6234 ev.xclient.data.l[3] = __longIntVal(d4); |
6245 ev.xclient.data.l[3] = __longIntVal(d4); |
6235 } else { |
6246 } else { |
6236 if (__isExternalAddress(d4)) { |
6247 if (__isExternalAddress(d4)) { |
6237 ev.xclient.data.l[3] = (INT)__externalAddressVal(d4); |
6248 ev.xclient.data.l[3] = (INT)__externalAddressVal(d4); |
6238 } else { |
6249 } else { |
6239 ev.xclient.data.l[3] = 0; |
6250 ev.xclient.data.l[3] = 0; |
6240 } |
6251 } |
6241 } |
6252 } |
6242 if (__isInteger(d5)) { |
6253 if (__isInteger(d5)) { |
6243 ev.xclient.data.l[4] = __longIntVal(d5); |
6254 ev.xclient.data.l[4] = __longIntVal(d5); |
6244 } else { |
6255 } else { |
6245 if (__isExternalAddress(d5)) { |
6256 if (__isExternalAddress(d5)) { |
6246 ev.xclient.data.l[4] = (INT)__externalAddressVal(d5); |
6257 ev.xclient.data.l[4] = (INT)__externalAddressVal(d5); |
6247 } else { |
6258 } else { |
6248 ev.xclient.data.l[4] = 0; |
6259 ev.xclient.data.l[4] = 0; |
6249 } |
6260 } |
6250 } |
6261 } |
6251 |
6262 |
6252 if (__isExternalAddress(windowID)) { |
6263 if (__isExternalAddress(windowID)) { |
6253 ev.xclient.window = __WindowVal(windowID); |
6264 ev.xclient.window = __WindowVal(windowID); |
6254 } else { |
6265 } else { |
6255 ev.xclient.window = (Window)__longIntVal(windowID); |
6266 ev.xclient.window = (Window)__longIntVal(windowID); |
6256 } |
6267 } |
6257 |
6268 |
6258 if (__isExternalAddress(targetWindowID)) { |
6269 if (__isExternalAddress(targetWindowID)) { |
6259 targetWindow = __WindowVal(targetWindowID); |
6270 targetWindow = __WindowVal(targetWindowID); |
6260 } else { |
6271 } else { |
6261 targetWindow = (Window)__longIntVal(targetWindowID); |
6272 targetWindow = (Window)__longIntVal(targetWindowID); |
6262 } |
6273 } |
6263 |
6274 |
6264 ev.xclient.type = ClientMessage; |
6275 ev.xclient.type = ClientMessage; |
6265 ev.xclient.display = dpy; |
6276 ev.xclient.display = dpy; |
6266 ev.xclient.message_type = __longIntVal(msgType); |
6277 ev.xclient.message_type = __longIntVal(msgType); |
6267 ev.xclient.format = __longIntVal(msgFormat); |
6278 ev.xclient.format = __longIntVal(msgFormat); |
6268 |
6279 |
6269 if (eventMask == nil) { |
6280 if (eventMask == nil) { |
6270 __eventMask = NoEventMask; |
6281 __eventMask = NoEventMask; |
6271 } else { |
6282 } else { |
6272 __eventMask = __longIntVal(eventMask); |
6283 __eventMask = __longIntVal(eventMask); |
6273 } |
6284 } |
6274 |
6285 |
6275 ENTER_XLIB(); |
6286 ENTER_XLIB(); |
6276 result = XSendEvent(dpy, targetWindow, (propagate == true ? True : False), __eventMask , &ev); |
6287 result = XSendEvent(dpy, targetWindow, (propagate == true ? True : False), __eventMask , &ev); |
6277 LEAVE_XLIB(); |
6288 LEAVE_XLIB(); |
6278 |
6289 |
6279 if ((result == BadValue) || (result == BadWindow)) { |
6290 if ((result == BadValue) || (result == BadWindow)) { |
6280 DPRINTF(("bad status in sendClientEvent\n")); |
6291 DPRINTF(("bad status in sendClientEvent\n")); |
6281 RETURN ( false ) |
6292 RETURN ( false ) |
6282 } |
6293 } |
6283 RETURN (true) |
6294 RETURN (true) |
6284 } |
6295 } |
6285 %}. |
6296 %}. |
6286 self primitiveFailedOrClosedConnection. |
6297 self primitiveFailedOrClosedConnection. |
6287 ^ false |
6298 ^ false |
6288 ! |
6299 ! |
6301 %{ |
6312 %{ |
6302 int type; |
6313 int type; |
6303 int state; |
6314 int state; |
6304 |
6315 |
6305 if (__isSmallInteger(stateMask)) { |
6316 if (__isSmallInteger(stateMask)) { |
6306 state = __intVal(stateMask); |
6317 state = __intVal(stateMask); |
6307 } else { |
6318 } else { |
6308 state = 0; |
6319 state = 0; |
6309 } |
6320 } |
6310 |
6321 |
6311 if (ISCONNECTED |
6322 if (ISCONNECTED |
6312 && __isSmallInteger(xPos) && __isSmallInteger(yPos) |
6323 && __isSmallInteger(xPos) && __isSmallInteger(yPos) |
6313 && (__isSmallInteger(keySymCodeOrButtonNr) || __isStringLike(keySymCodeOrButtonNr)) |
6324 && (__isSmallInteger(keySymCodeOrButtonNr) || __isStringLike(keySymCodeOrButtonNr)) |
6314 && (__isExternalAddress(targetId) || __isInteger(targetId))) { |
6325 && (__isExternalAddress(targetId) || __isInteger(targetId))) { |
6315 Display *dpy = myDpy; |
6326 Display *dpy = myDpy; |
6316 |
6327 |
6317 XEvent ev; |
6328 XEvent ev; |
6318 Window target; |
6329 Window target; |
6319 Status result; |
6330 Status result; |
6320 KeySym keySym, *syms; |
6331 KeySym keySym, *syms; |
6321 int screen = __intVal(__INST(screen)); |
6332 int screen = __intVal(__INST(screen)); |
6322 char s[2]; |
6333 char s[2]; |
6323 int nSyms; |
6334 int nSyms; |
6324 |
6335 |
6325 if ((typeSymbol == @symbol(keyPress)) |
6336 if ((typeSymbol == @symbol(keyPress)) |
6326 || (typeSymbol == @symbol(keyRelease))) { |
6337 || (typeSymbol == @symbol(keyRelease))) { |
6327 if (__isStringLike(keySymCodeOrButtonNr)) { |
6338 if (__isStringLike(keySymCodeOrButtonNr)) { |
6328 keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr)); |
6339 keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr)); |
6329 } else { |
6340 } else { |
6330 if (__isCharacter(keySymCodeOrButtonNr)) { |
6341 if (__isCharacter(keySymCodeOrButtonNr)) { |
6331 s[0] = __intVal(__characterVal(keySymCodeOrButtonNr)); |
6342 s[0] = __intVal(__characterVal(keySymCodeOrButtonNr)); |
6332 s[1] = '\0'; |
6343 s[1] = '\0'; |
6333 keySym = XStringToKeysym(s); |
6344 keySym = XStringToKeysym(s); |
6334 } else { |
6345 } else { |
6335 keySym = (KeySym) __intVal(keySymCodeOrButtonNr); |
6346 keySym = (KeySym) __intVal(keySymCodeOrButtonNr); |
6336 } |
6347 } |
6337 } |
6348 } |
6338 ev.xkey.keycode = XKeysymToKeycode(dpy, keySym); |
6349 ev.xkey.keycode = XKeysymToKeycode(dpy, keySym); |
6339 |
6350 |
6340 if (stateMask == nil) { |
6351 if (stateMask == nil) { |
6341 /* |
6352 /* |
6342 * get the modifier from the keySym |
6353 * get the modifier from the keySym |
6343 */ |
6354 */ |
6344 nSyms = 0; |
6355 nSyms = 0; |
6345 syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms); |
6356 syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms); |
6346 if (syms) { |
6357 if (syms) { |
6347 int i; |
6358 int i; |
6348 |
6359 |
6349 for (i=0; i<nSyms; i++) { |
6360 for (i=0; i<nSyms; i++) { |
6350 if (syms[i] == keySym) { |
6361 if (syms[i] == keySym) { |
6351 #ifdef MODIFIERDEBUG |
6362 #ifdef MODIFIERDEBUG |
6352 console_printf("modifier-index is %d\n", i); |
6363 console_printf("modifier-index is %d\n", i); |
6353 #endif |
6364 #endif |
6354 if (i) state = (1 << (i-1)); |
6365 if (i) state = (1 << (i-1)); |
6355 break; |
6366 break; |
6356 } |
6367 } |
6357 } |
6368 } |
6358 XFree(syms); |
6369 XFree(syms); |
6359 } |
6370 } |
6360 } |
6371 } |
6361 } else { |
6372 } else { |
6362 if ((typeSymbol == @symbol(buttonPress)) |
6373 if ((typeSymbol == @symbol(buttonPress)) |
6363 || (typeSymbol == @symbol(buttonRelease))) { |
6374 || (typeSymbol == @symbol(buttonRelease))) { |
6364 if (__isSmallInteger(keySymCodeOrButtonNr)) { |
6375 if (__isSmallInteger(keySymCodeOrButtonNr)) { |
6365 ev.xbutton.button = __intVal(keySymCodeOrButtonNr); |
6376 ev.xbutton.button = __intVal(keySymCodeOrButtonNr); |
6366 } else { |
6377 } else { |
6367 ev.xbutton.button = 1; |
6378 ev.xbutton.button = 1; |
6368 } |
6379 } |
6369 } else { |
6380 } else { |
6370 DPRINTF(("invalid sendEvent typeSymbol\n")); |
6381 DPRINTF(("invalid sendEvent typeSymbol\n")); |
6371 RETURN (false); |
6382 RETURN (false); |
6372 } |
6383 } |
6373 } |
6384 } |
6374 |
6385 |
6375 if (typeSymbol == @symbol(keyPress)) |
6386 if (typeSymbol == @symbol(keyPress)) |
6376 ev.xany.type = KeyPress; |
6387 ev.xany.type = KeyPress; |
6377 else if (typeSymbol == @symbol(keyRelease)) |
6388 else if (typeSymbol == @symbol(keyRelease)) |
6378 ev.xany.type = KeyRelease; |
6389 ev.xany.type = KeyRelease; |
6379 else if (typeSymbol == @symbol(buttonPress)) |
6390 else if (typeSymbol == @symbol(buttonPress)) |
6380 ev.xany.type = ButtonPress; |
6391 ev.xany.type = ButtonPress; |
6381 else if (typeSymbol == @symbol(buttonRelease)) |
6392 else if (typeSymbol == @symbol(buttonRelease)) |
6382 ev.xany.type = ButtonRelease; |
6393 ev.xany.type = ButtonRelease; |
6383 |
6394 |
6384 if (__isExternalAddress(targetId)) { |
6395 if (__isExternalAddress(targetId)) { |
6385 target = __WindowVal(targetId); |
6396 target = __WindowVal(targetId); |
6386 } else { |
6397 } else { |
6387 target = (Window) __longIntVal(targetId); |
6398 target = (Window) __longIntVal(targetId); |
6388 } |
6399 } |
6389 ev.xkey.window = target; |
6400 ev.xkey.window = target; |
6390 ev.xkey.same_screen = 1; |
6401 ev.xkey.same_screen = 1; |
6391 ev.xkey.subwindow = 0; |
6402 ev.xkey.subwindow = 0; |
6392 ev.xkey.root = RootWindow(dpy, screen); |
6403 ev.xkey.root = RootWindow(dpy, screen); |
6393 ev.xkey.x = __intVal(xPos); |
6404 ev.xkey.x = __intVal(xPos); |
6394 ev.xkey.y = __intVal(yPos); |
6405 ev.xkey.y = __intVal(yPos); |
6395 ev.xkey.state = state; |
6406 ev.xkey.state = state; |
6396 ev.xkey.time = CurrentTime; |
6407 ev.xkey.time = CurrentTime; |
6397 |
6408 |
6398 ENTER_XLIB(); |
6409 ENTER_XLIB(); |
6399 result = XSendEvent(dpy, target, False, 0 , &ev); |
6410 result = XSendEvent(dpy, target, False, 0 , &ev); |
6400 LEAVE_XLIB(); |
6411 LEAVE_XLIB(); |
6401 if ((result == BadValue) || (result == BadWindow)) { |
6412 if ((result == BadValue) || (result == BadWindow)) { |
6402 DPRINTF(("bad status\n")); |
6413 DPRINTF(("bad status\n")); |
6403 RETURN ( false ) |
6414 RETURN ( false ) |
6404 } |
6415 } |
6405 RETURN (true) |
6416 RETURN (true) |
6406 } |
6417 } |
6407 %}. |
6418 %}. |
6408 self primitiveFailedOrClosedConnection. |
6419 self primitiveFailedOrClosedConnection. |
6409 ^ false |
6420 ^ false |
6410 ! ! |
6421 ! ! |
6424 XFontStruct *newFont; |
6435 XFontStruct *newFont; |
6425 |
6436 |
6426 if (ISCONNECTED |
6437 if (ISCONNECTED |
6427 && __isStringLike(aFontName)) { |
6438 && __isStringLike(aFontName)) { |
6428 |
6439 |
6429 ENTER_XLIB(); |
6440 ENTER_XLIB(); |
6430 newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName)); |
6441 newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName)); |
6431 LEAVE_XLIB(); |
6442 LEAVE_XLIB(); |
6432 #ifdef COUNT_RESOURCES |
6443 #ifdef COUNT_RESOURCES |
6433 if (newFont) |
6444 if (newFont) |
6434 __cnt_font++; |
6445 __cnt_font++; |
6435 #endif |
6446 #endif |
6436 |
6447 |
6437 RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil ); |
6448 RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil ); |
6438 } |
6449 } |
6439 %}. |
6450 %}. |
6440 "/ --- disabled due to UNLIMITEDSTACK -- self primitiveFailedOrClosedConnection. |
6451 "/ --- disabled due to UNLIMITEDSTACK -- self primitiveFailedOrClosedConnection. |
6441 ^ nil |
6452 ^ nil |
6442 ! |
6453 ! |
6452 resX resY registry encoding coding fields| |
6463 resX resY registry encoding coding fields| |
6453 |
6464 |
6454 aString isNil ifTrue:[^ false]. |
6465 aString isNil ifTrue:[^ false]. |
6455 fields := aString asCollectionOfSubstringsSeparatedBy:$-. |
6466 fields := aString asCollectionOfSubstringsSeparatedBy:$-. |
6456 fields size == 3 ifTrue:[ |
6467 fields size == 3 ifTrue:[ |
6457 "take care of old font names: family-style-size" |
6468 "take care of old font names: family-style-size" |
6458 family := fields at:1. |
6469 family := fields at:1. |
6459 style := fields at:2. |
6470 style := fields at:2. |
6460 size := Number readFromString:(fields at:3) onError:[^ false]. |
6471 size := Number readFromString:(fields at:3) onError:[^ false]. |
6461 ] ifFalse:[fields size == 2 ifTrue:[ |
6472 ] ifFalse:[fields size == 2 ifTrue:[ |
6462 "take care of old font names: family-size" |
6473 "take care of old font names: family-size" |
6463 family := fields at:1. |
6474 family := fields at:1. |
6464 size := Number readFromString:(fields at:2) onError:[^ false]. |
6475 size := Number readFromString:(fields at:2) onError:[^ false]. |
6465 ] ifFalse:[fields size >= 15 ifTrue:[ |
6476 ] ifFalse:[fields size >= 15 ifTrue:[ |
6466 family := fields at:3. |
6477 family := fields at:3. |
6467 face := fields at:4. |
6478 face := fields at:4. |
6468 style := fields at:5. |
6479 style := fields at:5. |
6469 style = 'o' ifTrue:[ |
6480 style = 'o' ifTrue:[ |
6470 style := 'oblique' |
6481 style := 'oblique' |
6471 ] ifFalse:[style = 'i' ifTrue:[ |
6482 ] ifFalse:[style = 'i' ifTrue:[ |
6472 style := 'italic' |
6483 style := 'italic' |
6473 ] ifFalse:[style = 'r' ifTrue:[ |
6484 ] ifFalse:[style = 'r' ifTrue:[ |
6474 style := 'roman' |
6485 style := 'roman' |
6475 ]]]. |
6486 ]]]. |
6476 moreStyle := fields at:6. |
6487 moreStyle := fields at:6. |
6477 (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[ |
6488 (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[ |
6478 style := style, '-', moreStyle. |
6489 style := style, '-', moreStyle. |
6479 ]. |
6490 ]. |
6480 fheight := fields at:8. |
6491 fheight := fields at:8. |
6481 size := (Number readFromString:(fields at:9) onError:[^ false]) / 10. |
6492 size := (Number readFromString:(fields at:9) onError:[^ false]) / 10. |
6482 resX := fields at:10. |
6493 resX := fields at:10. |
6483 resY := fields at:11. |
6494 resY := fields at:11. |
6484 registry := fields at:14. |
6495 registry := fields at:14. |
6485 encoding := fields at:15. |
6496 encoding := fields at:15. |
6486 coding := registry , '-' , encoding. |
6497 coding := registry , '-' , encoding. |
6487 ] ifFalse:[ |
6498 ] ifFalse:[ |
6488 ^ false |
6499 ^ false |
6489 ]]]. |
6500 ]]]. |
6490 aBlock value:family value:face value:style value:size value:coding. |
6501 aBlock value:family value:face value:style value:size value:coding. |
6491 ^ true |
6502 ^ true |
6492 ! |
6503 ! |
6493 |
6504 |
6528 int directionReturn, fontAscentReturn, fontDescentReturn; |
6539 int directionReturn, fontAscentReturn, fontDescentReturn; |
6529 XCharStruct overAllReturn; |
6540 XCharStruct overAllReturn; |
6530 OBJ *resultArray; |
6541 OBJ *resultArray; |
6531 |
6542 |
6532 if (ISCONNECTED |
6543 if (ISCONNECTED |
6533 && __bothSmallInteger(index1, index2) |
6544 && __bothSmallInteger(index1, index2) |
6534 && __isExternalAddress(aFontId) |
6545 && __isExternalAddress(aFontId) |
6535 && __isNonNilObject(aString)) { |
6546 && __isNonNilObject(aString)) { |
6536 int lMax = __intVal(@global(MaxStringLength)); |
6547 int lMax = __intVal(@global(MaxStringLength)); |
6537 f = __FontVal(aFontId); |
6548 f = __FontVal(aFontId); |
6538 if (! f) goto fail; |
6549 if (! f) goto fail; |
6539 |
6550 |
6540 if (__isArray(anArray) && __arraySize(anArray) > 0) { |
6551 if (__isArray(anArray) && __arraySize(anArray) > 0) { |
6541 resultArray = __arrayVal(anArray); |
6552 resultArray = __arrayVal(anArray); |
6542 } else { |
6553 } else { |
6543 resultArray = 0; |
6554 resultArray = 0; |
6544 } |
6555 } |
6545 |
6556 |
6546 i1 = __intVal(index1) - 1; |
6557 i1 = __intVal(index1) - 1; |
6547 |
6558 |
6548 if (i1 >= 0) { |
6559 if (i1 >= 0) { |
6549 OBJ cls; |
6560 OBJ cls; |
6550 |
6561 |
6551 i2 = __intVal(index2) - 1; |
6562 i2 = __intVal(index2) - 1; |
6552 if (i2 < i1) { |
6563 if (i2 < i1) { |
6553 RETURN ( __MKSMALLINT(0) ); |
6564 RETURN ( __MKSMALLINT(0) ); |
6554 } |
6565 } |
6555 |
6566 |
6556 cp = (char *) __stringVal(aString); |
6567 cp = (char *) __stringVal(aString); |
6557 l = i2 - i1 + 1; |
6568 l = i2 - i1 + 1; |
6558 |
6569 |
6559 if (__isStringLike(aString)) { |
6570 if (__isStringLike(aString)) { |
6560 n = __stringSize(aString); |
6571 n = __stringSize(aString); |
6561 if (i2 >= n) goto fail; |
6572 if (i2 >= n) goto fail; |
6562 cp += i1; |
6573 cp += i1; |
6563 len = XTextExtents(f, cp, l, |
6574 len = XTextExtents(f, cp, l, |
6564 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
6575 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
6565 &overAllReturn); |
6576 &overAllReturn); |
6566 } else { |
6577 } else { |
6567 cls = __qClass(aString); |
6578 cls = __qClass(aString); |
6568 nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
6579 nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
6569 cp += nInstBytes; |
6580 cp += nInstBytes; |
6570 n = __byteArraySize(aString) - nInstBytes; |
6581 n = __byteArraySize(aString) - nInstBytes; |
6571 |
6582 |
6572 if (__isBytes(aString)) { |
6583 if (__isBytes(aString)) { |
6573 if (i2 >= n) goto fail; |
6584 if (i2 >= n) goto fail; |
6574 |
6585 |
6575 cp += i1; |
6586 cp += i1; |
6576 len = XTextExtents(f, cp, l, |
6587 len = XTextExtents(f, cp, l, |
6577 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
6588 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
6578 &overAllReturn); |
6589 &overAllReturn); |
6579 } else if (__isWords(aString)) { /* TWOBYTESTRINGS */ |
6590 } else if (__isWords(aString)) { /* TWOBYTESTRINGS */ |
6580 union { |
6591 union { |
6581 char b[2]; |
6592 char b[2]; |
6582 unsigned short s; |
6593 unsigned short s; |
6583 } u; |
6594 } u; |
6584 int i; |
6595 int i; |
6585 XChar2b *cp2 = (XChar2b *)0; |
6596 XChar2b *cp2 = (XChar2b *)0; |
6586 int mustFree = 0; |
6597 int mustFree = 0; |
6587 |
6598 |
6588 n = n / 2; |
6599 n = n / 2; |
6589 if (i2 >= n) goto fail; |
6600 if (i2 >= n) goto fail; |
6590 |
6601 |
6591 cp += (i1 * 2); |
6602 cp += (i1 * 2); |
6592 if (l > lMax) l = lMax; |
6603 if (l > lMax) l = lMax; |
6593 |
6604 |
6594 /* |
6605 /* |
6595 * ST/X TwoByteStrings store the asciiValue in native byteOrder; |
6606 * ST/X TwoByteStrings store the asciiValue in native byteOrder; |
6596 * X expects them MSB first |
6607 * X expects them MSB first |
6597 * convert as required |
6608 * convert as required |
6598 */ |
6609 */ |
6599 |
6610 |
6600 u.s = 0x1234; |
6611 u.s = 0x1234; |
6601 if (u.b[0] != 0x12) { |
6612 if (u.b[0] != 0x12) { |
6602 if (l <= NLOCALBUFFER) { |
6613 if (l <= NLOCALBUFFER) { |
6603 cp2 = xlatebuffer; |
6614 cp2 = xlatebuffer; |
6604 } else { |
6615 } else { |
6605 cp2 = (XChar2b *)(malloc(l * 2)); |
6616 cp2 = (XChar2b *)(malloc(l * 2)); |
6606 mustFree = 1; |
6617 mustFree = 1; |
6607 } |
6618 } |
6608 for (i=0; i<l; i++) { |
6619 for (i=0; i<l; i++) { |
6609 cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
6620 cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
6610 cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
6621 cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
6611 } |
6622 } |
6612 cp = (char *) cp2; |
6623 cp = (char *) cp2; |
6613 } |
6624 } |
6614 |
6625 |
6615 len = XTextExtents16(f, (XChar2b *)cp, l, |
6626 len = XTextExtents16(f, (XChar2b *)cp, l, |
6616 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
6627 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
6617 &overAllReturn); |
6628 &overAllReturn); |
6618 |
6629 |
6619 if (mustFree) { |
6630 if (mustFree) { |
6620 free(cp2); |
6631 free(cp2); |
6621 } |
6632 } |
6622 } else if (__isLongs(aString)) { /* FOURBYTESTRINGS */ |
6633 } else if (__isLongs(aString)) { /* FOURBYTESTRINGS */ |
6623 union { |
6634 union { |
6624 char b[2]; |
6635 char b[2]; |
6625 unsigned short s; |
6636 unsigned short s; |
6626 } u; |
6637 } u; |
6627 int i; |
6638 int i; |
6628 XChar2b *cp2 = (XChar2b *)0; |
6639 XChar2b *cp2 = (XChar2b *)0; |
6629 int mustFree = 0; |
6640 int mustFree = 0; |
6630 |
6641 |
6631 n = n / 4; |
6642 n = n / 4; |
6632 if (i2 >= n) goto fail; |
6643 if (i2 >= n) goto fail; |
6633 |
6644 |
6634 cp += (i1 * 4); |
6645 cp += (i1 * 4); |
6635 if (l > lMax) l = lMax; |
6646 if (l > lMax) l = lMax; |
6636 |
6647 |
6637 /* |
6648 /* |
6638 * For now: X does not support 32bit characters without the new 32Unicode extensions. |
6649 * For now: X does not support 32bit characters without the new 32Unicode extensions. |
6639 * For now, treat chars above 0xFFFF as 0xFFFF (should we use default-char ?). |
6650 * For now, treat chars above 0xFFFF as 0xFFFF (should we use default-char ?). |
6640 */ |
6651 */ |
6641 if (l <= NLOCALBUFFER) { |
6652 if (l <= NLOCALBUFFER) { |
6642 cp2 = xlatebuffer; |
6653 cp2 = xlatebuffer; |
6643 } else { |
6654 } else { |
6644 cp2 = (XChar2b *)(malloc(l * 2)); |
6655 cp2 = (XChar2b *)(malloc(l * 2)); |
6645 mustFree = 1; |
6656 mustFree = 1; |
6646 } |
6657 } |
6647 for (i=0; i<l; i++) { |
6658 for (i=0; i<l; i++) { |
6648 int codePoint; |
6659 int codePoint; |
6649 |
6660 |
6650 codePoint = ((unsigned int32 *)cp)[i]; |
6661 codePoint = ((unsigned int32 *)cp)[i]; |
6651 if (codePoint > 0xFFFF) { |
6662 if (codePoint > 0xFFFF) { |
6652 codePoint = 0xFFFF; |
6663 codePoint = 0xFFFF; |
6653 } |
6664 } |
6654 cp2[i].byte1 = codePoint & 0xFF; |
6665 cp2[i].byte1 = codePoint & 0xFF; |
6655 cp2[i].byte2 = (codePoint >> 8) & 0xFF;; |
6666 cp2[i].byte2 = (codePoint >> 8) & 0xFF;; |
6656 } |
6667 } |
6657 cp = (char *) cp2; |
6668 cp = (char *) cp2; |
6658 |
6669 |
6659 len = XTextExtents16(f, (XChar2b *)cp, l, |
6670 len = XTextExtents16(f, (XChar2b *)cp, l, |
6660 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
6671 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
6661 &overAllReturn); |
6672 &overAllReturn); |
6662 if (mustFree) { |
6673 if (mustFree) { |
6663 free(cp2); |
6674 free(cp2); |
6664 } |
6675 } |
6665 } else |
6676 } else |
6666 goto fail; /*unknown string class */ |
6677 goto fail; /*unknown string class */ |
6667 } |
6678 } |
6668 if (resultArray) { |
6679 if (resultArray) { |
6669 switch (__arraySize(anArray)) { |
6680 switch (__arraySize(anArray)) { |
6670 default: |
6681 default: |
6671 case 8: |
6682 case 8: |
6672 resultArray[7] = __MKSMALLINT(directionReturn); |
6683 resultArray[7] = __MKSMALLINT(directionReturn); |
6673 case 7: |
6684 case 7: |
6674 resultArray[6] = __MKSMALLINT(fontDescentReturn); |
6685 resultArray[6] = __MKSMALLINT(fontDescentReturn); |
6675 case 6: |
6686 case 6: |
6676 resultArray[5] = __MKSMALLINT(fontAscentReturn); |
6687 resultArray[5] = __MKSMALLINT(fontAscentReturn); |
6677 case 5: |
6688 case 5: |
6678 resultArray[4] = __MKSMALLINT(overAllReturn.descent); |
6689 resultArray[4] = __MKSMALLINT(overAllReturn.descent); |
6679 case 4: |
6690 case 4: |
6680 resultArray[3] = __MKSMALLINT(overAllReturn.ascent); |
6691 resultArray[3] = __MKSMALLINT(overAllReturn.ascent); |
6681 case 3: |
6692 case 3: |
6682 resultArray[2] = __MKSMALLINT(overAllReturn.width); |
6693 resultArray[2] = __MKSMALLINT(overAllReturn.width); |
6683 case 2: |
6694 case 2: |
6684 resultArray[1] = __MKSMALLINT(overAllReturn.rbearing); |
6695 resultArray[1] = __MKSMALLINT(overAllReturn.rbearing); |
6685 case 1: |
6696 case 1: |
6686 resultArray[0] = __MKSMALLINT(overAllReturn.lbearing); |
6697 resultArray[0] = __MKSMALLINT(overAllReturn.lbearing); |
6687 case 0: |
6698 case 0: |
6688 break; |
6699 break; |
6689 } |
6700 } |
6690 } |
6701 } |
6691 RETURN ( __MKSMALLINT(overAllReturn.width) ); |
6702 RETURN ( __MKSMALLINT(overAllReturn.width) ); |
6692 } |
6703 } |
6693 } |
6704 } |
6694 #undef NLOCALBUFFER |
6705 #undef NLOCALBUFFER |
6695 fail: ; |
6706 fail: ; |
6696 %}. |
6707 %}. |
6697 self primitiveFailedOrClosedConnection. |
6708 self primitiveFailedOrClosedConnection. |
6699 |
6710 |
6700 " |
6711 " |
6701 |result| |
6712 |result| |
6702 result := Array new:8. |
6713 result := Array new:8. |
6703 Screen current |
6714 Screen current |
6704 extentsOf:'hello World' from:1 to:11 |
6715 extentsOf:'hello World' from:1 to:11 |
6705 inFont:(Screen current getFontWithFoundry:'*' |
6716 inFont:(Screen current getFontWithFoundry:'*' |
6706 family:'courier new' |
6717 family:'courier new' |
6707 weight:'medium' |
6718 weight:'medium' |
6708 slant:'r' |
6719 slant:'r' |
6709 spacing:nil |
6720 spacing:nil |
6710 pixelSize:nil |
6721 pixelSize:nil |
6711 size:10 |
6722 size:10 |
6712 encoding:#'iso10646-1' |
6723 encoding:#'iso10646-1' |
6713 ) |
6724 ) |
6714 into:result. |
6725 into:result. |
6715 |
6726 |
6716 result |
6727 result |
6717 " |
6728 " |
6718 ! |
6729 ! |
6719 |
6730 |
6724 This is pure magic ..." |
6735 This is pure magic ..." |
6725 |
6736 |
6726 |enc charSets| |
6737 |enc charSets| |
6727 |
6738 |
6728 (registry size ~~ 0) ifTrue:[ |
6739 (registry size ~~ 0) ifTrue:[ |
6729 enc := registry asLowercase. |
6740 enc := registry asLowercase. |
6730 encoding size ~~ 0 ifTrue:[ |
6741 encoding size ~~ 0 ifTrue:[ |
6731 enc := enc, '-', encoding asLowercase. |
6742 enc := enc, '-', encoding asLowercase. |
6732 ]. |
6743 ]. |
6733 enc := enc asSymbol. |
6744 enc := enc asSymbol. |
6734 ] ifFalse:[ |
6745 ] ifFalse:[ |
6735 (encoding size ~~ 0) ifTrue:[ |
6746 (encoding size ~~ 0) ifTrue:[ |
6736 enc := encoding asLowercase asSymbol |
6747 enc := encoding asLowercase asSymbol |
6737 ] ifFalse:[ |
6748 ] ifFalse:[ |
6738 charSets := charSetCollections. |
6749 charSets := charSetCollections. |
6739 (charSets notEmptyOrNil) ifTrue:[ |
6750 (charSets notEmptyOrNil) ifTrue:[ |
6740 charSets := charSets asUppercase asCollectionOfWords. |
6751 charSets := charSets asUppercase asCollectionOfWords. |
6741 (charSets includes:'ISO8859-1') ifTrue:[ |
6752 (charSets includes:'ISO8859-1') ifTrue:[ |
6742 enc := #'iso8859-1' |
6753 enc := #'iso8859-1' |
6743 ] ifFalse:[ |
6754 ] ifFalse:[ |
6744 (charSets includes:'ISO8859') ifTrue:[ |
6755 (charSets includes:'ISO8859') ifTrue:[ |
6745 enc := #iso8859 |
6756 enc := #iso8859 |
6746 ] ifFalse:[ |
6757 ] ifFalse:[ |
6747 (charSets includes:'ASCII') ifTrue:[ |
6758 (charSets includes:'ASCII') ifTrue:[ |
6748 enc := #ascii |
6759 enc := #ascii |
6749 ] ifFalse:[ |
6760 ] ifFalse:[ |
6750 (charSets includes:'ADOBE-STANDARD') ifTrue:[ |
6761 (charSets includes:'ADOBE-STANDARD') ifTrue:[ |
6751 enc := #iso8859 |
6762 enc := #iso8859 |
6752 ] |
6763 ] |
6753 ] |
6764 ] |
6754 ] |
6765 ] |
6755 ] |
6766 ] |
6756 ] |
6767 ] |
6757 ] |
6768 ] |
6758 ]. |
6769 ]. |
6759 ^ enc |
6770 ^ enc |
6760 |
6771 |
6761 "Created: 17.4.1996 / 14:57:06 / cg" |
6772 "Created: 17.4.1996 / 14:57:06 / cg" |
6762 "Modified: 17.4.1996 / 17:22:35 / cg" |
6773 "Modified: 17.4.1996 / 17:22:35 / cg" |
6788 resX resY registry encoding coding fields| |
6799 resX resY registry encoding coding fields| |
6789 |
6800 |
6790 aFontNameString isNil ifTrue:[^ nil]. |
6801 aFontNameString isNil ifTrue:[^ nil]. |
6791 |
6802 |
6792 Error handle:[:ex | |
6803 Error handle:[:ex | |
6793 family := nil. |
6804 family := nil. |
6794 ] do:[ |
6805 ] do:[ |
6795 fields := aFontNameString asCollectionOfSubstringsSeparatedBy:$-. |
6806 fields := aFontNameString asCollectionOfSubstringsSeparatedBy:$-. |
6796 fields size == 3 ifTrue:[ |
6807 fields size == 3 ifTrue:[ |
6797 "take care of old font names: family-style-size" |
6808 "take care of old font names: family-style-size" |
6798 family := fields at:1. |
6809 family := fields at:1. |
6799 style := fields at:2. |
6810 style := fields at:2. |
6800 size := Number readFromString:(fields at:3). |
6811 size := Number readFromString:(fields at:3). |
6801 ] ifFalse:[ |
6812 ] ifFalse:[ |
6802 fields size == 2 ifTrue:[ |
6813 fields size == 2 ifTrue:[ |
6803 "take care of old font names: family-size" |
6814 "take care of old font names: family-size" |
6804 family := fields at:1. |
6815 family := fields at:1. |
6805 size := Number readFromString:(fields at:2). |
6816 size := Number readFromString:(fields at:2). |
6806 ] ifFalse:[ |
6817 ] ifFalse:[ |
6807 fields size >= 15 ifTrue:[ |
6818 fields size >= 15 ifTrue:[ |
6808 family := fields at:3. |
6819 family := fields at:3. |
6809 face := fields at:4. |
6820 face := fields at:4. |
6810 style := fields at:5. |
6821 style := fields at:5. |
6811 style = 'o' ifTrue:[ |
6822 style = 'o' ifTrue:[ |
6812 style := 'oblique' |
6823 style := 'oblique' |
6813 ] ifFalse:[style = 'i' ifTrue:[ |
6824 ] ifFalse:[style = 'i' ifTrue:[ |
6814 style := 'italic' |
6825 style := 'italic' |
6815 ] ifFalse:[style = 'r' ifTrue:[ |
6826 ] ifFalse:[style = 'r' ifTrue:[ |
6816 style := 'roman' |
6827 style := 'roman' |
6817 ]]]. |
6828 ]]]. |
6818 moreStyle := fields at:6. |
6829 moreStyle := fields at:6. |
6819 (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[ |
6830 (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[ |
6820 style := style, '-', moreStyle. |
6831 style := style, '-', moreStyle. |
6821 ]. |
6832 ]. |
6822 "/ pxlSize := (Integer readFromString:(fields at:8)). |
6833 "/ pxlSize := (Integer readFromString:(fields at:8)). |
6823 size := (Number readFromString:(fields at:9)) / 10. |
6834 size := (Number readFromString:(fields at:9)) / 10. |
6824 resX := fields at:10. |
6835 resX := fields at:10. |
6825 resY := fields at:11. |
6836 resY := fields at:11. |
6826 registry := fields at:14. |
6837 registry := fields at:14. |
6827 encoding := fields at:15. |
6838 encoding := fields at:15. |
6828 coding := registry , '-' , encoding. |
6839 coding := registry , '-' , encoding. |
6829 ] ifFalse:[ |
6840 ] ifFalse:[ |
6830 "/ very old name (such as cursor, 5x7 etc) |
6841 "/ very old name (such as cursor, 5x7 etc) |
6831 ] |
6842 ] |
6832 ] |
6843 ] |
6833 ]. |
6844 ]. |
6834 ]. |
6845 ]. |
6835 |
6846 |
6836 family notNil ifTrue:[ |
6847 family notNil ifTrue:[ |
6837 ^ FontDescription family:family face:face style:style size:size sizeUnit:#pt encoding:coding. |
6848 ^ FontDescription family:family face:face style:style size:size sizeUnit:#pt encoding:coding. |
6838 ]. |
6849 ]. |
6854 %{ /* UNLIMITEDSTACK */ |
6865 %{ /* UNLIMITEDSTACK */ |
6855 XFontStruct *f; |
6866 XFontStruct *f; |
6856 int len; |
6867 int len; |
6857 |
6868 |
6858 if (ISCONNECTED) { |
6869 if (ISCONNECTED) { |
6859 if (__isExternalAddress(fontId)) { |
6870 if (__isExternalAddress(fontId)) { |
6860 f = __FontVal(fontId); |
6871 f = __FontVal(fontId); |
6861 if (f) { |
6872 if (f) { |
6862 minCode = __MKUINT((f->min_byte1<<8) + f->min_char_or_byte2); |
6873 minCode = __MKUINT((f->min_byte1<<8) + f->min_char_or_byte2); |
6863 maxCode = __MKUINT((f->max_byte1<<8) + f->max_char_or_byte2); |
6874 maxCode = __MKUINT((f->max_byte1<<8) + f->max_char_or_byte2); |
6864 |
6875 |
6865 if (f->direction == FontLeftToRight) { |
6876 if (f->direction == FontLeftToRight) { |
6866 dir = @symbol(LeftToRight); |
6877 dir = @symbol(LeftToRight); |
6867 } else if (f->direction == FontRightToLeft) { |
6878 } else if (f->direction == FontRightToLeft) { |
6868 dir = @symbol(RightToLeft); |
6879 dir = @symbol(RightToLeft); |
6869 } |
6880 } |
6870 avgAscent = __MKSMALLINT(f->ascent); |
6881 avgAscent = __MKSMALLINT(f->ascent); |
6871 avgDescent = __MKSMALLINT(f->descent); |
6882 avgDescent = __MKSMALLINT(f->descent); |
6872 maxAscent = __MKSMALLINT(f->max_bounds.ascent); |
6883 maxAscent = __MKSMALLINT(f->max_bounds.ascent); |
6873 maxDescent = __MKSMALLINT(f->max_bounds.descent); |
6884 maxDescent = __MKSMALLINT(f->max_bounds.descent); |
6874 minWidth = __MKSMALLINT(f->min_bounds.width); |
6885 minWidth = __MKSMALLINT(f->min_bounds.width); |
6875 maxWidth = __MKSMALLINT(f->max_bounds.width); |
6886 maxWidth = __MKSMALLINT(f->max_bounds.width); |
6876 |
6887 |
6877 ENTER_XLIB(); |
6888 ENTER_XLIB(); |
6878 len = XTextWidth(f, "n", 1); |
6889 len = XTextWidth(f, "n", 1); |
6879 LEAVE_XLIB(); |
6890 LEAVE_XLIB(); |
6880 |
6891 |
6881 avgWidth = __MKSMALLINT( len ); |
6892 avgWidth = __MKSMALLINT( len ); |
6882 } |
6893 } |
6883 } |
6894 } |
6884 } |
6895 } |
6885 %}. |
6896 %}. |
6886 avgAscent == nil ifTrue:[ |
6897 avgAscent == nil ifTrue:[ |
6887 self primitiveFailedOrClosedConnection. |
6898 self primitiveFailedOrClosedConnection. |
6888 ^ nil |
6899 ^ nil |
6889 ]. |
6900 ]. |
6890 |
6901 |
6891 "DingBats font returns 0 for maxAscent/maxDescent" |
6902 "DingBats font returns 0 for maxAscent/maxDescent" |
6892 maxAscent := maxAscent max:avgAscent. |
6903 maxAscent := maxAscent max:avgAscent. |
6893 maxDescent := maxDescent max:avgDescent. |
6904 maxDescent := maxDescent max:avgDescent. |
6926 props := self fontPropertiesOf:aFontId. |
6937 props := self fontPropertiesOf:aFontId. |
6927 ^ propertyNames collect:[:propName | props at:propName ifAbsent:nil]. |
6938 ^ propertyNames collect:[:propName | props at:propName ifAbsent:nil]. |
6928 |
6939 |
6929 " |
6940 " |
6930 Screen current |
6941 Screen current |
6931 fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' RESOLUTION notExistant) |
6942 fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' RESOLUTION notExistant) |
6932 of:(Screen current getDefaultFontWithEncoding:#'iso10646-1') |
6943 of:(Screen current getDefaultFontWithEncoding:#'iso10646-1') |
6933 " |
6944 " |
6934 ! |
6945 ! |
6935 |
6946 |
6936 fontPropertiesOf:aFontId |
6947 fontPropertiesOf:aFontId |
6937 "Answer an array with all the properties of a font. |
6948 "Answer an array with all the properties of a font. |
6948 XFontProp *prop; |
6959 XFontProp *prop; |
6949 int n, i; |
6960 int n, i; |
6950 OBJ x; |
6961 OBJ x; |
6951 |
6962 |
6952 if (__isExternalAddress(aFontId)) { |
6963 if (__isExternalAddress(aFontId)) { |
6953 f = __FontVal(aFontId); |
6964 f = __FontVal(aFontId); |
6954 if (f && (prop = f->properties) != 0) { |
6965 if (f && (prop = f->properties) != 0) { |
6955 n = f->n_properties; |
6966 n = f->n_properties; |
6956 propsArray = __ARRAY_NEW_INT(n*2); |
6967 propsArray = __ARRAY_NEW_INT(n*2); |
6957 for (i = 0; n; n--, prop++) { |
6968 for (i = 0; n; n--, prop++) { |
6958 x = __MKUINT(prop->name); __ArrayInstPtr(propsArray)->a_element[i++] = x; __STORE(propsArray, x); |
6969 x = __MKUINT(prop->name); __ArrayInstPtr(propsArray)->a_element[i++] = x; __STORE(propsArray, x); |
6959 x = __MKUINT(prop->card32); __ArrayInstPtr(propsArray)->a_element[i++] = x; __STORE(propsArray, x); |
6970 x = __MKUINT(prop->card32); __ArrayInstPtr(propsArray)->a_element[i++] = x; __STORE(propsArray, x); |
6960 } |
6971 } |
6961 } |
6972 } |
6962 } |
6973 } |
6963 %}. |
6974 %}. |
6964 result := Dictionary new. |
6975 result := Dictionary new. |
6965 propsArray notNil ifTrue:[ |
6976 propsArray notNil ifTrue:[ |
6966 propsArray pairWiseDo:[:n :v | result at:(self atomName:n) put:v]. |
6977 propsArray pairWiseDo:[:n :v | result at:(self atomName:n) put:v]. |
6967 ]. |
6978 ]. |
6968 ^ result |
6979 ^ result |
6969 |
6980 |
6970 " |
6981 " |
6971 Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1') |
6982 Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1') |
6972 Dictionary withKeysAndValues:(Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')) |
6983 Dictionary withKeysAndValues:(Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')) |
6973 |
6984 |
6974 |d| |
6985 |d| |
6975 d := Dictionary new. |
6986 d := Dictionary new. |
6976 (Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')) keysAndValuesDo:[:name :value| |
6987 (Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')) keysAndValuesDo:[:name :value| |
6977 d at:name put:((Screen current atomName:value) ? value) |
6988 d at:name put:((Screen current atomName:value) ? value) |
6978 ]. |
6989 ]. |
6979 d |
6990 d |
6980 " |
6991 " |
6981 ! |
6992 ! |
6982 |
6993 |
6989 |
7000 |
6990 props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId. |
7001 props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId. |
6991 resX := props at:1. |
7002 resX := props at:1. |
6992 resY := props at:2. |
7003 resY := props at:2. |
6993 (resX notNil and:[resY notNil]) ifTrue:[ |
7004 (resX notNil and:[resY notNil]) ifTrue:[ |
6994 ^ resX @ resY |
7005 ^ resX @ resY |
6995 ]. |
7006 ]. |
6996 res := props at:3. |
7007 res := props at:3. |
6997 res notNil ifTrue:[ |
7008 res notNil ifTrue:[ |
6998 ^ res @ res |
7009 ^ res @ res |
6999 ]. |
7010 ]. |
7000 ^ self resolution |
7011 ^ self resolution |
7001 |
7012 |
7002 " |
7013 " |
7003 Screen current fontResolutionOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1') |
7014 Screen current fontResolutionOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1') |
7011 |
7022 |
7012 |props fullName| |
7023 |props fullName| |
7013 |
7024 |
7014 props := self fontPropertiesOf:aFontId. |
7025 props := self fontPropertiesOf:aFontId. |
7015 #('FONT' 'FONT_NAME' 'FULL_NAME' 'FULLNAME' ) do:[:try | |
7026 #('FONT' 'FONT_NAME' 'FULL_NAME' 'FULLNAME' ) do:[:try | |
7016 |fullNameID| |
7027 |fullNameID| |
7017 |
7028 |
7018 fullNameID := props at:try ifAbsent:nil. |
7029 fullNameID := props at:try ifAbsent:nil. |
7019 fullNameID notNil ifTrue:[ |
7030 fullNameID notNil ifTrue:[ |
7020 fullName := self atomName:fullNameID. |
7031 fullName := self atomName:fullNameID. |
7021 fullName notEmptyOrNil ifTrue:[ |
7032 fullName notEmptyOrNil ifTrue:[ |
7022 ^ fullName |
7033 ^ fullName |
7023 ]. |
7034 ]. |
7024 ] |
7035 ] |
7025 ]. |
7036 ]. |
7026 |
7037 |
7027 ^ nil. |
7038 ^ nil. |
7028 |
7039 |
7029 " |
7040 " |
7043 char **fonts; |
7054 char **fonts; |
7044 OBJ arr, str; |
7055 OBJ arr, str; |
7045 int i; |
7056 int i; |
7046 |
7057 |
7047 if (ISCONNECTED) { |
7058 if (ISCONNECTED) { |
7048 if (__isStringLike(pattern)) { |
7059 if (__isStringLike(pattern)) { |
7049 for (;;) { |
7060 for (;;) { |
7050 ENTER_XLIB(); |
7061 ENTER_XLIB(); |
7051 fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available); |
7062 fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available); |
7052 LEAVE_XLIB(); |
7063 LEAVE_XLIB(); |
7053 if (fonts == 0) RETURN(nil); |
7064 if (fonts == 0) RETURN(nil); |
7054 if (available < nnames) break; |
7065 if (available < nnames) break; |
7055 XFreeFontNames(fonts); |
7066 XFreeFontNames(fonts); |
7056 nnames = available * 2; |
7067 nnames = available * 2; |
7057 } |
7068 } |
7058 |
7069 |
7059 /* |
7070 /* |
7060 * now, that we know the number of font names, |
7071 * now, that we know the number of font names, |
7061 * create the array ... |
7072 * create the array ... |
7062 */ |
7073 */ |
7063 arr = __ARRAY_NEW_INT(available); |
7074 arr = __ARRAY_NEW_INT(available); |
7064 if (arr != nil) { |
7075 if (arr != nil) { |
7065 /* |
7076 /* |
7066 * ... and fill it |
7077 * ... and fill it |
7067 */ |
7078 */ |
7068 for (i=0; i<available; i++) { |
7079 for (i=0; i<available; i++) { |
7069 __PROTECT__(arr); |
7080 __PROTECT__(arr); |
7070 str = __MKSTRING(fonts[i]); |
7081 str = __MKSTRING(fonts[i]); |
7071 __UNPROTECT__(arr); |
7082 __UNPROTECT__(arr); |
7072 __ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str); |
7083 __ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str); |
7073 } |
7084 } |
7074 } |
7085 } |
7075 XFreeFontNames(fonts); |
7086 XFreeFontNames(fonts); |
7076 RETURN (arr); |
7087 RETURN (arr); |
7077 } |
7088 } |
7078 } |
7089 } |
7079 %}. |
7090 %}. |
7080 ^ nil |
7091 ^ nil |
7081 |
7092 |
7082 " |
7093 " |
7090 |
7101 |
7091 |id| |
7102 |id| |
7092 |
7103 |
7093 id := self createFontFor:'-misc-fixed-*-*-*-*-*-*-*-*-*-*-', encoding. |
7104 id := self createFontFor:'-misc-fixed-*-*-*-*-*-*-*-*-*-*-', encoding. |
7094 id isNil ifTrue:[ |
7105 id isNil ifTrue:[ |
7095 id := self createFontFor:'fixed' |
7106 id := self createFontFor:'fixed' |
7096 ]. |
7107 ]. |
7097 ^ id. |
7108 ^ id. |
7098 |
7109 |
7099 " |
7110 " |
7100 Screen current getDefaultFontWithEncoding:#'iso10646-1' |
7111 Screen current getDefaultFontWithEncoding:#'iso10646-1' |
7101 " |
7112 " |
7102 ! |
7113 ! |
7103 |
7114 |
7104 getFontWithFamily:familyString face:faceString |
7115 getFontWithFamily:familyString face:faceString |
7105 style:styleArgString size:sizeArgOrNil sizeUnit:sizeUnit encoding:encoding |
7116 style:styleArgString size:sizeArgOrNil sizeUnit:sizeUnit encoding:encoding |
7106 |
7117 |
7107 "try to get the specified font, if not available, try next smaller |
7118 "try to get the specified font, if not available, try next smaller |
7108 font. Access to X-fonts by name is possible, by passing the X font name |
7119 font. Access to X-fonts by name is possible, by passing the X font name |
7109 as family and the other parameters as nil. For example, the cursor font |
7120 as family and the other parameters as nil. For example, the cursor font |
7110 can be aquired that way." |
7121 can be aquired that way." |
7113 id spacing encodingMatch idx roundedSize pixelSize pointSize| |
7124 id spacing encodingMatch idx roundedSize pixelSize pointSize| |
7114 |
7125 |
7115 styleString := styleArgString. |
7126 styleString := styleArgString. |
7116 |
7127 |
7117 sizeArgOrNil notNil ifTrue:[ |
7128 sizeArgOrNil notNil ifTrue:[ |
7118 roundedSize := sizeArgOrNil rounded asInteger. |
7129 roundedSize := sizeArgOrNil rounded asInteger. |
7119 sizeUnit == #px ifTrue:[ |
7130 sizeUnit == #px ifTrue:[ |
7120 pixelSize := roundedSize. |
7131 pixelSize := roundedSize. |
7121 ] ifFalse:[ |
7132 ] ifFalse:[ |
7122 pointSize := roundedSize. |
7133 pointSize := roundedSize. |
7123 ]. |
7134 ]. |
7124 ]. |
7135 ]. |
7125 |
7136 |
7126 "special: if face is nil, allow access to X-fonts" |
7137 "special: if face is nil, allow access to X-fonts" |
7127 faceString isNil ifTrue:[ |
7138 faceString isNil ifTrue:[ |
7128 roundedSize notNil ifTrue:[ |
7139 roundedSize notNil ifTrue:[ |
7129 theName := familyString , '-' , roundedSize printString |
7140 theName := familyString , '-' , roundedSize printString |
7130 ] ifFalse:[ |
7141 ] ifFalse:[ |
7131 theName := familyString |
7142 theName := familyString |
7132 ]. |
7143 ]. |
7133 theName notNil ifTrue:[ |
7144 theName notNil ifTrue:[ |
7134 theId := self createFontFor:theName. |
7145 theId := self createFontFor:theName. |
7135 ]. |
7146 ]. |
7136 theId isNil ifTrue:[ |
7147 theId isNil ifTrue:[ |
7137 theId := self getDefaultFontWithEncoding:encoding |
7148 theId := self getDefaultFontWithEncoding:encoding |
7138 ]. |
7149 ]. |
7139 ^ theId |
7150 ^ theId |
7140 ]. |
7151 ]. |
7141 |
7152 |
7142 "/ spacing other than 'normal' is contained as last component |
7153 "/ spacing other than 'normal' is contained as last component |
7143 "/ in style |
7154 "/ in style |
7144 |
7155 |
7145 (styleString notNil |
7156 (styleString notNil |
7146 and:[(styleString endsWith:'-narrow') |
7157 and:[(styleString endsWith:'-narrow') |
7147 or:[styleString endsWith:'-semicondensed']]) ifTrue:[ |
7158 or:[styleString endsWith:'-semicondensed']]) ifTrue:[ |
7148 |i| |
7159 |i| |
7149 i := styleString lastIndexOf:$-. |
7160 i := styleString lastIndexOf:$-. |
7150 spacing := styleString copyFrom:(i+1). |
7161 spacing := styleString copyFrom:(i+1). |
7151 styleString := styleString copyTo:(i-1). |
7162 styleString := styleString copyTo:(i-1). |
7152 ] ifFalse:[ |
7163 ] ifFalse:[ |
7153 spacing := 'normal'. |
7164 spacing := 'normal'. |
7154 ]. |
7165 ]. |
7155 |
7166 |
7156 xlatedStyle := styleString. |
7167 xlatedStyle := styleString. |
7157 xlatedStyle notNil ifTrue:[ |
7168 xlatedStyle notNil ifTrue:[ |
7158 xlatedStyle := xlatedStyle first asString |
7169 xlatedStyle := xlatedStyle first asString |
7159 ]. |
7170 ]. |
7160 |
7171 |
7161 encoding isNil ifTrue:[ |
7172 encoding isNil ifTrue:[ |
7162 encodingMatch := '*-*'. |
7173 encodingMatch := '*-*'. |
7163 ] ifFalse:[ |
7174 ] ifFalse:[ |
7164 idx := encoding indexOf:$-. |
7175 idx := encoding indexOf:$-. |
7165 idx ~~ 0 ifTrue:[ |
7176 idx ~~ 0 ifTrue:[ |
7166 encodingMatch := encoding |
7177 encodingMatch := encoding |
7167 ] ifFalse:[ |
7178 ] ifFalse:[ |
7168 encodingMatch := encoding , '-*'. |
7179 encodingMatch := encoding , '-*'. |
7169 ]. |
7180 ]. |
7170 ]. |
7181 ]. |
7171 |
7182 |
7172 id := self |
7183 id := self |
7173 getFontWithFoundry:'*' |
7184 getFontWithFoundry:'*' |
7174 family:familyString asLowercase |
7185 family:familyString asLowercase |
7175 weight:faceString |
7186 weight:faceString |
7176 slant:xlatedStyle |
7187 slant:xlatedStyle |
7177 spacing:spacing |
7188 spacing:spacing |
7178 pixelSize:pixelSize |
7189 pixelSize:pixelSize |
7179 size:pointSize |
7190 size:pointSize |
7180 encoding:encodingMatch. |
7191 encoding:encodingMatch. |
7181 |
7192 |
7182 id isNil ifTrue:[ |
7193 id isNil ifTrue:[ |
7183 (encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[ |
7194 (encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[ |
7184 "/ too stupid: registries come in both cases |
7195 "/ too stupid: registries come in both cases |
7185 "/ and X does not ignore case |
7196 "/ and X does not ignore case |
7186 "/ |
7197 "/ |
7187 id := self |
7198 id := self |
7188 getFontWithFoundry:'*' |
7199 getFontWithFoundry:'*' |
7189 family:familyString asLowercase |
7200 family:familyString asLowercase |
7190 weight:faceString |
7201 weight:faceString |
7191 slant:xlatedStyle |
7202 slant:xlatedStyle |
7192 spacing:spacing |
7203 spacing:spacing |
7193 pixelSize:nil |
7204 pixelSize:nil |
7194 size:roundedSize |
7205 size:roundedSize |
7195 encoding:encodingMatch asUppercase. |
7206 encoding:encodingMatch asUppercase. |
7196 id isNil ifTrue:[ |
7207 id isNil ifTrue:[ |
7197 id := self |
7208 id := self |
7198 getFontWithFoundry:'*' |
7209 getFontWithFoundry:'*' |
7199 family:familyString asLowercase |
7210 family:familyString asLowercase |
7200 weight:faceString |
7211 weight:faceString |
7201 slant:xlatedStyle |
7212 slant:xlatedStyle |
7202 spacing:spacing |
7213 spacing:spacing |
7203 pixelSize:nil |
7214 pixelSize:nil |
7204 size:roundedSize |
7215 size:roundedSize |
7205 encoding:encodingMatch asLowercase. |
7216 encoding:encodingMatch asLowercase. |
7206 ] |
7217 ] |
7207 ] |
7218 ] |
7208 ]. |
7219 ]. |
7209 ^ id |
7220 ^ id |
7210 |
7221 |
7211 "Modified: 4.7.1996 / 11:38:47 / stefan" |
7222 "Modified: 4.7.1996 / 11:38:47 / stefan" |
7212 "Modified: 10.4.1997 / 19:20:06 / cg" |
7223 "Modified: 10.4.1997 / 19:20:06 / cg" |
7213 ! |
7224 ! |
7214 |
7225 |
7215 getFontWithFoundry:foundry family:family weight:weight |
7226 getFontWithFoundry:foundry family:family weight:weight |
7216 slant:slant spacing:spc pixelSize:pSize size:size |
7227 slant:slant spacing:spc pixelSize:pSize size:size |
7217 encoding:encoding |
7228 encoding:encoding |
7218 |
7229 |
7219 "get the specified font, if not available, return nil. |
7230 "get the specified font, if not available, return nil. |
7220 This is the new font creation method - all others will be changed to |
7231 This is the new font creation method - all others will be changed to |
7221 use this entry. |
7232 use this entry. |
7222 Individual attributes can be left empty (i.e. '') or nil to match any. |
7233 Individual attributes can be left empty (i.e. '') or nil to match any. |
7235 foundryMatch familyMatch weightMatch slantMatch spcMatch |
7246 foundryMatch familyMatch weightMatch slantMatch spcMatch |
7236 pSizeMatch encodingMatch| |
7247 pSizeMatch encodingMatch| |
7237 |
7248 |
7238 "this works only on 'Release >= 3' - X-servers" |
7249 "this works only on 'Release >= 3' - X-servers" |
7239 "name is: |
7250 "name is: |
7240 -foundry-family -weight -slant- |
7251 -foundry-family -weight -slant- |
7241 sony helvetica bold r |
7252 sony helvetica bold r |
7242 adobe courier medium i |
7253 adobe courier medium i |
7243 msic fixed o |
7254 msic fixed o |
7244 ... ... |
7255 ... ... |
7245 " |
7256 " |
7246 |
7257 |
7247 size isNil ifTrue:[ |
7258 size isNil ifTrue:[ |
7248 sizeMatch := '*' |
7259 sizeMatch := '*' |
7249 ] ifFalse:[ |
7260 ] ifFalse:[ |
7250 sizeMatch := size printString , '0' |
7261 sizeMatch := size printString , '0' |
7251 ]. |
7262 ]. |
7252 foundry isNil ifTrue:[ |
7263 foundry isNil ifTrue:[ |
7253 foundryMatch := '*' |
7264 foundryMatch := '*' |
7254 ] ifFalse:[ |
7265 ] ifFalse:[ |
7255 foundryMatch := foundry |
7266 foundryMatch := foundry |
7256 ]. |
7267 ]. |
7257 family isNil ifTrue:[ |
7268 family isNil ifTrue:[ |
7258 familyMatch := '*' |
7269 familyMatch := '*' |
7259 ] ifFalse:[ |
7270 ] ifFalse:[ |
7260 familyMatch := family |
7271 familyMatch := family |
7261 ]. |
7272 ]. |
7262 weight isNil ifTrue:[ |
7273 weight isNil ifTrue:[ |
7263 weightMatch := '*' |
7274 weightMatch := '*' |
7264 ] ifFalse:[ |
7275 ] ifFalse:[ |
7265 weightMatch := weight |
7276 weightMatch := weight |
7266 ]. |
7277 ]. |
7267 slant isNil ifTrue:[ |
7278 slant isNil ifTrue:[ |
7268 slantMatch := '*' |
7279 slantMatch := '*' |
7269 ] ifFalse:[ |
7280 ] ifFalse:[ |
7270 slantMatch := slant |
7281 slantMatch := slant |
7271 ]. |
7282 ]. |
7272 spc isNil ifTrue:[ |
7283 spc isNil ifTrue:[ |
7273 spcMatch := '*' |
7284 spcMatch := '*' |
7274 ] ifFalse:[ |
7285 ] ifFalse:[ |
7275 spcMatch := spc |
7286 spcMatch := spc |
7276 ]. |
7287 ]. |
7277 pSize isNil ifTrue:[ |
7288 pSize isNil ifTrue:[ |
7278 pSizeMatch := '*' |
7289 pSizeMatch := '*' |
7279 ] ifFalse:[ |
7290 ] ifFalse:[ |
7280 pSizeMatch := pSize printString |
7291 pSizeMatch := pSize printString |
7281 ]. |
7292 ]. |
7282 encoding isNil ifTrue:[ |
7293 encoding isNil ifTrue:[ |
7283 encodingMatch := '*' |
7294 encodingMatch := '*' |
7284 ] ifFalse:[ |
7295 ] ifFalse:[ |
7285 encodingMatch := encoding |
7296 encodingMatch := encoding |
7286 ]. |
7297 ]. |
7287 |
7298 |
7288 theName := ('-' , foundryMatch, |
7299 theName := ('-' , foundryMatch, |
7289 '-' , familyMatch, |
7300 '-' , familyMatch, |
7290 '-' , weightMatch , |
7301 '-' , weightMatch , |
7291 '-' , slantMatch , |
7302 '-' , slantMatch , |
7292 '-' , spcMatch , |
7303 '-' , spcMatch , |
7293 '-*' , |
7304 '-*' , |
7294 '-' , pSizeMatch , |
7305 '-' , pSizeMatch , |
7295 '-' , sizeMatch , |
7306 '-' , sizeMatch , |
7296 '-*-*-*-*' , |
7307 '-*-*-*-*' , |
7297 '-' , encodingMatch). |
7308 '-' , encodingMatch). |
7298 |
7309 |
7299 "/ Transcript showCR:theName; endEntry. |
7310 "/ Transcript showCR:theName; endEntry. |
7300 |
7311 |
7301 ^ self createFontFor:theName. |
7312 ^ self createFontFor:theName. |
7302 |
7313 |
7303 |
7314 |
7304 " |
7315 " |
7305 Display |
7316 Display |
7306 getFontWithFoundry:'*' |
7317 getFontWithFoundry:'*' |
7307 family:'courier' |
7318 family:'courier' |
7308 weight:'medium' |
7319 weight:'medium' |
7309 slant:'r' |
7320 slant:'r' |
7310 spacing:nil |
7321 spacing:nil |
7311 pixelSize:nil |
7322 pixelSize:nil |
7312 size:13 |
7323 size:13 |
7313 encoding:#'iso8859-1'. |
7324 encoding:#'iso8859-1'. |
7314 |
7325 |
7315 Display |
7326 Display |
7316 getFontWithFoundry:'*' |
7327 getFontWithFoundry:'*' |
7317 family:'courier' |
7328 family:'courier' |
7318 weight:'medium' |
7329 weight:'medium' |
7319 slant:'r' |
7330 slant:'r' |
7320 spacing:nil |
7331 spacing:nil |
7321 pixelSize:nil |
7332 pixelSize:nil |
7322 size:13 |
7333 size:13 |
7323 encoding:#'iso10646-1' |
7334 encoding:#'iso10646-1' |
7324 " |
7335 " |
7325 |
7336 |
7326 "Modified: 10.4.1997 / 19:15:44 / cg" |
7337 "Modified: 10.4.1997 / 19:15:44 / cg" |
7327 ! |
7338 ! |
7328 |
7339 |
7333 self extentsOf:aString from:index1 to:index2 inFont:aFontId into:resultArray. |
7344 self extentsOf:aString from:index1 to:index2 inFont:aFontId into:resultArray. |
7334 ^ (resultArray at:4) + (resultArray at:5). |
7345 ^ (resultArray at:4) + (resultArray at:5). |
7335 |
7346 |
7336 " |
7347 " |
7337 Screen current |
7348 Screen current |
7338 heightOf:'hello world' from:1 to:10 |
7349 heightOf:'hello world' from:1 to:10 |
7339 inFont:(Screen current getFontWithFoundry:'*' |
7350 inFont:(Screen current getFontWithFoundry:'*' |
7340 family:'courier new' |
7351 family:'courier new' |
7341 weight:'medium' |
7352 weight:'medium' |
7342 slant:'r' |
7353 slant:'r' |
7343 spacing:nil |
7354 spacing:nil |
7344 pixelSize:nil |
7355 pixelSize:nil |
7345 size:13 |
7356 size:13 |
7346 encoding:#'iso10646-1' |
7357 encoding:#'iso10646-1' |
7347 ). |
7358 ). |
7348 |
7359 |
7349 Screen current |
7360 Screen current |
7350 heightOf:'hello World gggÖÜ' from:1 to:15 |
7361 heightOf:'hello World gggÖÜ' from:1 to:15 |
7351 inFont:(Screen current getDefaultFontWithEncoding:#'iso10646-1') |
7362 inFont:(Screen current getDefaultFontWithEncoding:#'iso10646-1') |
7352 " |
7363 " |
7353 ! |
7364 ! |
7354 |
7365 |
7355 listOfAvailableFonts |
7366 listOfAvailableFonts |
7356 "return a list with all available fonts on this display. |
7367 "return a list with all available fonts on this display. |
7359 FontDescription." |
7370 FontDescription." |
7360 |
7371 |
7361 |names| |
7372 |names| |
7362 |
7373 |
7363 listOfXFonts isNil ifTrue:[ |
7374 listOfXFonts isNil ifTrue:[ |
7364 names := self getAvailableFontsMatching:'*'. |
7375 names := self getAvailableFontsMatching:'*'. |
7365 names isNil ifTrue:[ |
7376 names isNil ifTrue:[ |
7366 "no names returned ..." |
7377 "no names returned ..." |
7367 ^ nil |
7378 ^ nil |
7368 ]. |
7379 ]. |
7369 listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName]. |
7380 listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName]. |
7370 listOfXFonts := FontDescription genericFonts, listOfXFonts. |
7381 listOfXFonts := FontDescription genericFonts, listOfXFonts. |
7371 ]. |
7382 ]. |
7372 ^ listOfXFonts |
7383 ^ listOfXFonts |
7373 |
7384 |
7374 " |
7385 " |
7375 Display flushListOfAvailableFonts. |
7386 Display flushListOfAvailableFonts. |
7391 |
7402 |
7392 |sizes| |
7403 |sizes| |
7393 |
7404 |
7394 sizes := super pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
7405 sizes := super pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
7395 (sizes notNil and:[sizes isEmpty or:[sizes includes:0]]) ifTrue:[ |
7406 (sizes notNil and:[sizes isEmpty or:[sizes includes:0]]) ifTrue:[ |
7396 "special: in X11R5 and above, size 0 means: |
7407 "special: in X11R5 and above, size 0 means: |
7397 there are scaled versions in all sizes available" |
7408 there are scaled versions in all sizes available" |
7398 |
7409 |
7399 ^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288) |
7410 ^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288) |
7400 ]. |
7411 ]. |
7401 ^ sizes |
7412 ^ sizes |
7402 |
7413 |
7403 " |
7414 " |
7404 Display pixelSizesInFamily:'courier' face:'bold' style:'roman' filtering:nil |
7415 Display pixelSizesInFamily:'courier' face:'bold' style:'roman' filtering:nil |
7415 |
7426 |
7416 /* |
7427 /* |
7417 * ignore closed connection |
7428 * ignore closed connection |
7418 */ |
7429 */ |
7419 if (! ISCONNECTED) { |
7430 if (! ISCONNECTED) { |
7420 RETURN ( self ); |
7431 RETURN ( self ); |
7421 } |
7432 } |
7422 |
7433 |
7423 if (__isExternalAddress(aFontId)) { |
7434 if (__isExternalAddress(aFontId)) { |
7424 f = __FontVal(aFontId); |
7435 f = __FontVal(aFontId); |
7425 if (f) { |
7436 if (f) { |
7426 |
7437 |
7427 ENTER_XLIB(); |
7438 ENTER_XLIB(); |
7428 XFreeFont(myDpy, f); |
7439 XFreeFont(myDpy, f); |
7429 LEAVE_XLIB(); |
7440 LEAVE_XLIB(); |
7430 #ifdef COUNT_RESOURCES |
7441 #ifdef COUNT_RESOURCES |
7431 __cnt_font--; |
7442 __cnt_font--; |
7432 #endif |
7443 #endif |
7433 } |
7444 } |
7434 RETURN ( self ); |
7445 RETURN ( self ); |
7435 } |
7446 } |
7436 %}. |
7447 %}. |
7437 self primitiveFailed |
7448 self primitiveFailed |
7438 ! |
7449 ! |
7439 |
7450 |
7444 |
7455 |
7445 |sizes| |
7456 |sizes| |
7446 |
7457 |
7447 sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
7458 sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
7448 (sizes notNil and:[sizes includes:0]) ifTrue:[ |
7459 (sizes notNil and:[sizes includes:0]) ifTrue:[ |
7449 "special: in X11R5 and above, size 0 means: |
7460 "special: in X11R5 and above, size 0 means: |
7450 there are scaled versions in all sizes available" |
7461 there are scaled versions in all sizes available" |
7451 |
7462 |
7452 ^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288) |
7463 ^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288) |
7453 ]. |
7464 ]. |
7454 ^ sizes |
7465 ^ sizes |
7455 |
7466 |
7456 " |
7467 " |
7457 Display sizesInFamily:'courier' face:'bold' style:'roman' filtering:nil |
7468 Display sizesInFamily:'courier' face:'bold' style:'roman' filtering:nil |
7474 int nInstBytes; |
7485 int nInstBytes; |
7475 int directionReturn, fontAscentReturn, fontDescentReturn; |
7486 int directionReturn, fontAscentReturn, fontDescentReturn; |
7476 XCharStruct overAllReturn; |
7487 XCharStruct overAllReturn; |
7477 |
7488 |
7478 if (ISCONNECTED) { |
7489 if (ISCONNECTED) { |
7479 if (__bothSmallInteger(index1, index2) |
7490 if (__bothSmallInteger(index1, index2) |
7480 && __isExternalAddress(aFontId) |
7491 && __isExternalAddress(aFontId) |
7481 && __isNonNilObject(aString)) { |
7492 && __isNonNilObject(aString)) { |
7482 int lMax = __intVal(@global(MaxStringLength)); |
7493 int lMax = __intVal(@global(MaxStringLength)); |
7483 f = __FontVal(aFontId); |
7494 f = __FontVal(aFontId); |
7484 if (! f) goto fail; |
7495 if (! f) goto fail; |
7485 |
7496 |
7486 i1 = __intVal(index1) - 1; |
7497 i1 = __intVal(index1) - 1; |
7487 |
7498 |
7488 if (i1 >= 0) { |
7499 if (i1 >= 0) { |
7489 OBJ cls; |
7500 OBJ cls; |
7490 |
7501 |
7491 i2 = __intVal(index2) - 1; |
7502 i2 = __intVal(index2) - 1; |
7492 if (i2 < i1) { |
7503 if (i2 < i1) { |
7493 RETURN ( __MKSMALLINT(0) ); |
7504 RETURN ( __MKSMALLINT(0) ); |
7494 } |
7505 } |
7495 |
7506 |
7496 cp = (char *) __stringVal(aString); |
7507 cp = (char *) __stringVal(aString); |
7497 l = i2 - i1 + 1; |
7508 l = i2 - i1 + 1; |
7498 |
7509 |
7499 if (__isStringLike(aString)) { |
7510 if (__isStringLike(aString)) { |
7500 n = __stringSize(aString); |
7511 n = __stringSize(aString); |
7501 if (i2 < n) { |
7512 if (i2 < n) { |
7502 cp += i1; |
7513 cp += i1; |
7503 |
7514 |
7504 #if 1 |
7515 #if 1 |
7505 len = XTextExtents(f, cp, l, |
7516 len = XTextExtents(f, cp, l, |
7506 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
7517 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
7507 &overAllReturn); |
7518 &overAllReturn); |
7508 //console_printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width); |
7519 //console_printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width); |
7509 RETURN ( __MKSMALLINT(overAllReturn.width) ); |
7520 RETURN ( __MKSMALLINT(overAllReturn.width) ); |
7510 #else |
7521 #else |
7511 ENTER_XLIB(); |
7522 ENTER_XLIB(); |
7512 len = XTextWidth(f, cp, l); |
7523 len = XTextWidth(f, cp, l); |
7513 LEAVE_XLIB(); |
7524 LEAVE_XLIB(); |
7514 RETURN ( __MKSMALLINT(len) ); |
7525 RETURN ( __MKSMALLINT(len) ); |
7515 #endif |
7526 #endif |
7516 } |
7527 } |
7517 } |
7528 } |
7518 |
7529 |
7519 cls = __qClass(aString); |
7530 cls = __qClass(aString); |
7520 nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
7531 nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
7521 cp += nInstBytes; |
7532 cp += nInstBytes; |
7522 |
7533 |
7523 if (__isBytes(aString)) { |
7534 if (__isBytes(aString)) { |
7524 n = __byteArraySize(aString) - nInstBytes; |
7535 n = __byteArraySize(aString) - nInstBytes; |
7525 if (i2 < n) { |
7536 if (i2 < n) { |
7526 cp += i1; |
7537 cp += i1; |
7527 |
7538 |
7528 #if 1 |
7539 #if 1 |
7529 len = XTextExtents(f, cp, l, |
7540 len = XTextExtents(f, cp, l, |
7530 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
7541 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
7531 &overAllReturn); |
7542 &overAllReturn); |
7532 RETURN ( __MKSMALLINT(overAllReturn.width) ); |
7543 RETURN ( __MKSMALLINT(overAllReturn.width) ); |
7533 #else |
7544 #else |
7534 ENTER_XLIB(); |
7545 ENTER_XLIB(); |
7535 len = XTextWidth(f, cp, l); |
7546 len = XTextWidth(f, cp, l); |
7536 LEAVE_XLIB(); |
7547 LEAVE_XLIB(); |
7537 RETURN ( __MKSMALLINT(len) ); |
7548 RETURN ( __MKSMALLINT(len) ); |
7538 #endif |
7549 #endif |
7539 } |
7550 } |
7540 } |
7551 } |
7541 |
7552 |
7542 /* TWOBYTESTRINGS */ |
7553 /* TWOBYTESTRINGS */ |
7543 if (__isWords(aString)) { |
7554 if (__isWords(aString)) { |
7544 n = (__byteArraySize(aString) - nInstBytes) / 2; |
7555 n = (__byteArraySize(aString) - nInstBytes) / 2; |
7545 |
7556 |
7546 if (i2 < n) { |
7557 if (i2 < n) { |
7547 union { |
7558 union { |
7548 char b[2]; |
7559 char b[2]; |
7549 unsigned short s; |
7560 unsigned short s; |
7550 } u; |
7561 } u; |
7551 int i; |
7562 int i; |
7552 XChar2b *cp2 = (XChar2b *)0; |
7563 XChar2b *cp2 = (XChar2b *)0; |
7553 int mustFree = 0; |
7564 int mustFree = 0; |
7554 |
7565 |
7555 cp += (i1 * 2); |
7566 cp += (i1 * 2); |
7556 if (l > lMax) l = lMax; |
7567 if (l > lMax) l = lMax; |
7557 |
7568 |
7558 /* |
7569 /* |
7559 * ST/X TwoByteStrings store the asciiValue in native byteOrder; |
7570 * ST/X TwoByteStrings store the asciiValue in native byteOrder; |
7560 * X expects them MSB first |
7571 * X expects them MSB first |
7561 * convert as required |
7572 * convert as required |
7562 */ |
7573 */ |
7563 |
7574 |
7564 u.s = 0x1234; |
7575 u.s = 0x1234; |
7565 if (u.b[0] != 0x12) { |
7576 if (u.b[0] != 0x12) { |
7566 if (l <= NLOCALBUFFER) { |
7577 if (l <= NLOCALBUFFER) { |
7567 cp2 = xlatebuffer; |
7578 cp2 = xlatebuffer; |
7568 } else { |
7579 } else { |
7569 cp2 = (XChar2b *)(malloc(l * 2)); |
7580 cp2 = (XChar2b *)(malloc(l * 2)); |
7570 mustFree = 1; |
7581 mustFree = 1; |
7571 } |
7582 } |
7572 for (i=0; i<l; i++) { |
7583 for (i=0; i<l; i++) { |
7573 cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
7584 cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
7574 cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
7585 cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
7575 } |
7586 } |
7576 cp = (char *) cp2; |
7587 cp = (char *) cp2; |
7577 } |
7588 } |
7578 |
7589 |
7579 #if 1 |
7590 #if 1 |
7580 len = XTextExtents16(f, (XChar2b *)cp, l, |
7591 len = XTextExtents16(f, (XChar2b *)cp, l, |
7581 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
7592 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
7582 &overAllReturn); |
7593 &overAllReturn); |
7583 len = overAllReturn.width; |
7594 len = overAllReturn.width; |
7584 #else |
7595 #else |
7585 ENTER_XLIB(); |
7596 ENTER_XLIB(); |
7586 len = XTextWidth16(f, (XChar2b *)cp, l); |
7597 len = XTextWidth16(f, (XChar2b *)cp, l); |
7587 LEAVE_XLIB(); |
7598 LEAVE_XLIB(); |
7588 #endif |
7599 #endif |
7589 |
7600 |
7590 if (mustFree) { |
7601 if (mustFree) { |
7591 free(cp2); |
7602 free(cp2); |
7592 } |
7603 } |
7593 |
7604 |
7594 RETURN ( __MKSMALLINT(len) ); |
7605 RETURN ( __MKSMALLINT(len) ); |
7595 } |
7606 } |
7596 } |
7607 } |
7597 /* FOURBYTESTRINGS */ |
7608 /* FOURBYTESTRINGS */ |
7598 if (__isLongs(aString)) { |
7609 if (__isLongs(aString)) { |
7599 int i; |
7610 int i; |
7600 XChar2b *cp2; |
7611 XChar2b *cp2; |
7601 int mustFree = 0; |
7612 int mustFree = 0; |
7602 |
7613 |
7603 n = (__byteArraySize(aString) - nInstBytes) / 4; |
7614 n = (__byteArraySize(aString) - nInstBytes) / 4; |
7604 if (i2 < n) { |
7615 if (i2 < n) { |
7605 union { |
7616 union { |
7606 char b[2]; |
7617 char b[2]; |
7607 unsigned short s; |
7618 unsigned short s; |
7608 } u; |
7619 } u; |
7609 int i; |
7620 int i; |
7610 XChar2b *cp2 = (XChar2b *)0; |
7621 XChar2b *cp2 = (XChar2b *)0; |
7611 int mustFree = 0; |
7622 int mustFree = 0; |
7612 |
7623 |
7613 cp += (i1 * 4); |
7624 cp += (i1 * 4); |
7614 if (l > lMax) l = lMax; |
7625 if (l > lMax) l = lMax; |
7615 |
7626 |
7616 /* |
7627 /* |
7617 * For now: X does not support 32bit characters without the new 32Unicode extensions. |
7628 * For now: X does not support 32bit characters without the new 32Unicode extensions. |
7618 * For now, treat chars above 0xFFFF as 0xFFFF (should we use default-char ?). |
7629 * For now, treat chars above 0xFFFF as 0xFFFF (should we use default-char ?). |
7619 */ |
7630 */ |
7620 if (l <= NLOCALBUFFER) { |
7631 if (l <= NLOCALBUFFER) { |
7621 cp2 = xlatebuffer; |
7632 cp2 = xlatebuffer; |
7622 } else { |
7633 } else { |
7623 cp2 = (XChar2b *)(malloc(l * 2)); |
7634 cp2 = (XChar2b *)(malloc(l * 2)); |
7624 mustFree = 1; |
7635 mustFree = 1; |
7625 } |
7636 } |
7626 for (i=0; i<l; i++) { |
7637 for (i=0; i<l; i++) { |
7627 int codePoint; |
7638 int codePoint; |
7628 |
7639 |
7629 codePoint = ((unsigned int32 *)cp)[i]; |
7640 codePoint = ((unsigned int32 *)cp)[i]; |
7630 if (codePoint > 0xFFFF) { |
7641 if (codePoint > 0xFFFF) { |
7631 codePoint = 0xFFFF; |
7642 codePoint = 0xFFFF; |
7632 } |
7643 } |
7633 cp2[i].byte1 = codePoint & 0xFF; |
7644 cp2[i].byte1 = codePoint & 0xFF; |
7634 cp2[i].byte2 = (codePoint >> 8) & 0xFF;; |
7645 cp2[i].byte2 = (codePoint >> 8) & 0xFF;; |
7635 } |
7646 } |
7636 cp = (char *) cp2; |
7647 cp = (char *) cp2; |
7637 |
7648 |
7638 #if 1 |
7649 #if 1 |
7639 len = XTextExtents16(f, (XChar2b *)cp, l, |
7650 len = XTextExtents16(f, (XChar2b *)cp, l, |
7640 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
7651 &directionReturn, &fontAscentReturn, &fontDescentReturn, |
7641 &overAllReturn); |
7652 &overAllReturn); |
7642 len = overAllReturn.width; |
7653 len = overAllReturn.width; |
7643 #else |
7654 #else |
7644 ENTER_XLIB(); |
7655 ENTER_XLIB(); |
7645 len = XTextWidth16(f, (XChar2b *)cp, l); |
7656 len = XTextWidth16(f, (XChar2b *)cp, l); |
7646 LEAVE_XLIB(); |
7657 LEAVE_XLIB(); |
7647 #endif |
7658 #endif |
7648 |
7659 |
7649 if (mustFree) { |
7660 if (mustFree) { |
7650 free(cp2); |
7661 free(cp2); |
7651 } |
7662 } |
7652 |
7663 |
7653 RETURN ( __MKSMALLINT(len) ); |
7664 RETURN ( __MKSMALLINT(len) ); |
7654 } |
7665 } |
7655 } |
7666 } |
7656 } |
7667 } |
7657 } |
7668 } |
7658 } |
7669 } |
7659 #undef NLOCALBUFFER |
7670 #undef NLOCALBUFFER |
7660 fail: ; |
7671 fail: ; |
7661 %}. |
7672 %}. |
7662 self primitiveFailedOrClosedConnection. |
7673 self primitiveFailedOrClosedConnection. |
7670 %{ |
7681 %{ |
7671 |
7682 |
7672 int _mode, ok = 1; |
7683 int _mode, ok = 1; |
7673 |
7684 |
7674 if (mode == @symbol(asyncPointer)) |
7685 if (mode == @symbol(asyncPointer)) |
7675 _mode = AsyncPointer; |
7686 _mode = AsyncPointer; |
7676 else if (mode == @symbol(syncPointer)) |
7687 else if (mode == @symbol(syncPointer)) |
7677 _mode = SyncPointer; |
7688 _mode = SyncPointer; |
7678 else if (mode == @symbol(asyncKeyboard)) |
7689 else if (mode == @symbol(asyncKeyboard)) |
7679 _mode = AsyncKeyboard; |
7690 _mode = AsyncKeyboard; |
7680 else if (mode == @symbol(syncKeyboard)) |
7691 else if (mode == @symbol(syncKeyboard)) |
7681 _mode = SyncKeyboard; |
7692 _mode = SyncKeyboard; |
7682 else if (mode == @symbol(syncBoth)) |
7693 else if (mode == @symbol(syncBoth)) |
7683 _mode = SyncBoth; |
7694 _mode = SyncBoth; |
7684 else if (mode == @symbol(asyncBoth)) |
7695 else if (mode == @symbol(asyncBoth)) |
7685 _mode = AsyncBoth; |
7696 _mode = AsyncBoth; |
7686 else if (mode == @symbol(replayPointer)) |
7697 else if (mode == @symbol(replayPointer)) |
7687 _mode = ReplayPointer; |
7698 _mode = ReplayPointer; |
7688 else if (mode == @symbol(replayKeyboard)) |
7699 else if (mode == @symbol(replayKeyboard)) |
7689 _mode = ReplayKeyboard; |
7700 _mode = ReplayKeyboard; |
7690 else |
7701 else |
7691 ok = 0; |
7702 ok = 0; |
7692 |
7703 |
7693 if (ok |
7704 if (ok |
7694 && ISCONNECTED) { |
7705 && ISCONNECTED) { |
7695 ENTER_XLIB(); |
7706 ENTER_XLIB(); |
7696 XAllowEvents(myDpy, _mode, CurrentTime); |
7707 XAllowEvents(myDpy, _mode, CurrentTime); |
7697 LEAVE_XLIB(); |
7708 LEAVE_XLIB(); |
7698 |
7709 |
7699 RETURN (self); |
7710 RETURN (self); |
7700 } |
7711 } |
7701 %}. |
7712 %}. |
7702 self primitiveFailedOrClosedConnection |
7713 self primitiveFailedOrClosedConnection |
7703 ! |
7714 ! |
7704 |
7715 |
7708 <context: #return> |
7719 <context: #return> |
7709 %{ |
7720 %{ |
7710 int result, ok; |
7721 int result, ok; |
7711 |
7722 |
7712 if (ISCONNECTED) { |
7723 if (ISCONNECTED) { |
7713 if (__isExternalAddress(aWindowId)) { |
7724 if (__isExternalAddress(aWindowId)) { |
7714 |
7725 |
7715 ENTER_XLIB(); |
7726 ENTER_XLIB(); |
7716 result = XGrabKeyboard(myDpy, |
7727 result = XGrabKeyboard(myDpy, |
7717 __WindowVal(aWindowId), |
7728 __WindowVal(aWindowId), |
7718 True /* False */, |
7729 True /* False */, |
7719 GrabModeAsync, |
7730 GrabModeAsync, |
7720 GrabModeAsync, |
7731 GrabModeAsync, |
7721 CurrentTime); |
7732 CurrentTime); |
7722 LEAVE_XLIB(); |
7733 LEAVE_XLIB(); |
7723 |
7734 |
7724 ok = 0; |
7735 ok = 0; |
7725 switch(result) { |
7736 switch(result) { |
7726 case AlreadyGrabbed: |
7737 case AlreadyGrabbed: |
7727 if (@global(ErrorPrinting) == true) { |
7738 if (@global(ErrorPrinting) == true) { |
7728 console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n"); |
7739 console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n"); |
7729 } |
7740 } |
7730 break; |
7741 break; |
7731 case GrabNotViewable: |
7742 case GrabNotViewable: |
7732 if (@global(ErrorPrinting) == true) { |
7743 if (@global(ErrorPrinting) == true) { |
7733 console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n"); |
7744 console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n"); |
7734 } |
7745 } |
7735 break; |
7746 break; |
7736 case GrabInvalidTime: |
7747 case GrabInvalidTime: |
7737 if (@global(ErrorPrinting) == true) { |
7748 if (@global(ErrorPrinting) == true) { |
7738 console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n"); |
7749 console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n"); |
7739 } |
7750 } |
7740 break; |
7751 break; |
7741 case GrabFrozen: |
7752 case GrabFrozen: |
7742 if (@global(ErrorPrinting) == true) { |
7753 if (@global(ErrorPrinting) == true) { |
7743 console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n"); |
7754 console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n"); |
7744 } |
7755 } |
7745 break; |
7756 break; |
7746 default: |
7757 default: |
7747 ok = 1; |
7758 ok = 1; |
7748 break; |
7759 break; |
7749 } |
7760 } |
7750 if (! ok) { |
7761 if (! ok) { |
7751 ENTER_XLIB(); |
7762 ENTER_XLIB(); |
7752 XUngrabKeyboard(myDpy, CurrentTime); |
7763 XUngrabKeyboard(myDpy, CurrentTime); |
7753 LEAVE_XLIB(); |
7764 LEAVE_XLIB(); |
7754 RETURN (false); |
7765 RETURN (false); |
7755 } |
7766 } |
7756 |
7767 |
7757 RETURN ( true ); |
7768 RETURN ( true ); |
7758 } |
7769 } |
7759 } |
7770 } |
7760 %}. |
7771 %}. |
7761 self primitiveFailedOrClosedConnection. |
7772 self primitiveFailedOrClosedConnection. |
7762 ^ false |
7773 ^ false |
7763 ! |
7774 ! |
7772 Window confineWin; |
7783 Window confineWin; |
7773 Cursor curs; |
7784 Cursor curs; |
7774 int pointer_mode, keyboard_mode; |
7785 int pointer_mode, keyboard_mode; |
7775 |
7786 |
7776 if (ISCONNECTED) { |
7787 if (ISCONNECTED) { |
7777 if (__isExternalAddress(aWindowId)) { |
7788 if (__isExternalAddress(aWindowId)) { |
7778 if (__isExternalAddress(confineId)) |
7789 if (__isExternalAddress(confineId)) |
7779 confineWin = __WindowVal(confineId); |
7790 confineWin = __WindowVal(confineId); |
7780 else |
7791 else |
7781 confineWin = (Window) None; |
7792 confineWin = (Window) None; |
7782 |
7793 |
7783 if (__isExternalAddress(aCursorId)) |
7794 if (__isExternalAddress(aCursorId)) |
7784 curs = __CursorVal(aCursorId); |
7795 curs = __CursorVal(aCursorId); |
7785 else |
7796 else |
7786 curs = (Cursor) None; |
7797 curs = (Cursor) None; |
7787 |
7798 |
7788 if (pMode == @symbol(sync)) |
7799 if (pMode == @symbol(sync)) |
7789 pointer_mode = GrabModeSync; |
7800 pointer_mode = GrabModeSync; |
7790 else |
7801 else |
7791 pointer_mode = GrabModeAsync; |
7802 pointer_mode = GrabModeAsync; |
7792 |
7803 |
7793 if (kMode == @symbol(sync)) |
7804 if (kMode == @symbol(sync)) |
7794 keyboard_mode = GrabModeSync; |
7805 keyboard_mode = GrabModeSync; |
7795 else |
7806 else |
7796 keyboard_mode = GrabModeAsync; |
7807 keyboard_mode = GrabModeAsync; |
7797 |
7808 |
7798 if (__isSmallInteger(eventMask)) |
7809 if (__isSmallInteger(eventMask)) |
7799 evMask = __intVal(eventMask); |
7810 evMask = __intVal(eventMask); |
7800 else |
7811 else |
7801 evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask; |
7812 evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask; |
7802 |
7813 |
7803 |
7814 |
7804 /* |
7815 /* |
7805 ENTER_XLIB(); |
7816 ENTER_XLIB(); |
7806 */ |
7817 */ |
7807 result = XGrabPointer(myDpy, |
7818 result = XGrabPointer(myDpy, |
7808 __WindowVal(aWindowId), |
7819 __WindowVal(aWindowId), |
7809 False, |
7820 False, |
7810 evMask, |
7821 evMask, |
7811 pointer_mode, keyboard_mode, |
7822 pointer_mode, keyboard_mode, |
7812 confineWin, |
7823 confineWin, |
7813 curs, |
7824 curs, |
7814 CurrentTime); |
7825 CurrentTime); |
7815 /* |
7826 /* |
7816 LEAVE_XLIB(); |
7827 LEAVE_XLIB(); |
7817 */ |
7828 */ |
7818 |
7829 |
7819 |
7830 |
7820 ok = 0; |
7831 ok = 0; |
7821 switch (result) { |
7832 switch (result) { |
7822 case AlreadyGrabbed: |
7833 case AlreadyGrabbed: |
7823 if (@global(ErrorPrinting) == true) { |
7834 if (@global(ErrorPrinting) == true) { |
7824 console_fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n"); |
7835 console_fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n"); |
7825 } |
7836 } |
7826 break; |
7837 break; |
7827 case GrabNotViewable: |
7838 case GrabNotViewable: |
7828 if (@global(ErrorPrinting) == true) { |
7839 if (@global(ErrorPrinting) == true) { |
7829 console_fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n"); |
7840 console_fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n"); |
7830 } |
7841 } |
7831 break; |
7842 break; |
7832 case GrabInvalidTime: |
7843 case GrabInvalidTime: |
7833 if (@global(ErrorPrinting) == true) { |
7844 if (@global(ErrorPrinting) == true) { |
7834 console_fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n"); |
7845 console_fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n"); |
7835 } |
7846 } |
7836 break; |
7847 break; |
7837 case GrabFrozen: |
7848 case GrabFrozen: |
7838 if (@global(ErrorPrinting) == true) { |
7849 if (@global(ErrorPrinting) == true) { |
7839 console_fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n"); |
7850 console_fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n"); |
7840 } |
7851 } |
7841 break; |
7852 break; |
7842 default: |
7853 default: |
7843 ok = 1; |
7854 ok = 1; |
7844 break; |
7855 break; |
7845 } |
7856 } |
7846 |
7857 |
7847 if (! ok) { |
7858 if (! ok) { |
7848 /* |
7859 /* |
7849 ENTER_XLIB(); |
7860 ENTER_XLIB(); |
7850 */ |
7861 */ |
7851 XUngrabPointer(myDpy, CurrentTime); |
7862 XUngrabPointer(myDpy, CurrentTime); |
7852 /* |
7863 /* |
7853 LEAVE_XLIB(); |
7864 LEAVE_XLIB(); |
7854 */ |
7865 */ |
7855 RETURN (false); |
7866 RETURN (false); |
7856 } |
7867 } |
7857 RETURN ( true ); |
7868 RETURN ( true ); |
7858 } |
7869 } |
7859 } |
7870 } |
7860 %}. |
7871 %}. |
7861 self primitiveFailedOrClosedConnection. |
7872 self primitiveFailedOrClosedConnection. |
7862 ^ false |
7873 ^ false |
7863 ! |
7874 ! |
7864 |
7875 |
7865 grabPointerIn:aWindowId withCursor:aCursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
7876 grabPointerIn:aWindowId withCursor:aCursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
7866 "grap the pointer - return true if ok" |
7877 "grap the pointer - return true if ok" |
7867 |
7878 |
7868 ^ self |
7879 ^ self |
7869 grabPointerIn:aWindowId |
7880 grabPointerIn:aWindowId |
7870 withCursor:aCursorId |
7881 withCursor:aCursorId |
7871 eventMask:nil |
7882 eventMask:nil |
7872 pointerMode:pMode |
7883 pointerMode:pMode |
7873 keyboardMode:kMode |
7884 keyboardMode:kMode |
7874 confineTo:confineId |
7885 confineTo:confineId |
7875 |
7886 |
7876 "Modified: / 28.7.1998 / 02:47:51 / cg" |
7887 "Modified: / 28.7.1998 / 02:47:51 / cg" |
7877 ! |
7888 ! |
7878 |
7889 |
7879 primUngrabKeyboard |
7890 primUngrabKeyboard |
7881 |
7892 |
7882 <context: #return> |
7893 <context: #return> |
7883 %{ |
7894 %{ |
7884 |
7895 |
7885 if (ISCONNECTED) { |
7896 if (ISCONNECTED) { |
7886 Display *dpy = myDpy; |
7897 Display *dpy = myDpy; |
7887 |
7898 |
7888 ENTER_XLIB(); |
7899 ENTER_XLIB(); |
7889 XUngrabKeyboard(dpy, CurrentTime); |
7900 XUngrabKeyboard(dpy, CurrentTime); |
7890 XSync(dpy, 0); |
7901 XSync(dpy, 0); |
7891 LEAVE_XLIB(); |
7902 LEAVE_XLIB(); |
7892 |
7903 |
7893 } |
7904 } |
7894 %}. |
7905 %}. |
7895 ! |
7906 ! |
7896 |
7907 |
7899 |
7910 |
7900 <context: #return> |
7911 <context: #return> |
7901 %{ |
7912 %{ |
7902 |
7913 |
7903 if (ISCONNECTED) { |
7914 if (ISCONNECTED) { |
7904 Display *dpy = myDpy; |
7915 Display *dpy = myDpy; |
7905 |
7916 |
7906 ENTER_XLIB(); |
7917 ENTER_XLIB(); |
7907 XUngrabPointer(dpy, CurrentTime); |
7918 XUngrabPointer(dpy, CurrentTime); |
7908 XSync(dpy, 0); |
7919 XSync(dpy, 0); |
7909 LEAVE_XLIB(); |
7920 LEAVE_XLIB(); |
7910 |
7921 |
7911 } |
7922 } |
7912 %}. |
7923 %}. |
7913 ! |
7924 ! |
7914 |
7925 |
7915 ungrabKeyboard |
7926 ungrabKeyboard |
7916 "release the keyboard" |
7927 "release the keyboard" |
7917 |
7928 |
7918 activeKeyboardGrab notNil ifTrue:[ |
7929 activeKeyboardGrab notNil ifTrue:[ |
7919 activeKeyboardGrab := nil. |
7930 activeKeyboardGrab := nil. |
7920 self primUngrabKeyboard. |
7931 self primUngrabKeyboard. |
7921 ] |
7932 ] |
7922 ! |
7933 ! |
7923 |
7934 |
7924 ungrabPointer |
7935 ungrabPointer |
7925 "release the pointer" |
7936 "release the pointer" |
7926 |
7937 |
7927 activePointerGrab notNil ifTrue:[ |
7938 activePointerGrab notNil ifTrue:[ |
7928 activePointerGrab := nil. |
7939 activePointerGrab := nil. |
7929 self primUngrabPointer. |
7940 self primUngrabPointer. |
7930 ] |
7941 ] |
7931 ! ! |
7942 ! ! |
7932 |
7943 |
7933 !XWorkstation methodsFor:'graphic context stuff'! |
7944 !XWorkstation methodsFor:'graphic context stuff'! |
7934 |
7945 |
7940 |
7951 |
7941 XGCValues gcv; |
7952 XGCValues gcv; |
7942 GC gc; |
7953 GC gc; |
7943 |
7954 |
7944 if (ISCONNECTED) { |
7955 if (ISCONNECTED) { |
7945 if (__isExternalAddress(aGCId)) { |
7956 if (__isExternalAddress(aGCId)) { |
7946 gc = __GCVal(aGCId); |
7957 gc = __GCVal(aGCId); |
7947 gcv.clip_mask = None; |
7958 gcv.clip_mask = None; |
7948 ENTER_XLIB(); |
7959 ENTER_XLIB(); |
7949 XChangeGC(myDpy, gc, GCClipMask, &gcv); |
7960 XChangeGC(myDpy, gc, GCClipMask, &gcv); |
7950 LEAVE_XLIB(); |
7961 LEAVE_XLIB(); |
7951 RETURN ( self ); |
7962 RETURN ( self ); |
7952 } |
7963 } |
7953 } |
7964 } |
7954 %}. |
7965 %}. |
7955 self primitiveFailedOrClosedConnection |
7966 self primitiveFailedOrClosedConnection |
7956 ! |
7967 ! |
7957 |
7968 |
7960 |
7971 |
7961 <context: #return> |
7972 <context: #return> |
7962 %{ |
7973 %{ |
7963 |
7974 |
7964 if (ISCONNECTED) { |
7975 if (ISCONNECTED) { |
7965 if (__isExternalAddress(aGCId) |
7976 if (__isExternalAddress(aGCId) |
7966 && __isSmallInteger(bgColorIndex)) { |
7977 && __isSmallInteger(bgColorIndex)) { |
7967 ENTER_XLIB(); |
7978 ENTER_XLIB(); |
7968 XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex)); |
7979 XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex)); |
7969 LEAVE_XLIB(); |
7980 LEAVE_XLIB(); |
7970 RETURN ( self ); |
7981 RETURN ( self ); |
7971 } |
7982 } |
7972 } |
7983 } |
7973 %}. |
7984 %}. |
7974 self primitiveFailedOrClosedConnection |
7985 self primitiveFailedOrClosedConnection |
7975 ! |
7986 ! |
7976 |
7987 |
7982 |
7993 |
7983 GC gc; |
7994 GC gc; |
7984 Pixmap bitmap; |
7995 Pixmap bitmap; |
7985 |
7996 |
7986 if (ISCONNECTED) { |
7997 if (ISCONNECTED) { |
7987 Display *dpy = myDpy; |
7998 Display *dpy = myDpy; |
7988 |
7999 |
7989 if (__isExternalAddress(aGCId)) { |
8000 if (__isExternalAddress(aGCId)) { |
7990 gc = __GCVal(aGCId); |
8001 gc = __GCVal(aGCId); |
7991 if (__isExternalAddress(aBitmapId)) { |
8002 if (__isExternalAddress(aBitmapId)) { |
7992 bitmap = __PixmapVal(aBitmapId); |
8003 bitmap = __PixmapVal(aBitmapId); |
7993 ENTER_XLIB(); |
8004 ENTER_XLIB(); |
7994 XSetStipple(dpy, gc, bitmap); |
8005 XSetStipple(dpy, gc, bitmap); |
7995 XSetFillStyle(dpy, gc, FillOpaqueStippled); |
8006 XSetFillStyle(dpy, gc, FillOpaqueStippled); |
7996 LEAVE_XLIB(); |
8007 LEAVE_XLIB(); |
7997 RETURN ( self ); |
8008 RETURN ( self ); |
7998 } |
8009 } |
7999 if (aBitmapId == nil) { |
8010 if (aBitmapId == nil) { |
8000 ENTER_XLIB(); |
8011 ENTER_XLIB(); |
8001 XSetFillStyle(dpy, gc, FillSolid); |
8012 XSetFillStyle(dpy, gc, FillSolid); |
8002 LEAVE_XLIB(); |
8013 LEAVE_XLIB(); |
8003 RETURN ( self ); |
8014 RETURN ( self ); |
8004 } |
8015 } |
8005 } |
8016 } |
8006 } |
8017 } |
8007 %}. |
8018 %}. |
8008 self primitiveFailedOrClosedConnection |
8019 self primitiveFailedOrClosedConnection |
8009 ! |
8020 ! |
8010 |
8021 |
8016 |
8027 |
8017 XGCValues gcv; |
8028 XGCValues gcv; |
8018 GC gc; |
8029 GC gc; |
8019 |
8030 |
8020 if (ISCONNECTED) { |
8031 if (ISCONNECTED) { |
8021 if (__isExternalAddress(aGCId)) { |
8032 if (__isExternalAddress(aGCId)) { |
8022 gc = __GCVal(aGCId); |
8033 gc = __GCVal(aGCId); |
8023 if (aBool == true) |
8034 if (aBool == true) |
8024 gcv.subwindow_mode = ClipByChildren; |
8035 gcv.subwindow_mode = ClipByChildren; |
8025 else |
8036 else |
8026 gcv.subwindow_mode = IncludeInferiors; |
8037 gcv.subwindow_mode = IncludeInferiors; |
8027 |
8038 |
8028 ENTER_XLIB(); |
8039 ENTER_XLIB(); |
8029 XChangeGC(myDpy, gc, GCSubwindowMode, &gcv); |
8040 XChangeGC(myDpy, gc, GCSubwindowMode, &gcv); |
8030 LEAVE_XLIB(); |
8041 LEAVE_XLIB(); |
8031 RETURN ( self ); |
8042 RETURN ( self ); |
8032 } |
8043 } |
8033 } |
8044 } |
8034 %}. |
8045 %}. |
8035 self primitiveFailedOrClosedConnection |
8046 self primitiveFailedOrClosedConnection |
8036 ! |
8047 ! |
8037 |
8048 |
8042 %{ |
8053 %{ |
8043 |
8054 |
8044 XRectangle r; |
8055 XRectangle r; |
8045 |
8056 |
8046 if (ISCONNECTED) { |
8057 if (ISCONNECTED) { |
8047 if (__isExternalAddress(aGCId) |
8058 if (__isExternalAddress(aGCId) |
8048 && __bothSmallInteger(clipX, clipY) |
8059 && __bothSmallInteger(clipX, clipY) |
8049 && __bothSmallInteger(clipWidth, clipHeight)) { |
8060 && __bothSmallInteger(clipWidth, clipHeight)) { |
8050 r.x = __intVal(clipX); |
8061 r.x = __intVal(clipX); |
8051 r.y = __intVal(clipY); |
8062 r.y = __intVal(clipY); |
8052 r.width = __intVal(clipWidth); |
8063 r.width = __intVal(clipWidth); |
8053 r.height = __intVal(clipHeight); |
8064 r.height = __intVal(clipHeight); |
8054 ENTER_XLIB(); |
8065 ENTER_XLIB(); |
8055 XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted); |
8066 XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted); |
8056 LEAVE_XLIB(); |
8067 LEAVE_XLIB(); |
8057 RETURN ( self ); |
8068 RETURN ( self ); |
8058 } |
8069 } |
8059 } |
8070 } |
8060 %}. |
8071 %}. |
8061 self primitiveFailedOrClosedConnection |
8072 self primitiveFailedOrClosedConnection |
8062 ! |
8073 ! |
8063 |
8074 |
8066 |
8077 |
8067 <context: #return> |
8078 <context: #return> |
8068 %{ |
8079 %{ |
8069 |
8080 |
8070 if (ISCONNECTED) { |
8081 if (ISCONNECTED) { |
8071 if (__isExternalAddress(aGCId) |
8082 if (__isExternalAddress(aGCId) |
8072 && __isSmallInteger(offset) |
8083 && __isSmallInteger(offset) |
8073 && __isByteArrayLike(dashList)) { |
8084 && __isByteArrayLike(dashList)) { |
8074 ENTER_XLIB(); |
8085 ENTER_XLIB(); |
8075 XSetDashes(myDpy, __GCVal(aGCId), |
8086 XSetDashes(myDpy, __GCVal(aGCId), |
8076 __intVal(offset), |
8087 __intVal(offset), |
8077 __ByteArrayInstPtr(dashList)->ba_element, |
8088 __ByteArrayInstPtr(dashList)->ba_element, |
8078 __byteArraySize(dashList)); |
8089 __byteArraySize(dashList)); |
8079 LEAVE_XLIB(); |
8090 LEAVE_XLIB(); |
8080 RETURN ( self ); |
8091 RETURN ( self ); |
8081 } |
8092 } |
8082 } |
8093 } |
8083 bad: ; |
8094 bad: ; |
8084 %}. |
8095 %}. |
8085 " |
8096 " |
8086 either aGCId is invalid, |
8097 either aGCId is invalid, |
8097 %{ |
8108 %{ |
8098 |
8109 |
8099 XFontStruct *f; |
8110 XFontStruct *f; |
8100 |
8111 |
8101 if (ISCONNECTED) { |
8112 if (ISCONNECTED) { |
8102 if (__isExternalAddress(aFontId) |
8113 if (__isExternalAddress(aFontId) |
8103 && __isExternalAddress(aGCId)) { |
8114 && __isExternalAddress(aGCId)) { |
8104 f = (XFontStruct *) __FontVal(aFontId); |
8115 f = (XFontStruct *) __FontVal(aFontId); |
8105 ENTER_XLIB(); |
8116 ENTER_XLIB(); |
8106 XSetFont(myDpy, __GCVal(aGCId), f->fid); |
8117 XSetFont(myDpy, __GCVal(aGCId), f->fid); |
8107 LEAVE_XLIB(); |
8118 LEAVE_XLIB(); |
8108 RETURN ( self ); |
8119 RETURN ( self ); |
8109 } |
8120 } |
8110 } |
8121 } |
8111 %}. |
8122 %}. |
8112 " |
8123 " |
8113 aGCId and/or aFontId are invalid |
8124 aGCId and/or aFontId are invalid |
8114 " |
8125 " |
8122 %{ |
8133 %{ |
8123 |
8134 |
8124 GC gc; |
8135 GC gc; |
8125 |
8136 |
8126 if (ISCONNECTED) { |
8137 if (ISCONNECTED) { |
8127 Display *dpy = myDpy; |
8138 Display *dpy = myDpy; |
8128 if (__bothSmallInteger(fgColorIndex, bgColorIndex) |
8139 if (__bothSmallInteger(fgColorIndex, bgColorIndex) |
8129 && __isExternalAddress(aGCId)) { |
8140 && __isExternalAddress(aGCId)) { |
8130 gc = __GCVal(aGCId); |
8141 gc = __GCVal(aGCId); |
8131 |
8142 |
8132 ENTER_XLIB(); |
8143 ENTER_XLIB(); |
8133 XSetForeground(dpy, gc, __intVal(fgColorIndex)); |
8144 XSetForeground(dpy, gc, __intVal(fgColorIndex)); |
8134 XSetBackground(dpy, gc, __intVal(bgColorIndex)); |
8145 XSetBackground(dpy, gc, __intVal(bgColorIndex)); |
8135 LEAVE_XLIB(); |
8146 LEAVE_XLIB(); |
8136 RETURN ( self ); |
8147 RETURN ( self ); |
8137 } |
8148 } |
8138 } |
8149 } |
8139 %}. |
8150 %}. |
8140 self primitiveFailedOrClosedConnection |
8151 self primitiveFailedOrClosedConnection |
8141 ! |
8152 ! |
8142 |
8153 |
8145 |
8156 |
8146 <context: #return> |
8157 <context: #return> |
8147 %{ |
8158 %{ |
8148 |
8159 |
8149 if (ISCONNECTED) { |
8160 if (ISCONNECTED) { |
8150 if (__isExternalAddress(aGCId) |
8161 if (__isExternalAddress(aGCId) |
8151 && __isSmallInteger(fgColorIndex)) { |
8162 && __isSmallInteger(fgColorIndex)) { |
8152 ENTER_XLIB(); |
8163 ENTER_XLIB(); |
8153 XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex)); |
8164 XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex)); |
8154 LEAVE_XLIB(); |
8165 LEAVE_XLIB(); |
8155 RETURN ( self ); |
8166 RETURN ( self ); |
8156 } |
8167 } |
8157 } |
8168 } |
8158 %}. |
8169 %}. |
8159 self primitiveFailedOrClosedConnection |
8170 self primitiveFailedOrClosedConnection |
8160 ! |
8171 ! |
8161 |
8172 |
8167 |
8178 |
8168 GC gc; |
8179 GC gc; |
8169 int fun = -1; |
8180 int fun = -1; |
8170 |
8181 |
8171 if (ISCONNECTED) { |
8182 if (ISCONNECTED) { |
8172 if (__isExternalAddress(aGCId)) { |
8183 if (__isExternalAddress(aGCId)) { |
8173 gc = __GCVal(aGCId); |
8184 gc = __GCVal(aGCId); |
8174 if (aFunctionSymbol == @symbol(copy)) fun = GXcopy; |
8185 if (aFunctionSymbol == @symbol(copy)) fun = GXcopy; |
8175 else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted; |
8186 else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted; |
8176 else if (aFunctionSymbol == @symbol(xor)) fun = GXxor; |
8187 else if (aFunctionSymbol == @symbol(xor)) fun = GXxor; |
8177 else if (aFunctionSymbol == @symbol(and)) fun = GXand; |
8188 else if (aFunctionSymbol == @symbol(and)) fun = GXand; |
8178 else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse; |
8189 else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse; |
8179 else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted; |
8190 else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted; |
8180 else if (aFunctionSymbol == @symbol(or)) fun = GXor; |
8191 else if (aFunctionSymbol == @symbol(or)) fun = GXor; |
8181 else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse; |
8192 else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse; |
8182 else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted; |
8193 else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted; |
8183 else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert; |
8194 else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert; |
8184 else if (aFunctionSymbol == @symbol(clear)) fun = GXclear; |
8195 else if (aFunctionSymbol == @symbol(clear)) fun = GXclear; |
8185 else if (aFunctionSymbol == @symbol(set)) fun = GXset; |
8196 else if (aFunctionSymbol == @symbol(set)) fun = GXset; |
8186 else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop; |
8197 else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop; |
8187 else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv; |
8198 else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv; |
8188 else if (aFunctionSymbol == @symbol(nand)) fun = GXnand; |
8199 else if (aFunctionSymbol == @symbol(nand)) fun = GXnand; |
8189 if (fun != -1) { |
8200 if (fun != -1) { |
8190 ENTER_XLIB(); |
8201 ENTER_XLIB(); |
8191 XSetFunction(myDpy, gc, fun); |
8202 XSetFunction(myDpy, gc, fun); |
8192 LEAVE_XLIB(); |
8203 LEAVE_XLIB(); |
8193 RETURN ( self ); |
8204 RETURN ( self ); |
8194 } |
8205 } |
8195 } |
8206 } |
8196 } |
8207 } |
8197 %}. |
8208 %}. |
8198 " |
8209 " |
8199 either aGCId is not an integer, or an invalid symbol |
8210 either aGCId is not an integer, or an invalid symbol |
8200 was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse, |
8211 was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse, |
8208 |
8219 |
8209 <context: #return> |
8220 <context: #return> |
8210 %{ |
8221 %{ |
8211 |
8222 |
8212 if (ISCONNECTED) { |
8223 if (ISCONNECTED) { |
8213 if (__isExternalAddress(aGCId)) { |
8224 if (__isExternalAddress(aGCId)) { |
8214 ENTER_XLIB(); |
8225 ENTER_XLIB(); |
8215 XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0); |
8226 XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0); |
8216 LEAVE_XLIB(); |
8227 LEAVE_XLIB(); |
8217 RETURN ( self ); |
8228 RETURN ( self ); |
8218 } |
8229 } |
8219 } |
8230 } |
8220 %}. |
8231 %}. |
8221 self primitiveFailedOrClosedConnection |
8232 self primitiveFailedOrClosedConnection |
8222 ! |
8233 ! |
8223 |
8234 |
8237 static char dashDotDotList[6] = { 4,1 , 1,1 , 1,1 }; |
8248 static char dashDotDotList[6] = { 4,1 , 1,1 , 1,1 }; |
8238 char *x_dashes = 0; |
8249 char *x_dashes = 0; |
8239 int x_nDash; |
8250 int x_nDash; |
8240 |
8251 |
8241 if (ISCONNECTED) { |
8252 if (ISCONNECTED) { |
8242 if (__isExternalAddress(aGCId) |
8253 if (__isExternalAddress(aGCId) |
8243 && __isSmallInteger(aNumber)) { |
8254 && __isSmallInteger(aNumber)) { |
8244 Display *dpy = myDpy; |
8255 Display *dpy = myDpy; |
8245 |
8256 |
8246 if (lineStyle == @symbol(solid)) { |
8257 if (lineStyle == @symbol(solid)) { |
8247 x_dashes = (char *)0; |
8258 x_dashes = (char *)0; |
8248 x_style = LineSolid; |
8259 x_style = LineSolid; |
8249 } else if (lineStyle == @symbol(dashed)) { |
8260 } else if (lineStyle == @symbol(dashed)) { |
8250 x_dashes = dashList; |
8261 x_dashes = dashList; |
8251 x_nDash = sizeof(dashList); |
8262 x_nDash = sizeof(dashList); |
8252 x_style = LineOnOffDash; |
8263 x_style = LineOnOffDash; |
8253 } else if (lineStyle == @symbol(doubleDashed)) { |
8264 } else if (lineStyle == @symbol(doubleDashed)) { |
8254 x_dashes = dashList; |
8265 x_dashes = dashList; |
8255 x_nDash = sizeof(dashList); |
8266 x_nDash = sizeof(dashList); |
8256 x_style = LineDoubleDash; |
8267 x_style = LineDoubleDash; |
8257 } else if (lineStyle == @symbol(dotted)) { |
8268 } else if (lineStyle == @symbol(dotted)) { |
8258 x_dashes = dotList; |
8269 x_dashes = dotList; |
8259 x_nDash = sizeof(dotList); |
8270 x_nDash = sizeof(dotList); |
8260 x_style = LineOnOffDash; |
8271 x_style = LineOnOffDash; |
8261 } else if (lineStyle == @symbol(dashDot)) { |
8272 } else if (lineStyle == @symbol(dashDot)) { |
8262 x_dashes = dashDotList; |
8273 x_dashes = dashDotList; |
8263 x_nDash = sizeof(dashDotList); |
8274 x_nDash = sizeof(dashDotList); |
8264 x_style = LineOnOffDash; |
8275 x_style = LineOnOffDash; |
8265 } else if (lineStyle == @symbol(dashDotDot)) { |
8276 } else if (lineStyle == @symbol(dashDotDot)) { |
8266 x_dashes = dashDotDotList; |
8277 x_dashes = dashDotDotList; |
8267 x_nDash = sizeof(dashDotDotList); |
8278 x_nDash = sizeof(dashDotDotList); |
8268 x_style = LineOnOffDash; |
8279 x_style = LineOnOffDash; |
8269 } else goto bad; |
8280 } else goto bad; |
8270 |
8281 |
8271 if (capStyle == @symbol(notLast)) x_cap = CapNotLast; |
8282 if (capStyle == @symbol(notLast)) x_cap = CapNotLast; |
8272 else if (capStyle == @symbol(butt)) x_cap = CapButt; |
8283 else if (capStyle == @symbol(butt)) x_cap = CapButt; |
8273 else if (capStyle == @symbol(round)) x_cap = CapRound; |
8284 else if (capStyle == @symbol(round)) x_cap = CapRound; |
8274 else if (capStyle == @symbol(projecting)) x_cap = CapProjecting; |
8285 else if (capStyle == @symbol(projecting)) x_cap = CapProjecting; |
8275 else goto bad; |
8286 else goto bad; |
8276 |
8287 |
8277 if (joinStyle == @symbol(miter)) x_join = JoinMiter; |
8288 if (joinStyle == @symbol(miter)) x_join = JoinMiter; |
8278 else if (joinStyle == @symbol(bevel)) x_join = JoinBevel; |
8289 else if (joinStyle == @symbol(bevel)) x_join = JoinBevel; |
8279 else if (joinStyle == @symbol(round)) x_join = JoinRound; |
8290 else if (joinStyle == @symbol(round)) x_join = JoinRound; |
8280 else goto bad; |
8291 else goto bad; |
8281 |
8292 |
8282 ENTER_XLIB(); |
8293 ENTER_XLIB(); |
8283 if (x_dashes) { |
8294 if (x_dashes) { |
8284 XSetDashes(dpy, __GCVal(aGCId), 0, x_dashes, x_nDash); |
8295 XSetDashes(dpy, __GCVal(aGCId), 0, x_dashes, x_nDash); |
8285 } |
8296 } |
8286 XSetLineAttributes(dpy, |
8297 XSetLineAttributes(dpy, |
8287 __GCVal(aGCId), __intVal(aNumber), |
8298 __GCVal(aGCId), __intVal(aNumber), |
8288 x_style, x_cap, x_join); |
8299 x_style, x_cap, x_join); |
8289 LEAVE_XLIB(); |
8300 LEAVE_XLIB(); |
8290 RETURN ( self ); |
8301 RETURN ( self ); |
8291 } |
8302 } |
8292 } |
8303 } |
8293 bad: ; |
8304 bad: ; |
8294 %}. |
8305 %}. |
8295 " |
8306 " |
8296 either aGCId is invalid, |
8307 either aGCId is invalid, |
8307 |
8318 |
8308 <context: #return> |
8319 <context: #return> |
8309 %{ |
8320 %{ |
8310 |
8321 |
8311 if (ISCONNECTED) { |
8322 if (ISCONNECTED) { |
8312 if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) { |
8323 if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) { |
8313 ENTER_XLIB(); |
8324 ENTER_XLIB(); |
8314 XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY)); |
8325 XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY)); |
8315 LEAVE_XLIB(); |
8326 LEAVE_XLIB(); |
8316 RETURN ( self ); |
8327 RETURN ( self ); |
8317 } |
8328 } |
8318 } |
8329 } |
8319 %}. |
8330 %}. |
8320 self primitiveFailedOrClosedConnection |
8331 self primitiveFailedOrClosedConnection |
8321 ! |
8332 ! |
8322 |
8333 |
8328 |
8339 |
8329 GC gc; |
8340 GC gc; |
8330 Pixmap pixmap; |
8341 Pixmap pixmap; |
8331 |
8342 |
8332 if (ISCONNECTED) { |
8343 if (ISCONNECTED) { |
8333 Display *dpy = myDpy; |
8344 Display *dpy = myDpy; |
8334 |
8345 |
8335 if (__isExternalAddress(aGCId)) { |
8346 if (__isExternalAddress(aGCId)) { |
8336 gc = __GCVal(aGCId); |
8347 gc = __GCVal(aGCId); |
8337 if (__isExternalAddress(aPixmapId)) { |
8348 if (__isExternalAddress(aPixmapId)) { |
8338 pixmap = __PixmapVal(aPixmapId); |
8349 pixmap = __PixmapVal(aPixmapId); |
8339 ENTER_XLIB(); |
8350 ENTER_XLIB(); |
8340 XSetTile(dpy, gc, pixmap); |
8351 XSetTile(dpy, gc, pixmap); |
8341 XSetFillStyle(dpy, gc, FillTiled); |
8352 XSetFillStyle(dpy, gc, FillTiled); |
8342 LEAVE_XLIB(); |
8353 LEAVE_XLIB(); |
8343 RETURN ( self ); |
8354 RETURN ( self ); |
8344 } |
8355 } |
8345 if (aPixmapId == nil) { |
8356 if (aPixmapId == nil) { |
8346 ENTER_XLIB(); |
8357 ENTER_XLIB(); |
8347 XSetFillStyle(dpy, gc, FillSolid); |
8358 XSetFillStyle(dpy, gc, FillSolid); |
8348 LEAVE_XLIB(); |
8359 LEAVE_XLIB(); |
8349 RETURN ( self ); |
8360 RETURN ( self ); |
8350 } |
8361 } |
8351 } |
8362 } |
8352 } |
8363 } |
8353 %}. |
8364 %}. |
8354 self primitiveFailedOrClosedConnection |
8365 self primitiveFailedOrClosedConnection |
8355 ! ! |
8366 ! ! |
8356 |
8367 |
8364 "/ 'closing' errorPrintCR. |
8375 "/ 'closing' errorPrintCR. |
8365 "/ thisContext fullPrintAll. |
8376 "/ thisContext fullPrintAll. |
8366 |
8377 |
8367 %{ /* UNLIMITEDSTACK */ /* calls XSync()! */ |
8378 %{ /* UNLIMITEDSTACK */ /* calls XSync()! */ |
8368 if (ISCONNECTED) { |
8379 if (ISCONNECTED) { |
8369 Display *dpy = myDpy; |
8380 Display *dpy = myDpy; |
8370 |
8381 |
8371 |
8382 |
8372 __INST(displayId) = nil; |
8383 __INST(displayId) = nil; |
8373 ENTER_XLIB(); |
8384 ENTER_XLIB(); |
8374 XCloseDisplay(dpy); |
8385 XCloseDisplay(dpy); |
8375 LEAVE_XLIB(); |
8386 LEAVE_XLIB(); |
8376 } |
8387 } |
8377 %} |
8388 %} |
8378 ! |
8389 ! |
8379 |
8390 |
8380 emergencyCloseConnection |
8391 emergencyCloseConnection |
8381 "low level close of the displays connection (without sending any buffered |
8392 "low level close of the displays connection (without sending any buffered |
8382 requests to the display). Only used in case of emergency (brokenConnection)" |
8393 requests to the display). Only used in case of emergency (brokenConnection)" |
8383 |
8394 |
8384 %{ |
8395 %{ |
8385 if (ISCONNECTED) { |
8396 if (ISCONNECTED) { |
8386 Display *dpy = myDpy; |
8397 Display *dpy = myDpy; |
8387 |
8398 |
8388 __INST(displayId) = nil; |
8399 __INST(displayId) = nil; |
8389 close(ConnectionNumber(dpy)); |
8400 close(ConnectionNumber(dpy)); |
8390 } |
8401 } |
8391 %} |
8402 %} |
8392 ! |
8403 ! |
8393 |
8404 |
8394 eventBufferSize |
8405 eventBufferSize |
8401 "Creates a fake WindowGroup view. This window is used |
8412 "Creates a fake WindowGroup view. This window is used |
8402 in XWMHints & _NET_WM_LEADER properties to define |
8413 in XWMHints & _NET_WM_LEADER properties to define |
8403 application window group" |
8414 application window group" |
8404 |
8415 |
8405 windowGroupWindow isNil ifTrue:[ |
8416 windowGroupWindow isNil ifTrue:[ |
8406 windowGroupWindow := WindowGroupWindow new create. |
8417 windowGroupWindow := WindowGroupWindow new create. |
8407 ]. |
8418 ]. |
8408 ^ windowGroupWindow |
8419 ^ windowGroupWindow |
8409 ! |
8420 ! |
8410 |
8421 |
8411 initializeDefaultValues |
8422 initializeDefaultValues |
8450 the argument, aDisplayName may be nil (for the default server from |
8461 the argument, aDisplayName may be nil (for the default server from |
8451 DISPLAY-variable or command line argument) or the name of the server |
8462 DISPLAY-variable or command line argument) or the name of the server |
8452 as hostname:number" |
8463 as hostname:number" |
8453 |
8464 |
8454 displayId notNil ifTrue:[ |
8465 displayId notNil ifTrue:[ |
8455 "/ already connected - you bad guy try to trick me manually ? |
8466 "/ already connected - you bad guy try to trick me manually ? |
8456 ^ self |
8467 ^ self |
8457 ]. |
8468 ]. |
8458 |
8469 |
8459 displayId := self openConnectionTo:aDisplayName. |
8470 displayId := self openConnectionTo:aDisplayName. |
8460 displayId isNil ifTrue:[ |
8471 displayId isNil ifTrue:[ |
8461 "/ could not connect. |
8472 "/ could not connect. |
8462 DeviceOpenErrorSignal raiseWith:aDisplayName. |
8473 DeviceOpenErrorSignal raiseWith:aDisplayName. |
8463 ^ nil |
8474 ^ nil |
8464 ]. |
8475 ]. |
8465 |
8476 |
8466 xlibTimeout := xlibTimeout ? DefaultXLibTimeout. |
8477 xlibTimeout := xlibTimeout ? DefaultXLibTimeout. |
8467 xlibTimeoutForWindowCreation := xlibTimeoutForWindowCreation ? DefaultXLibTimeoutForWindowCreation. |
8478 xlibTimeoutForWindowCreation := xlibTimeoutForWindowCreation ? DefaultXLibTimeoutForWindowCreation. |
8468 hasConnectionBroken := false. |
8479 hasConnectionBroken := false. |
8510 |
8521 |
8511 rawKeySymTranslation := RawKeySymTranslation. |
8522 rawKeySymTranslation := RawKeySymTranslation. |
8512 |
8523 |
8513 map := self modifierMapping. |
8524 map := self modifierMapping. |
8514 map isNil ifTrue:[ |
8525 map isNil ifTrue:[ |
8515 "/ |
8526 "/ |
8516 "/ mhmh - a crippled Xlib which does not provide modifier mappings |
8527 "/ mhmh - a crippled Xlib which does not provide modifier mappings |
8517 "/ setup some reasonable default. If that is not sufficient, |
8528 "/ setup some reasonable default. If that is not sufficient, |
8518 "/ you have to change things from your display.rc file. |
8529 "/ you have to change things from your display.rc file. |
8519 "/ |
8530 "/ |
8520 altModifierMask := self modifier1Mask. |
8531 altModifierMask := self modifier1Mask. |
8521 metaModifierMask := self modifier2Mask. |
8532 metaModifierMask := self modifier2Mask. |
8522 ] ifFalse:[ |
8533 ] ifFalse:[ |
8523 | mod symbolFromKeyCode nonNilOnes | |
8534 | mod symbolFromKeyCode nonNilOnes | |
8524 |
8535 |
8525 altModifierMask := 0. |
8536 altModifierMask := 0. |
8526 metaModifierMask := 0. |
8537 metaModifierMask := 0. |
8527 |
8538 |
8528 symbolFromKeyCode := [:key | self symbolFromKeycode:key]. |
8539 symbolFromKeyCode := [:key | self symbolFromKeycode:key]. |
8529 nonNilOnes := [:str | str notNil]. |
8540 nonNilOnes := [:str | str notNil]. |
8530 |
8541 |
8531 mod := map at:1. |
8542 mod := map at:1. |
8532 mod notNil ifTrue:[ |
8543 mod notNil ifTrue:[ |
8533 shiftModifiers := mod collect:symbolFromKeyCode thenSelect:nonNilOnes. |
8544 shiftModifiers := mod collect:symbolFromKeyCode thenSelect:nonNilOnes. |
8534 ]. |
8545 ]. |
8535 mod := map at:3. |
8546 mod := map at:3. |
8536 mod notNil ifTrue:[ |
8547 mod notNil ifTrue:[ |
8537 ctrlModifiers := mod collect:symbolFromKeyCode thenSelect:nonNilOnes. |
8548 ctrlModifiers := mod collect:symbolFromKeyCode thenSelect:nonNilOnes. |
8538 ]. |
8549 ]. |
8539 mod := map at:4. |
8550 mod := map at:4. |
8540 mod notNil ifTrue:[ |
8551 mod notNil ifTrue:[ |
8541 mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes. |
8552 mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes. |
8542 (mod includes:#'Num_Lock') ifFalse:[ |
8553 (mod includes:#'Num_Lock') ifFalse:[ |
8543 metaModifiers := mod. |
8554 metaModifiers := mod. |
8544 metaModifierMask := 1 bitShift:(4-1). |
8555 metaModifierMask := 1 bitShift:(4-1). |
8545 ]. |
8556 ]. |
8546 ]. |
8557 ]. |
8547 mod := map at:5. |
8558 mod := map at:5. |
8548 mod notNil ifTrue:[ |
8559 mod notNil ifTrue:[ |
8549 mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes. |
8560 mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes. |
8550 (mod includes:#'Num_Lock') ifFalse:[ |
8561 (mod includes:#'Num_Lock') ifFalse:[ |
8551 altModifiers := mod. |
8562 altModifiers := mod. |
8552 altModifierMask := 1 bitShift:(5-1). |
8563 altModifierMask := 1 bitShift:(5-1). |
8553 ]. |
8564 ]. |
8554 ] |
8565 ] |
8555 ]. |
8566 ]. |
8556 |
8567 |
8557 " |
8568 " |
8558 Display initializeModifierMappings |
8569 Display initializeModifierMappings |
8559 " |
8570 " |
8561 "Modified: 1.12.1995 / 23:44:40 / stefan" |
8572 "Modified: 1.12.1995 / 23:44:40 / stefan" |
8562 ! |
8573 ! |
8563 |
8574 |
8564 initializeScreenBounds |
8575 initializeScreenBounds |
8565 self isXineramaActive ifTrue:[ |
8576 self isXineramaActive ifTrue:[ |
8566 |rect| |
8577 |rect| |
8567 |
8578 |
8568 self monitorBounds do:[:eachRect| |
8579 self monitorBounds do:[:eachRect| |
8569 rect isNil ifTrue:[ |
8580 rect isNil ifTrue:[ |
8570 rect := eachRect. |
8581 rect := eachRect. |
8571 ] ifFalse:[ |
8582 ] ifFalse:[ |
8572 rect := rect merge:eachRect. |
8583 rect := rect merge:eachRect. |
8573 ] |
8584 ] |
8574 ]. |
8585 ]. |
8575 width := rect width. |
8586 width := rect width. |
8576 height := rect height. |
8587 height := rect height. |
8577 |
8588 |
8578 "propagate possible size changes to our rottView" |
8589 "propagate possible size changes to our rottView" |
8579 rootView notNil ifTrue:[ |
8590 rootView notNil ifTrue:[ |
8580 rootView initialize. |
8591 rootView initialize. |
8581 ]. |
8592 ]. |
8582 ] ifFalse:[ |
8593 ] ifFalse:[ |
8583 width := self queryWidth. |
8594 width := self queryWidth. |
8584 height := self queryHeight. |
8595 height := self queryHeight. |
8585 ]. |
8596 ]. |
8586 widthMM := self queryWidthMM. |
8597 widthMM := self queryWidthMM. |
8587 heightMM := self queryHeightMM. |
8598 heightMM := self queryHeightMM. |
8588 |
8599 |
8589 " |
8600 " |
8628 visualType := self queryDefaultVisualType. |
8639 visualType := self queryDefaultVisualType. |
8629 |
8640 |
8630 hasColors := hasGreyscales := true. |
8641 hasColors := hasGreyscales := true. |
8631 (visualType == #StaticGray |
8642 (visualType == #StaticGray |
8632 or:[ visualType == #GrayScale]) ifTrue:[ |
8643 or:[ visualType == #GrayScale]) ifTrue:[ |
8633 hasColors := false. |
8644 hasColors := false. |
8634 monitorType := #monochrome. |
8645 monitorType := #monochrome. |
8635 ]. |
8646 ]. |
8636 |
8647 |
8637 ncells == 2 ifTrue:[ |
8648 ncells == 2 ifTrue:[ |
8638 hasColors := hasGreyscales := false. |
8649 hasColors := hasGreyscales := false. |
8639 ]. |
8650 ]. |
8640 |
8651 |
8641 masks := self queryRGBMasks. |
8652 masks := self queryRGBMasks. |
8642 redMask := masks at:1. |
8653 redMask := masks at:1. |
8643 greenMask := masks at:2. |
8654 greenMask := masks at:2. |
8644 blueMask := masks at:3. |
8655 blueMask := masks at:3. |
8645 bitsPerRGB := masks at:4. |
8656 bitsPerRGB := masks at:4. |
8646 |
8657 |
8647 visualType == #TrueColor ifTrue:[ |
8658 visualType == #TrueColor ifTrue:[ |
8648 redShift := redMask lowBit - 1. |
8659 redShift := redMask lowBit - 1. |
8649 greenShift := greenMask lowBit - 1. |
8660 greenShift := greenMask lowBit - 1. |
8650 blueShift := blueMask lowBit - 1. |
8661 blueShift := blueMask lowBit - 1. |
8651 |
8662 |
8652 bitsRed := redMask highBit - redMask lowBit + 1. |
8663 bitsRed := redMask highBit - redMask lowBit + 1. |
8653 bitsGreen := greenMask highBit - greenMask lowBit + 1. |
8664 bitsGreen := greenMask highBit - greenMask lowBit + 1. |
8654 bitsBlue := blueMask highBit - blueMask lowBit + 1. |
8665 bitsBlue := blueMask highBit - blueMask lowBit + 1. |
8655 ]. |
8666 ]. |
8656 |
8667 |
8657 %{ |
8668 %{ |
8658 |
8669 |
8659 Display *dpy; |
8670 Display *dpy; |
8668 int nvi, i; |
8679 int nvi, i; |
8669 char *type, *nm; |
8680 char *type, *nm; |
8670 int dummy; |
8681 int dummy; |
8671 |
8682 |
8672 if (ISCONNECTED) { |
8683 if (ISCONNECTED) { |
8673 dpy = myDpy; |
8684 dpy = myDpy; |
8674 |
8685 |
8675 /* |
8686 /* |
8676 * look for RGB visual with the highest depth |
8687 * look for RGB visual with the highest depth |
8677 */ |
8688 */ |
8678 nvi = 0; |
8689 nvi = 0; |
8679 viproto.screen = scr; |
8690 viproto.screen = scr; |
8680 vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); |
8691 vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); |
8681 maxRGBDepth = maxRGBADepth = 0; |
8692 maxRGBDepth = maxRGBADepth = 0; |
8682 for (i = 0; i < nvi; i++) { |
8693 for (i = 0; i < nvi; i++) { |
8683 int thisDepth = vip[i].depth; |
8694 int thisDepth = vip[i].depth; |
8684 |
8695 |
8685 switch (vip[i].class) { |
8696 switch (vip[i].class) { |
8686 case TrueColor: |
8697 case TrueColor: |
8687 if (thisDepth > maxRGBDepth) { |
8698 if (thisDepth > maxRGBDepth) { |
8688 if (thisDepth <= 24) { |
8699 if (thisDepth <= 24) { |
8689 maxRGBDepth = thisDepth; |
8700 maxRGBDepth = thisDepth; |
8690 rgbRedMask = vip[i].red_mask; |
8701 rgbRedMask = vip[i].red_mask; |
8691 rgbGreenMask = vip[i].green_mask; |
8702 rgbGreenMask = vip[i].green_mask; |
8692 rgbBlueMask = vip[i].blue_mask; |
8703 rgbBlueMask = vip[i].blue_mask; |
8693 rgbVisualID = vip[i].visualid; |
8704 rgbVisualID = vip[i].visualid; |
8694 } else { |
8705 } else { |
8695 if (thisDepth > maxRGBADepth) { |
8706 if (thisDepth > maxRGBADepth) { |
8696 // printf("found rgba visual!\n"); |
8707 // printf("found rgba visual!\n"); |
8697 maxRGBADepth = thisDepth; |
8708 maxRGBADepth = thisDepth; |
8698 rgbaRedMask = vip[i].red_mask; |
8709 rgbaRedMask = vip[i].red_mask; |
8699 rgbaGreenMask = vip[i].green_mask; |
8710 rgbaGreenMask = vip[i].green_mask; |
8700 rgbaBlueMask = vip[i].blue_mask; |
8711 rgbaBlueMask = vip[i].blue_mask; |
8701 rgbaVisualID = vip[i].visualid; |
8712 rgbaVisualID = vip[i].visualid; |
8702 } |
8713 } |
8703 } |
8714 } |
8704 } |
8715 } |
8705 break; |
8716 break; |
8706 } |
8717 } |
8707 } |
8718 } |
8708 if (vip) XFree ((char *) vip); |
8719 if (vip) XFree ((char *) vip); |
8709 |
8720 |
8710 if (maxRGBDepth) { |
8721 if (maxRGBDepth) { |
8711 __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual); |
8722 __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual); |
8712 } |
8723 } |
8713 if (maxRGBADepth) { |
8724 if (maxRGBADepth) { |
8714 __INST(rgbaVisual) = __MKEXTERNALADDRESS(rgbaVisualID); __STORESELF(rgbaVisual); |
8725 __INST(rgbaVisual) = __MKEXTERNALADDRESS(rgbaVisualID); __STORESELF(rgbaVisual); |
8715 if (!maxRGBDepth) { |
8726 if (!maxRGBDepth) { |
8716 __INST(rgbVisual) = __INST(rgbaVisual); __STORESELF(rgbVisual); |
8727 __INST(rgbVisual) = __INST(rgbaVisual); __STORESELF(rgbVisual); |
8717 } |
8728 } |
8718 } |
8729 } |
8719 } |
8730 } |
8720 %}. |
8731 %}. |
8721 ! |
8732 ! |
8722 |
8733 |
8723 initializeSpecialFlags |
8734 initializeSpecialFlags |
8728 "/ |
8739 "/ |
8729 hasSaveUnder := true. |
8740 hasSaveUnder := true. |
8730 ignoreBackingStore := false. |
8741 ignoreBackingStore := false. |
8731 |
8742 |
8732 (self serverVendor = 'X11/NeWS') ifTrue:[ |
8743 (self serverVendor = 'X11/NeWS') ifTrue:[ |
8733 "/ |
8744 "/ |
8734 "/ this is a kludge around a bug in the X11/NeWS server, |
8745 "/ this is a kludge around a bug in the X11/NeWS server, |
8735 "/ which does not correctly handle saveUnder |
8746 "/ which does not correctly handle saveUnder |
8736 "/ |
8747 "/ |
8737 hasSaveUnder := false. |
8748 hasSaveUnder := false. |
8738 ]. |
8749 ]. |
8739 ! |
8750 ! |
8740 |
8751 |
8741 initializeUniqueID |
8752 initializeUniqueID |
8742 uniqueDeviceID isNil ifTrue:[ |
8753 uniqueDeviceID isNil ifTrue:[ |
8743 uniqueDeviceID := UUID genUUID. |
8754 uniqueDeviceID := UUID genUUID. |
8744 ] |
8755 ] |
8745 ! |
8756 ! |
8746 |
8757 |
8747 openConnectionTo:dpyName |
8758 openConnectionTo:dpyName |
8748 "open a connection to some display; |
8759 "open a connection to some display; |
8752 Display *dpy; |
8763 Display *dpy; |
8753 int i; |
8764 int i; |
8754 char *nm; |
8765 char *nm; |
8755 |
8766 |
8756 if (__isStringLike(dpyName)) |
8767 if (__isStringLike(dpyName)) |
8757 nm = (char *) __stringVal(dpyName); |
8768 nm = (char *) __stringVal(dpyName); |
8758 else { |
8769 else { |
8759 nm = NULL; |
8770 nm = NULL; |
8760 } |
8771 } |
8761 dpy = XOpenDisplay(nm); |
8772 dpy = XOpenDisplay(nm); |
8762 |
8773 |
8763 if (dpy) { |
8774 if (dpy) { |
8764 static int firstCall = 1; |
8775 static int firstCall = 1; |
8765 OBJ dpyID; |
8776 OBJ dpyID; |
8766 |
8777 |
8767 dpyID = __MKEXTERNALADDRESS(dpy); |
8778 dpyID = __MKEXTERNALADDRESS(dpy); |
8768 |
8779 |
8769 if (firstCall) { |
8780 if (firstCall) { |
8770 firstCall = 0; |
8781 firstCall = 0; |
8771 XSetErrorHandler(__XErrorHandler__); |
8782 XSetErrorHandler(__XErrorHandler__); |
8772 XSetIOErrorHandler(__XIOErrorHandler__); |
8783 XSetIOErrorHandler(__XIOErrorHandler__); |
8773 } |
8784 } |
8774 RETURN (dpyID); |
8785 RETURN (dpyID); |
8775 } |
8786 } |
8776 %}. |
8787 %}. |
8777 ^ nil |
8788 ^ nil |
8778 ! |
8789 ! |
8779 |
8790 |
8780 queryBlackPixel |
8791 queryBlackPixel |
8781 %{ /* NOCONTEXT */ |
8792 %{ /* NOCONTEXT */ |
8782 |
8793 |
8783 if (ISCONNECTED) { |
8794 if (ISCONNECTED) { |
8784 Display *dpy; |
8795 Display *dpy; |
8785 int scr; |
8796 int scr; |
8786 |
8797 |
8787 dpy = myDpy; |
8798 dpy = myDpy; |
8788 scr = DefaultScreen(dpy); |
8799 scr = DefaultScreen(dpy); |
8789 RETURN ( __MKSMALLINT(BlackPixel(dpy, scr))); |
8800 RETURN ( __MKSMALLINT(BlackPixel(dpy, scr))); |
8790 } |
8801 } |
8791 %}. |
8802 %}. |
8792 ^ nil |
8803 ^ nil |
8793 |
8804 |
8794 " |
8805 " |
8798 |
8809 |
8799 queryCells |
8810 queryCells |
8800 %{ /* NOCONTEXT */ |
8811 %{ /* NOCONTEXT */ |
8801 |
8812 |
8802 if (ISCONNECTED) { |
8813 if (ISCONNECTED) { |
8803 Display *dpy; |
8814 Display *dpy; |
8804 int scr; |
8815 int scr; |
8805 |
8816 |
8806 dpy = myDpy; |
8817 dpy = myDpy; |
8807 scr = DefaultScreen(dpy); |
8818 scr = DefaultScreen(dpy); |
8808 RETURN ( __MKSMALLINT(DisplayCells(dpy, scr))); |
8819 RETURN ( __MKSMALLINT(DisplayCells(dpy, scr))); |
8809 } |
8820 } |
8810 %}. |
8821 %}. |
8811 ^ nil |
8822 ^ nil |
8812 |
8823 |
8813 " |
8824 " |
8818 queryDPSExtension |
8829 queryDPSExtension |
8819 %{ /* NOCONTEXT */ |
8830 %{ /* NOCONTEXT */ |
8820 |
8831 |
8821 #ifdef DPS |
8832 #ifdef DPS |
8822 if (ISCONNECTED) { |
8833 if (ISCONNECTED) { |
8823 Display *dpy; |
8834 Display *dpy; |
8824 int dummy; |
8835 int dummy; |
8825 |
8836 |
8826 dpy = myDpy; |
8837 dpy = myDpy; |
8827 |
8838 |
8828 if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) { |
8839 if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) { |
8829 RETURN ( true ); |
8840 RETURN ( true ); |
8830 } |
8841 } |
8831 } |
8842 } |
8832 #endif |
8843 #endif |
8833 %}. |
8844 %}. |
8834 ^ false |
8845 ^ false |
8835 |
8846 |
8840 |
8851 |
8841 queryDefaultScreen |
8852 queryDefaultScreen |
8842 %{ /* NOCONTEXT */ |
8853 %{ /* NOCONTEXT */ |
8843 |
8854 |
8844 if (ISCONNECTED) { |
8855 if (ISCONNECTED) { |
8845 Display *dpy; |
8856 Display *dpy; |
8846 |
8857 |
8847 dpy = myDpy; |
8858 dpy = myDpy; |
8848 RETURN ( __MKSMALLINT(DefaultScreen(dpy))); |
8859 RETURN ( __MKSMALLINT(DefaultScreen(dpy))); |
8849 } |
8860 } |
8850 %}. |
8861 %}. |
8851 ^ nil |
8862 ^ nil |
8852 |
8863 |
8853 " |
8864 " |
8857 |
8868 |
8858 queryDefaultVisualType |
8869 queryDefaultVisualType |
8859 %{ /* NOCONTEXT */ |
8870 %{ /* NOCONTEXT */ |
8860 |
8871 |
8861 if (ISCONNECTED) { |
8872 if (ISCONNECTED) { |
8862 Display *dpy; |
8873 Display *dpy; |
8863 Visual *visual; |
8874 Visual *visual; |
8864 |
8875 |
8865 dpy = myDpy; |
8876 dpy = myDpy; |
8866 visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
8877 visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
8867 switch (visual->class) { |
8878 switch (visual->class) { |
8868 case StaticGray: |
8879 case StaticGray: |
8869 RETURN ( @symbol(StaticGray) ); |
8880 RETURN ( @symbol(StaticGray) ); |
8870 case GrayScale: |
8881 case GrayScale: |
8871 RETURN ( @symbol(GrayScale) ); |
8882 RETURN ( @symbol(GrayScale) ); |
8872 case StaticColor: |
8883 case StaticColor: |
8873 RETURN ( @symbol(StaticColor) ); |
8884 RETURN ( @symbol(StaticColor) ); |
8874 case PseudoColor: |
8885 case PseudoColor: |
8875 RETURN ( @symbol(PseudoColor) ); |
8886 RETURN ( @symbol(PseudoColor) ); |
8876 case TrueColor: |
8887 case TrueColor: |
8877 RETURN ( @symbol(TrueColor) ); |
8888 RETURN ( @symbol(TrueColor) ); |
8878 case DirectColor: |
8889 case DirectColor: |
8879 RETURN ( @symbol(DirectColor) ); |
8890 RETURN ( @symbol(DirectColor) ); |
8880 } |
8891 } |
8881 } |
8892 } |
8882 %}. |
8893 %}. |
8883 ^ nil |
8894 ^ nil |
8884 |
8895 |
8885 " |
8896 " |
8889 |
8900 |
8890 queryDepth |
8901 queryDepth |
8891 %{ /* NOCONTEXT */ |
8902 %{ /* NOCONTEXT */ |
8892 |
8903 |
8893 if (ISCONNECTED) { |
8904 if (ISCONNECTED) { |
8894 Display *dpy; |
8905 Display *dpy; |
8895 int scr; |
8906 int scr; |
8896 |
8907 |
8897 dpy = myDpy; |
8908 dpy = myDpy; |
8898 scr = DefaultScreen(dpy); |
8909 scr = DefaultScreen(dpy); |
8899 RETURN ( __MKSMALLINT(DisplayPlanes(dpy, scr))); |
8910 RETURN ( __MKSMALLINT(DisplayPlanes(dpy, scr))); |
8900 } |
8911 } |
8901 %}. |
8912 %}. |
8902 ^ nil |
8913 ^ nil |
8903 |
8914 |
8904 " |
8915 " |
8908 |
8919 |
8909 queryHeight |
8920 queryHeight |
8910 %{ /* NOCONTEXT */ |
8921 %{ /* NOCONTEXT */ |
8911 |
8922 |
8912 if (ISCONNECTED) { |
8923 if (ISCONNECTED) { |
8913 Display *dpy; |
8924 Display *dpy; |
8914 int scr; |
8925 int scr; |
8915 |
8926 |
8916 dpy = myDpy; |
8927 dpy = myDpy; |
8917 scr = DefaultScreen(dpy); |
8928 scr = DefaultScreen(dpy); |
8918 RETURN ( __MKSMALLINT(DisplayHeight(dpy, scr))); |
8929 RETURN ( __MKSMALLINT(DisplayHeight(dpy, scr))); |
8919 } |
8930 } |
8920 %}. |
8931 %}. |
8921 ^ nil |
8932 ^ nil |
8922 |
8933 |
8923 " |
8934 " |
8927 |
8938 |
8928 queryHeightMM |
8939 queryHeightMM |
8929 %{ /* NOCONTEXT */ |
8940 %{ /* NOCONTEXT */ |
8930 |
8941 |
8931 if (ISCONNECTED) { |
8942 if (ISCONNECTED) { |
8932 Display *dpy; |
8943 Display *dpy; |
8933 int scr; |
8944 int scr; |
8934 |
8945 |
8935 dpy = myDpy; |
8946 dpy = myDpy; |
8936 scr = DefaultScreen(dpy); |
8947 scr = DefaultScreen(dpy); |
8937 RETURN ( __MKSMALLINT(DisplayHeightMM(dpy, scr))); |
8948 RETURN ( __MKSMALLINT(DisplayHeightMM(dpy, scr))); |
8938 } |
8949 } |
8939 %}. |
8950 %}. |
8940 ^ nil |
8951 ^ nil |
8941 |
8952 |
8942 " |
8953 " |
8947 queryMBUFExtension |
8958 queryMBUFExtension |
8948 %{ /* NOCONTEXT */ |
8959 %{ /* NOCONTEXT */ |
8949 |
8960 |
8950 #ifdef MBUF |
8961 #ifdef MBUF |
8951 if (ISCONNECTED) { |
8962 if (ISCONNECTED) { |
8952 Display *dpy; |
8963 Display *dpy; |
8953 int dummy; |
8964 int dummy; |
8954 |
8965 |
8955 dpy = myDpy; |
8966 dpy = myDpy; |
8956 |
8967 |
8957 if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) { |
8968 if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) { |
8958 RETURN ( true ); |
8969 RETURN ( true ); |
8959 } |
8970 } |
8960 } |
8971 } |
8961 #endif |
8972 #endif |
8962 %}. |
8973 %}. |
8963 ^ false |
8974 ^ false |
8964 |
8975 |
8970 queryPEXExtension |
8981 queryPEXExtension |
8971 %{ /* NOCONTEXT */ |
8982 %{ /* NOCONTEXT */ |
8972 |
8983 |
8973 #ifdef PEX5 |
8984 #ifdef PEX5 |
8974 if (ISCONNECTED) { |
8985 if (ISCONNECTED) { |
8975 Display *dpy; |
8986 Display *dpy; |
8976 int dummy; |
8987 int dummy; |
8977 |
8988 |
8978 dpy = myDpy; |
8989 dpy = myDpy; |
8979 |
8990 |
8980 if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) { |
8991 if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) { |
8981 RETURN ( true ); |
8992 RETURN ( true ); |
8982 } |
8993 } |
8983 } |
8994 } |
8984 #endif |
8995 #endif |
8985 %}. |
8996 %}. |
8986 ^ false |
8997 ^ false |
8987 |
8998 |
8992 |
9003 |
8993 queryRGBMasks |
9004 queryRGBMasks |
8994 %{ /* NOCONTEXT */ |
9005 %{ /* NOCONTEXT */ |
8995 |
9006 |
8996 if (ISCONNECTED) { |
9007 if (ISCONNECTED) { |
8997 Display *dpy; |
9008 Display *dpy; |
8998 Visual *visual; |
9009 Visual *visual; |
8999 OBJ redMask, greenMask, blueMask, bprgb; |
9010 OBJ redMask, greenMask, blueMask, bprgb; |
9000 |
9011 |
9001 dpy = myDpy; |
9012 dpy = myDpy; |
9002 visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
9013 visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
9003 redMask = __MKSMALLINT(visual->red_mask); |
9014 redMask = __MKSMALLINT(visual->red_mask); |
9004 greenMask = __MKSMALLINT(visual->green_mask); |
9015 greenMask = __MKSMALLINT(visual->green_mask); |
9005 blueMask = __MKSMALLINT(visual->blue_mask); |
9016 blueMask = __MKSMALLINT(visual->blue_mask); |
9006 bprgb = __MKSMALLINT(visual->bits_per_rgb); |
9017 bprgb = __MKSMALLINT(visual->bits_per_rgb); |
9007 RETURN ( __ARRAY_WITH4(redMask, greenMask, blueMask, bprgb) ); |
9018 RETURN ( __ARRAY_WITH4(redMask, greenMask, blueMask, bprgb) ); |
9008 } |
9019 } |
9009 %}. |
9020 %}. |
9010 ^ nil |
9021 ^ nil |
9011 |
9022 |
9012 " |
9023 " |
9026 queryRenderExtension |
9037 queryRenderExtension |
9027 %{ /* NOCONTEXT */ |
9038 %{ /* NOCONTEXT */ |
9028 |
9039 |
9029 #ifdef XRENDER |
9040 #ifdef XRENDER |
9030 if (ISCONNECTED) { |
9041 if (ISCONNECTED) { |
9031 Display *dpy; |
9042 Display *dpy; |
9032 int dummy; |
9043 int dummy; |
9033 |
9044 |
9034 dpy = myDpy; |
9045 dpy = myDpy; |
9035 |
9046 |
9036 if (XRenderQueryExtension (dpy, &dummy, &dummy)) { |
9047 if (XRenderQueryExtension (dpy, &dummy, &dummy)) { |
9037 RETURN ( true ); |
9048 RETURN ( true ); |
9038 } |
9049 } |
9039 } |
9050 } |
9040 #endif |
9051 #endif |
9041 %}. |
9052 %}. |
9042 ^ false |
9053 ^ false |
9043 |
9054 |
9049 querySHMExtension |
9060 querySHMExtension |
9050 %{ /* NOCONTEXT */ |
9061 %{ /* NOCONTEXT */ |
9051 |
9062 |
9052 #ifdef xxSHM |
9063 #ifdef xxSHM |
9053 if (ISCONNECTED) { |
9064 if (ISCONNECTED) { |
9054 Display *dpy; |
9065 Display *dpy; |
9055 int dummy; |
9066 int dummy; |
9056 |
9067 |
9057 dpy = myDpy; |
9068 dpy = myDpy; |
9058 |
9069 |
9059 if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) { |
9070 if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) { |
9060 RETURN ( true ); |
9071 RETURN ( true ); |
9061 } |
9072 } |
9062 } |
9073 } |
9063 #endif |
9074 #endif |
9064 %}. |
9075 %}. |
9065 ^ false |
9076 ^ false |
9066 |
9077 |
9072 queryShapeExtension |
9083 queryShapeExtension |
9073 %{ /* NOCONTEXT */ |
9084 %{ /* NOCONTEXT */ |
9074 |
9085 |
9075 #ifdef SHAPE |
9086 #ifdef SHAPE |
9076 if (ISCONNECTED) { |
9087 if (ISCONNECTED) { |
9077 Display *dpy; |
9088 Display *dpy; |
9078 int dummy; |
9089 int dummy; |
9079 |
9090 |
9080 dpy = myDpy; |
9091 dpy = myDpy; |
9081 |
9092 |
9082 if (XShapeQueryExtension(dpy, &dummy, &dummy)) { |
9093 if (XShapeQueryExtension(dpy, &dummy, &dummy)) { |
9083 RETURN ( true ); |
9094 RETURN ( true ); |
9084 } |
9095 } |
9085 } |
9096 } |
9086 #endif |
9097 #endif |
9087 %}. |
9098 %}. |
9088 ^ false |
9099 ^ false |
9089 |
9100 |
9094 |
9105 |
9095 queryWhitePixel |
9106 queryWhitePixel |
9096 %{ /* NOCONTEXT */ |
9107 %{ /* NOCONTEXT */ |
9097 |
9108 |
9098 if (ISCONNECTED) { |
9109 if (ISCONNECTED) { |
9099 Display *dpy; |
9110 Display *dpy; |
9100 int scr; |
9111 int scr; |
9101 |
9112 |
9102 dpy = myDpy; |
9113 dpy = myDpy; |
9103 scr = DefaultScreen(dpy); |
9114 scr = DefaultScreen(dpy); |
9104 RETURN ( __MKSMALLINT(WhitePixel(dpy, scr))); |
9115 RETURN ( __MKSMALLINT(WhitePixel(dpy, scr))); |
9105 } |
9116 } |
9106 %}. |
9117 %}. |
9107 ^ nil |
9118 ^ nil |
9108 |
9119 |
9109 " |
9120 " |
9113 |
9124 |
9114 queryWidth |
9125 queryWidth |
9115 %{ /* NOCONTEXT */ |
9126 %{ /* NOCONTEXT */ |
9116 |
9127 |
9117 if (ISCONNECTED) { |
9128 if (ISCONNECTED) { |
9118 Display *dpy; |
9129 Display *dpy; |
9119 int scr; |
9130 int scr; |
9120 |
9131 |
9121 dpy = myDpy; |
9132 dpy = myDpy; |
9122 scr = DefaultScreen(dpy); |
9133 scr = DefaultScreen(dpy); |
9123 RETURN ( __MKSMALLINT(DisplayWidth(dpy, scr))); |
9134 RETURN ( __MKSMALLINT(DisplayWidth(dpy, scr))); |
9124 } |
9135 } |
9125 %}. |
9136 %}. |
9126 ^ nil |
9137 ^ nil |
9127 |
9138 |
9128 " |
9139 " |
9132 |
9143 |
9133 queryWidthMM |
9144 queryWidthMM |
9134 %{ /* NOCONTEXT */ |
9145 %{ /* NOCONTEXT */ |
9135 |
9146 |
9136 if (ISCONNECTED) { |
9147 if (ISCONNECTED) { |
9137 Display *dpy; |
9148 Display *dpy; |
9138 int scr; |
9149 int scr; |
9139 |
9150 |
9140 dpy = myDpy; |
9151 dpy = myDpy; |
9141 scr = DefaultScreen(dpy); |
9152 scr = DefaultScreen(dpy); |
9142 RETURN ( __MKSMALLINT(DisplayWidthMM(dpy, scr))); |
9153 RETURN ( __MKSMALLINT(DisplayWidthMM(dpy, scr))); |
9143 } |
9154 } |
9144 %}. |
9155 %}. |
9145 ^ nil |
9156 ^ nil |
9146 |
9157 |
9147 " |
9158 " |
9152 queryXIEExtension |
9163 queryXIEExtension |
9153 %{ /* NOCONTEXT */ |
9164 %{ /* NOCONTEXT */ |
9154 |
9165 |
9155 #ifdef XIE |
9166 #ifdef XIE |
9156 if (ISCONNECTED) { |
9167 if (ISCONNECTED) { |
9157 Display *dpy; |
9168 Display *dpy; |
9158 int dummy; |
9169 int dummy; |
9159 |
9170 |
9160 dpy = myDpy; |
9171 dpy = myDpy; |
9161 |
9172 |
9162 if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) { |
9173 if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) { |
9163 RETURN ( true ); |
9174 RETURN ( true ); |
9164 } |
9175 } |
9165 } |
9176 } |
9166 #endif |
9177 #endif |
9167 %}. |
9178 %}. |
9168 ^ false |
9179 ^ false |
9169 |
9180 |
9175 queryXIExtension |
9186 queryXIExtension |
9176 %{ /* NOCONTEXT */ |
9187 %{ /* NOCONTEXT */ |
9177 |
9188 |
9178 #ifdef XI |
9189 #ifdef XI |
9179 if (ISCONNECTED) { |
9190 if (ISCONNECTED) { |
9180 Display *dpy; |
9191 Display *dpy; |
9181 int dummy; |
9192 int dummy; |
9182 |
9193 |
9183 dpy = myDpy; |
9194 dpy = myDpy; |
9184 |
9195 |
9185 if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) { |
9196 if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) { |
9186 RETURN ( true ); |
9197 RETURN ( true ); |
9187 } |
9198 } |
9188 } |
9199 } |
9189 #endif |
9200 #endif |
9190 %}. |
9201 %}. |
9191 ^ false |
9202 ^ false |
9192 |
9203 |
9198 queryXVideoExtension |
9209 queryXVideoExtension |
9199 %{ /* NOCONTEXT */ |
9210 %{ /* NOCONTEXT */ |
9200 |
9211 |
9201 #ifdef XVIDEO |
9212 #ifdef XVIDEO |
9202 if (ISCONNECTED) { |
9213 if (ISCONNECTED) { |
9203 Display *dpy; |
9214 Display *dpy; |
9204 int dummy; |
9215 int dummy; |
9205 |
9216 |
9206 dpy = myDpy; |
9217 dpy = myDpy; |
9207 |
9218 |
9208 if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) { |
9219 if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) { |
9209 RETURN ( true ); |
9220 RETURN ( true ); |
9210 } |
9221 } |
9211 } |
9222 } |
9212 #endif |
9223 #endif |
9213 %}. |
9224 %}. |
9214 ^ false |
9225 ^ false |
9215 |
9226 |
9221 queryXineramaExtension |
9232 queryXineramaExtension |
9222 %{ /* NOCONTEXT */ |
9233 %{ /* NOCONTEXT */ |
9223 |
9234 |
9224 #ifdef XINERAMA |
9235 #ifdef XINERAMA |
9225 if (ISCONNECTED) { |
9236 if (ISCONNECTED) { |
9226 Display *dpy; |
9237 Display *dpy; |
9227 int dummy; |
9238 int dummy; |
9228 |
9239 |
9229 dpy = myDpy; |
9240 dpy = myDpy; |
9230 |
9241 |
9231 if (XineramaQueryExtension (dpy, &dummy, &dummy)) { |
9242 if (XineramaQueryExtension (dpy, &dummy, &dummy)) { |
9232 RETURN ( true ); |
9243 RETURN ( true ); |
9233 } |
9244 } |
9234 } |
9245 } |
9235 #endif |
9246 #endif |
9236 %}. |
9247 %}. |
9237 ^ false |
9248 ^ false |
9238 |
9249 |
9241 " |
9252 " |
9242 ! |
9253 ! |
9243 |
9254 |
9244 reinitialize |
9255 reinitialize |
9245 preWaitAction notNil ifTrue:[ |
9256 preWaitAction notNil ifTrue:[ |
9246 Processor removePreWaitAction:preWaitAction. |
9257 Processor removePreWaitAction:preWaitAction. |
9247 preWaitAction := nil. |
9258 preWaitAction := nil. |
9248 ]. |
9259 ]. |
9249 virtualRootId := rootId := nil. |
9260 virtualRootId := rootId := nil. |
9250 selectionFetchers := nil. |
9261 selectionFetchers := nil. |
9251 super reinitialize. |
9262 super reinitialize. |
9252 dispatchingExpose := nil |
9263 dispatchingExpose := nil |
9253 ! |
9264 ! |
9254 |
9265 |
9255 releaseDeviceResources |
9266 releaseDeviceResources |
9256 preWaitAction notNil ifTrue:[ |
9267 preWaitAction notNil ifTrue:[ |
9257 Processor removePreWaitAction:preWaitAction. |
9268 Processor removePreWaitAction:preWaitAction. |
9258 preWaitAction := nil. |
9269 preWaitAction := nil. |
9259 ]. |
9270 ]. |
9260 selectionFetchers := nil. |
9271 selectionFetchers := nil. |
9261 super releaseDeviceResources. |
9272 super releaseDeviceResources. |
9262 ! ! |
9273 ! ! |
9263 |
9274 |
9277 altModifierMask:aSmallInteger |
9288 altModifierMask:aSmallInteger |
9278 "define which key takes the role of an alt-key. |
9289 "define which key takes the role of an alt-key. |
9279 By default, this is X's modifier1, which is the ALT key on |
9290 By default, this is X's modifier1, which is the ALT key on |
9280 most keyboards. However, there may be exceptions to this, |
9291 most keyboards. However, there may be exceptions to this, |
9281 and the setting can be changed with: |
9292 and the setting can be changed with: |
9282 Display altModifierMask:(Display modifier2Mask) |
9293 Display altModifierMask:(Display modifier2Mask) |
9283 Setting the mask to 0 disables the ALT key (in ST/X) altogether. |
9294 Setting the mask to 0 disables the ALT key (in ST/X) altogether. |
9284 " |
9295 " |
9285 |
9296 |
9286 altModifierMask := aSmallInteger |
9297 altModifierMask := aSmallInteger |
9287 ! |
9298 ! |
9309 "define which key takes the role of a meta key. |
9320 "define which key takes the role of a meta key. |
9310 By default, this is X's modifier2, which is the 2nd ALT key on |
9321 By default, this is X's modifier2, which is the 2nd ALT key on |
9311 most keyboards (if present at all). |
9322 most keyboards (if present at all). |
9312 However, there may be exceptions to this, and the setting can |
9323 However, there may be exceptions to this, and the setting can |
9313 be changed with: |
9324 be changed with: |
9314 Display metaModifierMask:(Display modifier1Mask) |
9325 Display metaModifierMask:(Display modifier1Mask) |
9315 Setting the mask to 0 disables the META key (in ST/X) altogether. |
9326 Setting the mask to 0 disables the META key (in ST/X) altogether. |
9316 As reported, some Xservers place the Meta-key onto NumLock, |
9327 As reported, some Xservers place the Meta-key onto NumLock, |
9317 and having NumLock enabled makes ST/X think, that meta is pressed |
9328 and having NumLock enabled makes ST/X think, that meta is pressed |
9318 all the time. On those, you should disable the meta key by setting |
9329 all the time. On those, you should disable the meta key by setting |
9319 the mask to 0. |
9330 the mask to 0. |
9383 maxKeyPerMod := modifierKeyMap size // 8. |
9394 maxKeyPerMod := modifierKeyMap size // 8. |
9384 |
9395 |
9385 ret := Array new:8. |
9396 ret := Array new:8. |
9386 nextKey := 1. |
9397 nextKey := 1. |
9387 1 to:8 do:[ :i | |
9398 1 to:8 do:[ :i | |
9388 (modifierKeyMap at:nextKey) ~= 0 ifTrue:[ |
9399 (modifierKeyMap at:nextKey) ~= 0 ifTrue:[ |
9389 |mod| |
9400 |mod| |
9390 |
9401 |
9391 mod := OrderedCollection new:maxKeyPerMod. |
9402 mod := OrderedCollection new:maxKeyPerMod. |
9392 modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | |
9403 modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | |
9393 key ~= 0 ifTrue:[ |
9404 key ~= 0 ifTrue:[ |
9394 mod add:key |
9405 mod add:key |
9395 ]. |
9406 ]. |
9396 ]. |
9407 ]. |
9397 ret at:i put:mod asArray. |
9408 ret at:i put:mod asArray. |
9398 ]. |
9409 ]. |
9399 nextKey := nextKey+maxKeyPerMod. |
9410 nextKey := nextKey+maxKeyPerMod. |
9400 ]. |
9411 ]. |
9401 |
9412 |
9402 ^ ret |
9413 ^ ret |
9403 |
9414 |
9404 " |
9415 " |
9408 " |
9419 " |
9409 |mapping| |
9420 |mapping| |
9410 |
9421 |
9411 mapping := Display modifierMapping. |
9422 mapping := Display modifierMapping. |
9412 ^ mapping collect:[:eachRow | |
9423 ^ mapping collect:[:eachRow | |
9413 eachRow notNil ifTrue:[ |
9424 eachRow notNil ifTrue:[ |
9414 eachRow collect:[ :key | Display stringFromKeycode:key ]. |
9425 eachRow collect:[ :key | Display stringFromKeycode:key ]. |
9415 ] ifFalse:[ |
9426 ] ifFalse:[ |
9416 nil |
9427 nil |
9417 ] |
9428 ] |
9418 ]. |
9429 ]. |
9419 " |
9430 " |
9420 ! |
9431 ! |
9421 |
9432 |
9422 rawKeySymTranslation |
9433 rawKeySymTranslation |
9423 "Get the raw keyboard mapping (maps some special X-keySyms to STX-internal names |
9434 "Get the raw keyboard mapping (maps some special X-keySyms to STX-internal names |
9438 |
9449 |
9439 %{ |
9450 %{ |
9440 XModifierKeymap *modmap; |
9451 XModifierKeymap *modmap; |
9441 |
9452 |
9442 if (ISCONNECTED) { |
9453 if (ISCONNECTED) { |
9443 Display *dpy = myDpy; |
9454 Display *dpy = myDpy; |
9444 |
9455 |
9445 if ((modmap = XGetModifierMapping(dpy)) != 0) { |
9456 if ((modmap = XGetModifierMapping(dpy)) != 0) { |
9446 modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8); |
9457 modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8); |
9447 if (modifierKeyMap != nil) { |
9458 if (modifierKeyMap != nil) { |
9448 memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, |
9459 memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, |
9449 (char *)modmap->modifiermap, modmap->max_keypermod * 8); |
9460 (char *)modmap->modifiermap, modmap->max_keypermod * 8); |
9450 } |
9461 } |
9451 XFreeModifiermap(modmap); |
9462 XFreeModifiermap(modmap); |
9452 } |
9463 } |
9453 } |
9464 } |
9454 %}. |
9465 %}. |
9455 ^ modifierKeyMap |
9466 ^ modifierKeyMap |
9456 |
9467 |
9457 " |
9468 " |
9458 Display rawModifierMapping |
9469 Display rawModifierMapping |
9459 " |
9470 " |
9460 ! |
9471 ! |
9461 |
9472 |
9462 shiftModifierMask |
9473 shiftModifierMask |
9463 "return the Xlib mask bit for the shift modifier key" |
9474 "return the Xlib mask bit for the shift modifier key" |
9481 %{ |
9492 %{ |
9482 KeySym keysym; |
9493 KeySym keysym; |
9483 char *keystring; |
9494 char *keystring; |
9484 |
9495 |
9485 if (ISCONNECTED && __isSmallInteger(code)) { |
9496 if (ISCONNECTED && __isSmallInteger(code)) { |
9486 Display *dpy = myDpy; |
9497 Display *dpy = myDpy; |
9487 |
9498 |
9488 // Our Windows Xlib does not support Xkb as of 2013-01 |
9499 // Our Windows Xlib does not support Xkb as of 2013-01 |
9489 // if ((keysym = XkbKeycodeToKeysym(dpy, __intVal(code), 0, 0)) != NoSymbol |
9500 // if ((keysym = XkbKeycodeToKeysym(dpy, __intVal(code), 0, 0)) != NoSymbol |
9490 if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol |
9501 if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol |
9491 && (keystring = XKeysymToString(keysym)) != 0) |
9502 && (keystring = XKeysymToString(keysym)) != 0) |
9492 str = __MKSYMBOL(keystring, 0); |
9503 str = __MKSYMBOL(keystring, 0); |
9493 } |
9504 } |
9494 %}. |
9505 %}. |
9495 ^ str |
9506 ^ str |
9496 |
9507 |
9497 " |
9508 " |
9498 Display symbolFromKeycode:50 |
9509 Display symbolFromKeycode:50 |
9499 " |
9510 " |
9500 ! ! |
9511 ! ! |
9501 |
9512 |
9502 !XWorkstation methodsFor:'misc'! |
9513 !XWorkstation methodsFor:'misc'! |
9503 |
9514 |
9504 beep |
9515 beep |
9505 "output an audible beep or bell" |
9516 "output an audible beep or bell" |
9506 |
9517 |
9507 UserPreferences current beepEnabled ifTrue:[ |
9518 UserPreferences current beepEnabled ifTrue:[ |
9508 self beep:0 volume:50 |
9519 self beep:0 volume:50 |
9509 ] |
9520 ] |
9510 |
9521 |
9511 "Modified: / 3.12.1999 / 17:13:59 / ps" |
9522 "Modified: / 3.12.1999 / 17:13:59 / ps" |
9512 ! |
9523 ! |
9513 |
9524 |
9519 %{ |
9530 %{ |
9520 int volume; |
9531 int volume; |
9521 |
9532 |
9522 if (__isSmallInteger(volumeInPercent) |
9533 if (__isSmallInteger(volumeInPercent) |
9523 && ISCONNECTED) { |
9534 && ISCONNECTED) { |
9524 /* stupid: X wants -100 .. 100 and calls this percent */ |
9535 /* stupid: X wants -100 .. 100 and calls this percent */ |
9525 volume = __intVal(volumeInPercent) * 2 - 100; |
9536 volume = __intVal(volumeInPercent) * 2 - 100; |
9526 if (volume < -100) volume = -100; |
9537 if (volume < -100) volume = -100; |
9527 else if (volume > 100) volume = 100; |
9538 else if (volume > 100) volume = 100; |
9528 |
9539 |
9529 ENTER_XLIB(); |
9540 ENTER_XLIB(); |
9530 XBell(myDpy, volume); |
9541 XBell(myDpy, volume); |
9531 LEAVE_XLIB(); |
9542 LEAVE_XLIB(); |
9532 } |
9543 } |
9533 %} |
9544 %} |
9534 ! |
9545 ! |
9535 |
9546 |
9536 buffered |
9547 buffered |
9539 See #unBuffered for additional info." |
9550 See #unBuffered for additional info." |
9540 |
9551 |
9541 <context: #return> |
9552 <context: #return> |
9542 %{ |
9553 %{ |
9543 if (ISCONNECTED) { |
9554 if (ISCONNECTED) { |
9544 ENTER_XLIB(); |
9555 ENTER_XLIB(); |
9545 XSynchronize(myDpy, 0); |
9556 XSynchronize(myDpy, 0); |
9546 LEAVE_XLIB(); |
9557 LEAVE_XLIB(); |
9547 } |
9558 } |
9548 %} |
9559 %} |
9549 " |
9560 " |
9550 Display buffered |
9561 Display buffered |
9551 " |
9562 " |
9560 See also #sync, which even waits until the request has been processed." |
9571 See also #sync, which even waits until the request has been processed." |
9561 |
9572 |
9562 <context: #return> |
9573 <context: #return> |
9563 %{ |
9574 %{ |
9564 if (ISCONNECTED) { |
9575 if (ISCONNECTED) { |
9565 ENTER_XLIB(); |
9576 ENTER_XLIB(); |
9566 XFlush(myDpy); |
9577 XFlush(myDpy); |
9567 LEAVE_XLIB(); |
9578 LEAVE_XLIB(); |
9568 } |
9579 } |
9569 %}. |
9580 %}. |
9570 |
9581 |
9571 operationsUntilFlush := maxOperationsUntilFlush. |
9582 operationsUntilFlush := maxOperationsUntilFlush. |
9572 ! |
9583 ! |
9574 flushDpsContext:aDPSContext |
9585 flushDpsContext:aDPSContext |
9575 <context: #return> |
9586 <context: #return> |
9576 %{ |
9587 %{ |
9577 #ifdef DPS |
9588 #ifdef DPS |
9578 if (ISCONNECTED |
9589 if (ISCONNECTED |
9579 && __isExternalAddress(aDPSContext)) { |
9590 && __isExternalAddress(aDPSContext)) { |
9580 ENTER_XLIB(); |
9591 ENTER_XLIB(); |
9581 DPSFlushContext(__DPSContextVal(aDPSContext)); |
9592 DPSFlushContext(__DPSContextVal(aDPSContext)); |
9582 LEAVE_XLIB(); |
9593 LEAVE_XLIB(); |
9583 |
9594 |
9584 RETURN ( self ); |
9595 RETURN ( self ); |
9585 } |
9596 } |
9586 #endif |
9597 #endif |
9587 %}. |
9598 %}. |
9588 self primitiveFailedOrClosedConnection |
9599 self primitiveFailedOrClosedConnection |
9589 ! |
9600 ! |
9598 <context: #return> |
9609 <context: #return> |
9599 %{ |
9610 %{ |
9600 |
9611 |
9601 if (ISCONNECTED) { |
9612 if (ISCONNECTED) { |
9602 |
9613 |
9603 ENTER_XLIB(); |
9614 ENTER_XLIB(); |
9604 XSync(myDpy, 0); |
9615 XSync(myDpy, 0); |
9605 LEAVE_XLIB(); |
9616 LEAVE_XLIB(); |
9606 |
9617 |
9607 } |
9618 } |
9608 %}. |
9619 %}. |
9609 operationsUntilFlush := maxOperationsUntilFlush. |
9620 operationsUntilFlush := maxOperationsUntilFlush. |
9610 ! |
9621 ! |
9613 <context: #return> |
9624 <context: #return> |
9614 %{ |
9625 %{ |
9615 XMappingEvent *ev; |
9626 XMappingEvent *ev; |
9616 |
9627 |
9617 if (ISCONNECTED && __isByteArrayLike(eB)) { |
9628 if (ISCONNECTED && __isByteArrayLike(eB)) { |
9618 ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
9629 ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
9619 ENTER_XLIB(); |
9630 ENTER_XLIB(); |
9620 XRefreshKeyboardMapping(ev); |
9631 XRefreshKeyboardMapping(ev); |
9621 LEAVE_XLIB(); |
9632 LEAVE_XLIB(); |
9622 RETURN ( self ); |
9633 RETURN ( self ); |
9623 } |
9634 } |
9624 %}. |
9635 %}. |
9625 self primitiveFailedOrClosedConnection |
9636 self primitiveFailedOrClosedConnection |
9626 ! |
9637 ! |
9627 |
9638 |
9657 %{ |
9668 %{ |
9658 int arg; |
9669 int arg; |
9659 Window focusWindow; |
9670 Window focusWindow; |
9660 |
9671 |
9661 if (ISCONNECTED) { |
9672 if (ISCONNECTED) { |
9662 if (__isExternalAddress(aWindowId)) { |
9673 if (__isExternalAddress(aWindowId)) { |
9663 focusWindow = __WindowVal(aWindowId); |
9674 focusWindow = __WindowVal(aWindowId); |
9664 } else if (aWindowId == nil) { |
9675 } else if (aWindowId == nil) { |
9665 focusWindow = None; |
9676 focusWindow = None; |
9666 } else |
9677 } else |
9667 goto err; |
9678 goto err; |
9668 if (revertSymbol == @symbol(parent)) |
9679 if (revertSymbol == @symbol(parent)) |
9669 arg = RevertToParent; |
9680 arg = RevertToParent; |
9670 else if (revertSymbol == @symbol(root)) |
9681 else if (revertSymbol == @symbol(root)) |
9671 arg = RevertToPointerRoot; |
9682 arg = RevertToPointerRoot; |
9672 else |
9683 else |
9673 arg = RevertToNone; |
9684 arg = RevertToNone; |
9674 |
9685 |
9675 |
9686 |
9676 ENTER_XLIB(); |
9687 ENTER_XLIB(); |
9677 XSetInputFocus(myDpy, focusWindow, arg, CurrentTime); |
9688 XSetInputFocus(myDpy, focusWindow, arg, CurrentTime); |
9678 LEAVE_XLIB(); |
9689 LEAVE_XLIB(); |
9679 |
9690 |
9680 RETURN ( self ); |
9691 RETURN ( self ); |
9681 } |
9692 } |
9682 err:; |
9693 err:; |
9683 %}. |
9694 %}. |
9684 self primitiveFailedOrClosedConnection |
9695 self primitiveFailedOrClosedConnection |
9685 ! |
9696 ! |
9708 <context: #return> |
9719 <context: #return> |
9709 %{ |
9720 %{ |
9710 |
9721 |
9711 if (ISCONNECTED) { |
9722 if (ISCONNECTED) { |
9712 |
9723 |
9713 ENTER_XLIB(); |
9724 ENTER_XLIB(); |
9714 XSynchronize(myDpy, 1); |
9725 XSynchronize(myDpy, 1); |
9715 LEAVE_XLIB(); |
9726 LEAVE_XLIB(); |
9716 |
9727 |
9717 } |
9728 } |
9718 %} |
9729 %} |
9719 " |
9730 " |
9720 Display unBuffered |
9731 Display unBuffered |
9748 Window rootRet, childRet; |
9759 Window rootRet, childRet; |
9749 int rootX, rootY, winX, winY; |
9760 int rootX, rootY, winX, winY; |
9750 unsigned int mask; |
9761 unsigned int mask; |
9751 |
9762 |
9752 if (ISCONNECTED) { |
9763 if (ISCONNECTED) { |
9753 Display *dpy = myDpy; |
9764 Display *dpy = myDpy; |
9754 |
9765 |
9755 w = RootWindow(dpy, screen); |
9766 w = RootWindow(dpy, screen); |
9756 if (w) { |
9767 if (w) { |
9757 |
9768 |
9758 ENTER_XLIB(); |
9769 ENTER_XLIB(); |
9759 XQueryPointer(dpy, w, &rootRet, &childRet, |
9770 XQueryPointer(dpy, w, &rootRet, &childRet, |
9760 &rootX, &rootY, |
9771 &rootX, &rootY, |
9761 &winX, &winY, |
9772 &winX, &winY, |
9762 &mask); |
9773 &mask); |
9763 LEAVE_XLIB(); |
9774 LEAVE_XLIB(); |
9764 |
9775 |
9765 RETURN (__MKSMALLINT(mask)); |
9776 RETURN (__MKSMALLINT(mask)); |
9766 } |
9777 } |
9767 } |
9778 } |
9768 %}. |
9779 %}. |
9769 self primitiveFailedOrClosedConnection. |
9780 self primitiveFailedOrClosedConnection. |
9770 ^ nil |
9781 ^ nil |
9771 |
9782 |
9821 Window rootRet, childRet; |
9832 Window rootRet, childRet; |
9822 int rootX, rootY, winX, winY; |
9833 int rootX, rootY, winX, winY; |
9823 unsigned int mask; |
9834 unsigned int mask; |
9824 |
9835 |
9825 if (ISCONNECTED && rootWindowId != nil) { |
9836 if (ISCONNECTED && rootWindowId != nil) { |
9826 Display *dpy = myDpy; |
9837 Display *dpy = myDpy; |
9827 Window w = (Window)__externalAddressVal(rootWindowId); |
9838 Window w = (Window)__externalAddressVal(rootWindowId); |
9828 |
9839 |
9829 ENTER_XLIB(); |
9840 ENTER_XLIB(); |
9830 XQueryPointer(dpy, w, &rootRet, &childRet, |
9841 XQueryPointer(dpy, w, &rootRet, &childRet, |
9831 &rootX, &rootY, |
9842 &rootX, &rootY, |
9832 &winX, &winY, |
9843 &winX, &winY, |
9833 &mask); |
9844 &mask); |
9834 LEAVE_XLIB(); |
9845 LEAVE_XLIB(); |
9835 xpos = __MKSMALLINT(rootX); |
9846 xpos = __MKSMALLINT(rootX); |
9836 ypos = __MKSMALLINT(rootY); |
9847 ypos = __MKSMALLINT(rootY); |
9837 |
9848 |
9838 } |
9849 } |
9839 %}. |
9850 %}. |
9840 xpos isNil ifTrue:[ |
9851 xpos isNil ifTrue:[ |
9841 self primitiveFailedOrClosedConnection. |
9852 self primitiveFailedOrClosedConnection. |
9842 ^ nil |
9853 ^ nil |
9843 ]. |
9854 ]. |
9844 ^ xpos @ ypos |
9855 ^ xpos @ ypos |
9845 ! |
9856 ! |
9846 |
9857 |
9847 rightButtonStateMask |
9858 rightButtonStateMask |
9879 |
9890 |
9880 %{ |
9891 %{ |
9881 if (ISCONNECTED |
9892 if (ISCONNECTED |
9882 && __isExternalAddress(aWindowId) |
9893 && __isExternalAddress(aWindowId) |
9883 && __bothSmallInteger(xpos, ypos)) { |
9894 && __bothSmallInteger(xpos, ypos)) { |
9884 Display *dpy = myDpy; |
9895 Display *dpy = myDpy; |
9885 Window w = __WindowVal(aWindowId); |
9896 Window w = __WindowVal(aWindowId); |
9886 |
9897 |
9887 ENTER_XLIB(); |
9898 ENTER_XLIB(); |
9888 XWarpPointer(dpy, |
9899 XWarpPointer(dpy, |
9889 None, /* src window */ |
9900 None, /* src window */ |
9890 w, /* dst window */ |
9901 w, /* dst window */ |
9891 0, /* src_x */ |
9902 0, /* src_x */ |
9892 0, /* src_y */ |
9903 0, /* src_y */ |
9893 0, /* src_w */ |
9904 0, /* src_w */ |
9894 0, /* src_h */ |
9905 0, /* src_h */ |
9895 __intVal(xpos), /* dst_x */ |
9906 __intVal(xpos), /* dst_x */ |
9896 __intVal(ypos) /* dst_y */ |
9907 __intVal(ypos) /* dst_y */ |
9897 ); |
9908 ); |
9898 LEAVE_XLIB(); |
9909 LEAVE_XLIB(); |
9899 } |
9910 } |
9900 %}. |
9911 %}. |
9901 ^ self |
9912 ^ self |
9902 |
9913 |
9903 " |
9914 " |
9909 |
9920 |
9910 addSelectionHandler:someone |
9921 addSelectionHandler:someone |
9911 "register someone to be notified when the selection changes" |
9922 "register someone to be notified when the selection changes" |
9912 |
9923 |
9913 selectionHandlers isNil ifTrue:[ |
9924 selectionHandlers isNil ifTrue:[ |
9914 selectionHandlers := IdentitySet new. |
9925 selectionHandlers := IdentitySet new. |
9915 ]. |
9926 ]. |
9916 selectionHandlers add:someone |
9927 selectionHandlers add:someone |
9917 ! |
9928 ! |
9918 |
9929 |
9919 findSelectionFetcher:aDrawableId |
9930 findSelectionFetcher:aDrawableId |
9939 |
9950 |
9940 removeSelectionHandler:someone |
9951 removeSelectionHandler:someone |
9941 "no longer tell someone about selection changes" |
9952 "no longer tell someone about selection changes" |
9942 |
9953 |
9943 selectionHandlers notNil ifTrue:[ |
9954 selectionHandlers notNil ifTrue:[ |
9944 selectionHandlers remove:someone ifAbsent:nil. |
9955 selectionHandlers remove:someone ifAbsent:nil. |
9945 selectionHandlers := selectionHandlers asNilIfEmpty |
9956 selectionHandlers := selectionHandlers asNilIfEmpty |
9946 ]. |
9957 ]. |
9947 ! |
9958 ! |
9948 |
9959 |
9949 unregisterSelectionFetcher:aSelectionFetcher |
9960 unregisterSelectionFetcher:aSelectionFetcher |
9950 "unregister a SelectionFetcher that received selection events for aDrawableId" |
9961 "unregister a SelectionFetcher that received selection events for aDrawableId" |
9959 |
9970 |
9960 <context: #return> |
9971 <context: #return> |
9961 |
9972 |
9962 %{ |
9973 %{ |
9963 if (ISCONNECTED && __isAtomID(propertyID)) { |
9974 if (ISCONNECTED && __isAtomID(propertyID)) { |
9964 Display *dpy = myDpy; |
9975 Display *dpy = myDpy; |
9965 Atom prop; |
9976 Atom prop; |
9966 Window window; |
9977 Window window; |
9967 |
9978 |
9968 prop = __AtomVal(propertyID); |
9979 prop = __AtomVal(propertyID); |
9969 |
9980 |
9970 if (__isExternalAddress(aWindowID)) { |
9981 if (__isExternalAddress(aWindowID)) { |
9971 window = __WindowVal(aWindowID); |
9982 window = __WindowVal(aWindowID); |
9972 } else if (aWindowID == nil) { |
9983 } else if (aWindowID == nil) { |
9973 window = DefaultRootWindow(dpy); |
9984 window = DefaultRootWindow(dpy); |
9974 } else if (__isInteger(aWindowID)) { |
9985 } else if (__isInteger(aWindowID)) { |
9975 window = (Window)__unsignedLongIntVal(aWindowID); |
9986 window = (Window)__unsignedLongIntVal(aWindowID); |
9976 } else { |
9987 } else { |
9977 goto fail; |
9988 goto fail; |
9978 } |
9989 } |
9979 |
9990 |
9980 ENTER_XLIB(); |
9991 ENTER_XLIB(); |
9981 XDeleteProperty(dpy, window, prop); |
9992 XDeleteProperty(dpy, window, prop); |
9982 LEAVE_XLIB(); |
9993 LEAVE_XLIB(); |
9983 RETURN(true); |
9994 RETURN(true); |
9984 } |
9995 } |
9985 fail:; |
9996 fail:; |
9986 %}. |
9997 %}. |
9987 self primitiveFailedOrClosedConnection. |
9998 self primitiveFailedOrClosedConnection. |
9988 ! |
9999 ! |
9993 <context: #return> |
10004 <context: #return> |
9994 |
10005 |
9995 |val typeID propertyID windowID| |
10006 |val typeID propertyID windowID| |
9996 |
10007 |
9997 propertySymbolOrAtomID isString ifTrue:[ |
10008 propertySymbolOrAtomID isString ifTrue:[ |
9998 propertyID := self atomIDOf:propertySymbolOrAtomID create:false. |
10009 propertyID := self atomIDOf:propertySymbolOrAtomID create:false. |
9999 propertyID isNil ifTrue:[^ nil]. |
10010 propertyID isNil ifTrue:[^ nil]. |
10000 ] ifFalse:[ |
10011 ] ifFalse:[ |
10001 propertyID := propertySymbolOrAtomID. |
10012 propertyID := propertySymbolOrAtomID. |
10002 ]. |
10013 ]. |
10003 aWindowOrWindowIDOrNil isView ifTrue:[ |
10014 aWindowOrWindowIDOrNil isView ifTrue:[ |
10004 windowID := aWindowOrWindowIDOrNil id. |
10015 windowID := aWindowOrWindowIDOrNil id. |
10005 ] ifFalse:[ |
10016 ] ifFalse:[ |
10006 windowID := aWindowOrWindowIDOrNil. |
10017 windowID := aWindowOrWindowIDOrNil. |
10007 ]. |
10018 ]. |
10008 |
10019 |
10009 %{ |
10020 %{ |
10010 Window window; |
10021 Window window; |
10011 Atom property; |
10022 Atom property; |
10016 unsigned char *data; |
10027 unsigned char *data; |
10017 int ok = 1; |
10028 int ok = 1; |
10018 # define PROP_SIZE 2048 |
10029 # define PROP_SIZE 2048 |
10019 |
10030 |
10020 if (ISCONNECTED) { |
10031 if (ISCONNECTED) { |
10021 Display *dpy = myDpy; |
10032 Display *dpy = myDpy; |
10022 |
10033 |
10023 if (__isAtomID(propertyID)) { |
10034 if (__isAtomID(propertyID)) { |
10024 property = __AtomVal(propertyID); |
10035 property = __AtomVal(propertyID); |
10025 |
10036 |
10026 if (__isExternalAddress(windowID)) { |
10037 if (__isExternalAddress(windowID)) { |
10027 window = __WindowVal(windowID); |
10038 window = __WindowVal(windowID); |
10028 } else if (windowID == nil) { |
10039 } else if (windowID == nil) { |
10029 window = DefaultRootWindow(dpy); |
10040 window = DefaultRootWindow(dpy); |
10030 } else |
10041 } else |
10031 goto fail; |
10042 goto fail; |
10032 |
10043 |
10033 nread = 0; |
10044 nread = 0; |
10034 cp = 0; |
10045 cp = 0; |
10035 #ifdef PROPERTY_DEBUG |
10046 #ifdef PROPERTY_DEBUG |
10036 console_fprintf(stderr, "getProperty %x\n", property); |
10047 console_fprintf(stderr, "getProperty %x\n", property); |
10037 #endif |
10048 #endif |
10038 |
10049 |
10039 do { |
10050 do { |
10040 int retVal; |
10051 int retVal; |
10041 |
10052 |
10042 ENTER_XLIB(); |
10053 ENTER_XLIB(); |
10043 retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE, |
10054 retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE, |
10044 doDelete == true, |
10055 doDelete == true, |
10045 AnyPropertyType, &actual_type, &actual_format, |
10056 AnyPropertyType, &actual_type, &actual_format, |
10046 &nitems, &bytes_after, (unsigned char **)&data); |
10057 &nitems, &bytes_after, (unsigned char **)&data); |
10047 LEAVE_XLIB(); |
10058 LEAVE_XLIB(); |
10048 if (retVal != Success) { |
10059 if (retVal != Success) { |
10049 #ifdef PROPERTY_DEBUG |
10060 #ifdef PROPERTY_DEBUG |
10050 console_fprintf(stderr, "- no success\n"); |
10061 console_fprintf(stderr, "- no success\n"); |
10051 #endif |
10062 #endif |
10052 ok = 0; |
10063 ok = 0; |
10053 break; |
10064 break; |
10054 } |
10065 } |
10055 #ifdef PROPERTY_DEBUG |
10066 #ifdef PROPERTY_DEBUG |
10056 console_fprintf(stderr, "- type:%x\n", actual_type); |
10067 console_fprintf(stderr, "- type:%x\n", actual_type); |
10057 #endif |
10068 #endif |
10058 nitems *= (actual_format / 8); |
10069 nitems *= (actual_format / 8); |
10059 typeID = __MKATOMOBJ(actual_type); |
10070 typeID = __MKATOMOBJ(actual_type); |
10060 if (! cp) { |
10071 if (! cp) { |
10061 cp = cp2 = (char *)malloc(nitems+bytes_after); |
10072 cp = cp2 = (char *)malloc(nitems+bytes_after); |
10062 } else { |
10073 } else { |
10063 cp2 = cp + nread; |
10074 cp2 = cp + nread; |
10064 } |
10075 } |
10065 if (! cp) { |
10076 if (! cp) { |
10066 XFree(data); |
10077 XFree(data); |
10067 goto fail; |
10078 goto fail; |
10068 } |
10079 } |
10069 |
10080 |
10070 nread += nitems; |
10081 nread += nitems; |
10071 bcopy(data, cp2, nitems); |
10082 bcopy(data, cp2, nitems); |
10072 XFree(data); |
10083 XFree(data); |
10073 #ifdef PROPERTY_DEBUG |
10084 #ifdef PROPERTY_DEBUG |
10074 console_fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after); |
10085 console_fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after); |
10075 #endif |
10086 #endif |
10076 } while (bytes_after > 0); |
10087 } while (bytes_after > 0); |
10077 |
10088 |
10078 if (ok) { |
10089 if (ok) { |
10079 switch (actual_format) { |
10090 switch (actual_format) { |
10080 case 32: |
10091 case 32: |
10081 val = __stArrayFromCUIntArray((unsigned int*)cp, nread/4); |
10092 val = __stArrayFromCUIntArray((unsigned int*)cp, nread/4); |
10082 break; |
10093 break; |
10083 case 16: |
10094 case 16: |
10084 val = __stArrayFromCUShortArray((unsigned short*)cp, nread/2); |
10095 val = __stArrayFromCUShortArray((unsigned short*)cp, nread/2); |
10085 break; |
10096 break; |
10086 case 8: |
10097 case 8: |
10087 default: |
10098 default: |
10088 if (actual_type == XA_STRING) { |
10099 if (actual_type == XA_STRING) { |
10089 val = __MKSTRING_L(cp, nread); |
10100 val = __MKSTRING_L(cp, nread); |
10090 } else { |
10101 } else { |
10091 val = __MKBYTEARRAY(cp, nread); |
10102 val = __MKBYTEARRAY(cp, nread); |
10092 } |
10103 } |
10093 break; |
10104 break; |
10094 } |
10105 } |
10095 } |
10106 } |
10096 if (cp) |
10107 if (cp) |
10097 free(cp); |
10108 free(cp); |
10098 } |
10109 } |
10099 } |
10110 } |
10100 fail: ; |
10111 fail: ; |
10101 %}. |
10112 %}. |
10102 (typeID isNil or:[typeID == 0]) ifTrue:[ |
10113 (typeID isNil or:[typeID == 0]) ifTrue:[ |
10103 "typeID == 0 (None): The property does not exist in the specified window" |
10114 "typeID == 0 (None): The property does not exist in the specified window" |
10104 ^ nil |
10115 ^ nil |
10105 ]. |
10116 ]. |
10106 ^ typeID->val |
10117 ^ typeID->val |
10107 |
10118 |
10108 " |
10119 " |
10109 Display |
10120 Display |
10110 getProperty:#'_NET_WM_ICON_GEOMETRY' |
10121 getProperty:#'_NET_WM_ICON_GEOMETRY' |
10111 from:nil |
10122 from:nil |
10112 delete:false |
10123 delete:false |
10113 " |
10124 " |
10114 ! |
10125 ! |
10115 |
10126 |
10116 propertiesOf:aWindowOrWindowIDOrNil |
10127 propertiesOf:aWindowOrWindowIDOrNil |
10117 "return a collection of all properties' atomIDs of a window. |
10128 "return a collection of all properties' atomIDs of a window. |
10120 <context: #return> |
10131 <context: #return> |
10121 |
10132 |
10122 |windowID atoms| |
10133 |windowID atoms| |
10123 |
10134 |
10124 aWindowOrWindowIDOrNil isView ifTrue:[ |
10135 aWindowOrWindowIDOrNil isView ifTrue:[ |
10125 windowID := aWindowOrWindowIDOrNil id. |
10136 windowID := aWindowOrWindowIDOrNil id. |
10126 ] ifFalse:[ |
10137 ] ifFalse:[ |
10127 windowID := aWindowOrWindowIDOrNil. |
10138 windowID := aWindowOrWindowIDOrNil. |
10128 ]. |
10139 ]. |
10129 |
10140 |
10130 %{ |
10141 %{ |
10131 Window window; |
10142 Window window; |
10132 Atom *atomListPtr; |
10143 Atom *atomListPtr; |
10133 int i; |
10144 int i; |
10134 |
10145 |
10135 if (ISCONNECTED) { |
10146 if (ISCONNECTED) { |
10136 Display *dpy = myDpy; |
10147 Display *dpy = myDpy; |
10137 int numProps = 0; |
10148 int numProps = 0; |
10138 |
10149 |
10139 if (__isExternalAddress(windowID)) { |
10150 if (__isExternalAddress(windowID)) { |
10140 window = __WindowVal(windowID); |
10151 window = __WindowVal(windowID); |
10141 } else if (windowID == nil) { |
10152 } else if (windowID == nil) { |
10142 window = DefaultRootWindow(dpy); |
10153 window = DefaultRootWindow(dpy); |
10143 } else if (__isInteger(windowID)) { |
10154 } else if (__isInteger(windowID)) { |
10144 window = (Window)__unsignedLongIntVal(windowID); |
10155 window = (Window)__unsignedLongIntVal(windowID); |
10145 } else { |
10156 } else { |
10146 goto fail; |
10157 goto fail; |
10147 } |
10158 } |
10148 |
10159 |
10149 ENTER_XLIB(); |
10160 ENTER_XLIB(); |
10150 atomListPtr = XListProperties(dpy, window, &numProps); |
10161 atomListPtr = XListProperties(dpy, window, &numProps); |
10151 LEAVE_XLIB(); |
10162 LEAVE_XLIB(); |
10152 |
10163 |
10153 if (atomListPtr == NULL) { |
10164 if (atomListPtr == NULL) { |
10154 RETURN (nil); |
10165 RETURN (nil); |
10155 } |
10166 } |
10156 |
10167 |
10157 atoms = __ARRAY_NEW_INT(numProps); |
10168 atoms = __ARRAY_NEW_INT(numProps); |
10158 |
10169 |
10159 if (atoms == nil) { |
10170 if (atoms == nil) { |
10160 goto fail; |
10171 goto fail; |
10161 } |
10172 } |
10162 |
10173 |
10163 for (i=0; i<numProps; i++) { |
10174 for (i=0; i<numProps; i++) { |
10164 OBJ atm; |
10175 OBJ atm; |
10165 |
10176 |
10166 atm = __MKATOMOBJ(atomListPtr[i]); |
10177 atm = __MKATOMOBJ(atomListPtr[i]); |
10167 __ArrayInstPtr(atoms)->a_element[i] = atm; __STORE(atoms, atm); |
10178 __ArrayInstPtr(atoms)->a_element[i] = atm; __STORE(atoms, atm); |
10168 } |
10179 } |
10169 XFree(atomListPtr); |
10180 XFree(atomListPtr); |
10170 RETURN (atoms); |
10181 RETURN (atoms); |
10171 } |
10182 } |
10172 fail: ; |
10183 fail: ; |
10173 %}. |
10184 %}. |
10174 ^ self primitiveFailed |
10185 ^ self primitiveFailed |
10175 |
10186 |
10177 Display propertiesOf:nil |
10188 Display propertiesOf:nil |
10178 Display propertiesOf:Transcript view id |
10189 Display propertiesOf:Transcript view id |
10179 " |
10190 " |
10180 " |
10191 " |
10181 (Display propertiesOf:nil) do:[:atm | |
10192 (Display propertiesOf:nil) do:[:atm | |
10182 |v prop| |
10193 |v prop| |
10183 |
10194 |
10184 Transcript show:((Display atomName:atm) printStringLeftPaddedTo:5). |
10195 Transcript show:((Display atomName:atm) printStringLeftPaddedTo:5). |
10185 Transcript show:': '. |
10196 Transcript show:': '. |
10186 prop := Display getProperty:atm from:nil delete:false. |
10197 prop := Display getProperty:atm from:nil delete:false. |
10187 Transcript showCR:prop value. |
10198 Transcript showCR:prop value. |
10188 ] |
10199 ] |
10189 " |
10200 " |
10190 ! |
10201 ! |
10191 |
10202 |
10192 setIcon:anIcon for:aWindowID |
10203 setIcon:anIcon for:aWindowID |
10193 |iconAtom typeAtom buffer iWidth iHeight| |
10204 |iconAtom typeAtom buffer iWidth iHeight| |
10194 |
10205 |
10195 iconAtom := self atomIDOf:#'_NET_WM_ICON' create:false. |
10206 iconAtom := self atomIDOf:#'_NET_WM_ICON' create:false. |
10196 iconAtom isNil ifTrue:[ |
10207 iconAtom isNil ifTrue:[ |
10197 "/Hmm, no such property, not running under EWMH compliant WM? |
10208 "/Hmm, no such property, not running under EWMH compliant WM? |
10198 ^ self |
10209 ^ self |
10199 ]. |
10210 ]. |
10200 typeAtom := self atomIDOf:#'CARDINAL' create:false. |
10211 typeAtom := self atomIDOf:#'CARDINAL' create:false. |
10201 typeAtom isNil ifTrue:[ |
10212 typeAtom isNil ifTrue:[ |
10202 "/Hmm, no such property, not running under EWMH compliant WM? |
10213 "/Hmm, no such property, not running under EWMH compliant WM? |
10203 ^ self |
10214 ^ self |
10204 ]. |
10215 ]. |
10205 iWidth := anIcon width. |
10216 iWidth := anIcon width. |
10206 iHeight := anIcon height. |
10217 iHeight := anIcon height. |
10207 buffer := IntegerArray new:(iWidth*iHeight+2). |
10218 buffer := IntegerArray new:(iWidth*iHeight+2). |
10208 buffer at:1 put:iWidth. |
10219 buffer at:1 put:iWidth. |
10209 buffer at:2 put:iHeight. |
10220 buffer at:2 put:iHeight. |
10210 |
10221 |
10211 self setProperty:iconAtom type:typeAtom value:buffer for:aWindowID |
10222 self setProperty:iconAtom type:typeAtom value:buffer for:aWindowID |
10212 |
10223 |
10213 " |
10224 " |
10214 Display setIcon:0 for:0 |
10225 Display setIcon:0 for:0 |
10215 " |
10226 " |
10216 ! |
10227 ! |
10217 |
10228 |
10218 setProperty:propertyID type:typeID value:anObject for:aWindowID |
10229 setProperty:propertyID type:typeID value:anObject for:aWindowID |
10219 "set a property in the XServer" |
10230 "set a property in the XServer" |
10224 |
10235 |
10225 retval := false. |
10236 retval := false. |
10226 |
10237 |
10227 %{ /* UNLIMITEDSTACK */ |
10238 %{ /* UNLIMITEDSTACK */ |
10228 if (ISCONNECTED && __isAtomID(propertyID) && __isAtomID(typeID)) { |
10239 if (ISCONNECTED && __isAtomID(propertyID) && __isAtomID(typeID)) { |
10229 Display *dpy = myDpy; |
10240 Display *dpy = myDpy; |
10230 Atom prop, type; |
10241 Atom prop, type; |
10231 Window window; |
10242 Window window; |
10232 |
10243 |
10233 prop = __AtomVal(propertyID); |
10244 prop = __AtomVal(propertyID); |
10234 type = __AtomVal(typeID); |
10245 type = __AtomVal(typeID); |
10235 |
10246 |
10236 if (__isExternalAddress(aWindowID)) { |
10247 if (__isExternalAddress(aWindowID)) { |
10237 window = __WindowVal(aWindowID); |
10248 window = __WindowVal(aWindowID); |
10238 } else if (aWindowID == nil) { |
10249 } else if (aWindowID == nil) { |
10239 window = DefaultRootWindow(dpy); |
10250 window = DefaultRootWindow(dpy); |
10240 } else if (__isInteger(aWindowID)) { |
10251 } else if (__isInteger(aWindowID)) { |
10241 window = (Window)__unsignedLongIntVal(aWindowID); |
10252 window = (Window)__unsignedLongIntVal(aWindowID); |
10242 } else { |
10253 } else { |
10243 RETURN(false); |
10254 RETURN(false); |
10244 } |
10255 } |
10245 |
10256 |
10246 retval = true; |
10257 retval = true; |
10247 |
10258 |
10248 ENTER_XLIB(); |
10259 ENTER_XLIB(); |
10249 if (__isInteger(anObject)) { |
10260 if (__isInteger(anObject)) { |
10250 unsigned INT value = __longIntVal(anObject); |
10261 unsigned INT value = __longIntVal(anObject); |
10251 XChangeProperty(dpy, window, prop, type, 32, |
10262 XChangeProperty(dpy, window, prop, type, 32, |
10252 PropModeReplace, |
10263 PropModeReplace, |
10253 (unsigned char *)&value, 1); |
10264 (unsigned char *)&value, 1); |
10254 } else if (__isByteArrayLike(anObject)) { |
10265 } else if (__isByteArrayLike(anObject)) { |
10255 XChangeProperty(dpy, window, prop, type, 8, |
10266 XChangeProperty(dpy, window, prop, type, 8, |
10256 PropModeReplace, |
10267 PropModeReplace, |
10257 __byteArrayVal(anObject), |
10268 __byteArrayVal(anObject), |
10258 __byteArraySize(anObject)); |
10269 __byteArraySize(anObject)); |
10259 } else if (__isWords(anObject)) { |
10270 } else if (__isWords(anObject)) { |
10260 /* wordArray-like (16bit-string) object */ |
10271 /* wordArray-like (16bit-string) object */ |
10261 XChangeProperty(dpy, window, prop, type, 16, |
10272 XChangeProperty(dpy, window, prop, type, 16, |
10262 PropModeReplace, |
10273 PropModeReplace, |
10263 __stringVal(anObject), |
10274 __stringVal(anObject), |
10264 __wordArraySize(anObject)); |
10275 __wordArraySize(anObject)); |
10265 } else if (__isIntegerArray(anObject)) { |
10276 } else if (__isIntegerArray(anObject)) { |
10266 /* array of atoms */ |
10277 /* array of atoms */ |
10267 XChangeProperty(dpy, window, prop, type, 32, |
10278 XChangeProperty(dpy, window, prop, type, 32, |
10268 PropModeReplace, |
10279 PropModeReplace, |
10269 (char *)__integerArrayVal(anObject), |
10280 (char *)__integerArrayVal(anObject), |
10270 __integerArraySize(anObject)); |
10281 __integerArraySize(anObject)); |
10271 } else if (__isStringLike(anObject)) { |
10282 } else if (__isStringLike(anObject)) { |
10272 XChangeProperty(dpy, window, prop, type, 8, |
10283 XChangeProperty(dpy, window, prop, type, 8, |
10273 PropModeReplace, |
10284 PropModeReplace, |
10274 __stringVal(anObject), |
10285 __stringVal(anObject), |
10275 __stringSize(anObject)); |
10286 __stringSize(anObject)); |
10276 } else { |
10287 } else { |
10277 retval = false; |
10288 retval = false; |
10278 } |
10289 } |
10279 LEAVE_XLIB(); |
10290 LEAVE_XLIB(); |
10280 |
10291 |
10281 DPRINTF(("changeProp win=%"_lx_" prop=%"_lx_" type=%"_lx_"\n", (INT)window, (INT)prop, (INT)type)); |
10292 DPRINTF(("changeProp win=%"_lx_" prop=%"_lx_" type=%"_lx_"\n", (INT)window, (INT)prop, (INT)type)); |
10282 } |
10293 } |
10283 %}. |
10294 %}. |
10284 ^ retval |
10295 ^ retval |
10285 ! ! |
10296 ! ! |
10286 |
10297 |
10292 |
10303 |
10293 "the standard monitor is the first entry in monitorBounds" |
10304 "the standard monitor is the first entry in monitorBounds" |
10294 extent := self monitorBounds first extent. |
10305 extent := self monitorBounds first extent. |
10295 |
10306 |
10296 self isPDA ifTrue:[ |
10307 self isPDA ifTrue:[ |
10297 ^ extent - (16 @ 20) |
10308 ^ extent - (16 @ 20) |
10298 ]. |
10309 ]. |
10299 ^ extent * 2 // 3 |
10310 ^ extent * 2 // 3 |
10300 ! |
10311 ! |
10301 |
10312 |
10302 isXineramaActive |
10313 isXineramaActive |
10303 %{ /* NOCONTEXT */ |
10314 %{ /* NOCONTEXT */ |
10304 |
10315 |
10305 #ifdef XINERAMA |
10316 #ifdef XINERAMA |
10306 if (ISCONNECTED) { |
10317 if (ISCONNECTED) { |
10307 Display *dpy; |
10318 Display *dpy; |
10308 dpy = myDpy; |
10319 dpy = myDpy; |
10309 |
10320 |
10310 if (XineramaIsActive(dpy)) { |
10321 if (XineramaIsActive(dpy)) { |
10311 RETURN ( true ); |
10322 RETURN ( true ); |
10312 } |
10323 } |
10313 } |
10324 } |
10314 #endif |
10325 #endif |
10315 %}. |
10326 %}. |
10316 ^ false |
10327 ^ false |
10317 |
10328 |
10369 |
10380 |
10370 |atomSymbol atom| |
10381 |atomSymbol atom| |
10371 |
10382 |
10372 atomSymbol := aStringOrSymbol asSymbol. |
10383 atomSymbol := aStringOrSymbol asSymbol. |
10373 (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:nil) notNil]) ifTrue:[ |
10384 (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:nil) notNil]) ifTrue:[ |
10374 ^ atom. |
10385 ^ atom. |
10375 ]. |
10386 ]. |
10376 |
10387 |
10377 atom := self primAtomIDOf:atomSymbol create:create. |
10388 atom := self primAtomIDOf:atomSymbol create:create. |
10378 atom notNil ifTrue:[ |
10389 atom notNil ifTrue:[ |
10379 atoms isNil ifTrue:[ |
10390 atoms isNil ifTrue:[ |
10380 atoms := IdentityDictionary new. |
10391 atoms := IdentityDictionary new. |
10381 ]. |
10392 ]. |
10382 atoms at:atomSymbol put:atom. |
10393 atoms at:atomSymbol put:atom. |
10383 ]. |
10394 ]. |
10384 |
10395 |
10385 ^ atom |
10396 ^ atom |
10386 |
10397 |
10387 " |
10398 " |
10402 %{ |
10413 %{ |
10403 OBJ str; |
10414 OBJ str; |
10404 char *name; |
10415 char *name; |
10405 |
10416 |
10406 if (ISCONNECTED && __isAtomID(anAtomID)) { |
10417 if (ISCONNECTED && __isAtomID(anAtomID)) { |
10407 ENTER_XLIB(); |
10418 ENTER_XLIB(); |
10408 name = XGetAtomName(myDpy, __AtomVal(anAtomID)); |
10419 name = XGetAtomName(myDpy, __AtomVal(anAtomID)); |
10409 LEAVE_XLIB(); |
10420 LEAVE_XLIB(); |
10410 if (name == 0) { |
10421 if (name == 0) { |
10411 RETURN (nil); |
10422 RETURN (nil); |
10412 } |
10423 } |
10413 str = __MKSTRING(name); |
10424 str = __MKSTRING(name); |
10414 XFree(name); |
10425 XFree(name); |
10415 RETURN ( str ); |
10426 RETURN ( str ); |
10416 } |
10427 } |
10417 %}. |
10428 %}. |
10418 self primitiveFailedOrClosedConnection. |
10429 self primitiveFailedOrClosedConnection. |
10419 ^ nil |
10430 ^ nil |
10420 |
10431 |
10434 "access the displays resource database for a default value |
10445 "access the displays resource database for a default value |
10435 of name in a resource class. |
10446 of name in a resource class. |
10436 This is highly X specific and currently not used. |
10447 This is highly X specific and currently not used. |
10437 |
10448 |
10438 Notice: |
10449 Notice: |
10439 we do not plan to use X's resources for ST/X's defaults, |
10450 we do not plan to use X's resources for ST/X's defaults, |
10440 styles or resources. This would make porting of applications |
10451 styles or resources. This would make porting of applications |
10441 to different platforms much more difficult (Windows has no resource |
10452 to different platforms much more difficult (Windows has no resource |
10442 database). If you stay within ST/X's resource files, these can be |
10453 database). If you stay within ST/X's resource files, these can be |
10443 easily transported to other platforms. |
10454 easily transported to other platforms. |
10444 |
10455 |
10445 This method is provided for special applications which want to access |
10456 This method is provided for special applications which want to access |
10446 existing X resources and are not planned to be ever ported to other |
10457 existing X resources and are not planned to be ever ported to other |
10447 platforms." |
10458 platforms." |
10448 |
10459 |
10451 |
10462 |
10452 if (ISCONNECTED |
10463 if (ISCONNECTED |
10453 && __isStringLike(name) |
10464 && __isStringLike(name) |
10454 && __isStringLike(cls)) { |
10465 && __isStringLike(cls)) { |
10455 |
10466 |
10456 rslt = XGetDefault(myDpy, (char *) __stringVal(cls), |
10467 rslt = XGetDefault(myDpy, (char *) __stringVal(cls), |
10457 (char *) __stringVal(name)); |
10468 (char *) __stringVal(name)); |
10458 |
10469 |
10459 RETURN (rslt ? __MKSTRING(rslt) : nil ); |
10470 RETURN (rslt ? __MKSTRING(rslt) : nil ); |
10460 } |
10471 } |
10461 %}. |
10472 %}. |
10462 self primitiveFailedOrClosedConnection. |
10473 self primitiveFailedOrClosedConnection. |
10463 ^ nil. |
10474 ^ nil. |
10464 |
10475 |
10465 "if your ~/.Xdefaults contains an entry such as: |
10476 "if your ~/.Xdefaults contains an entry such as: |
10466 OpenWindows.Beep: notices |
10477 OpenWindows.Beep: notices |
10467 the following returns 'notices'. |
10478 the following returns 'notices'. |
10468 |
10479 |
10469 Display getResource:'Beep' class:'OpenWindows' |
10480 Display getResource:'Beep' class:'OpenWindows' |
10470 |
10481 |
10471 if your ~/.Xdefaults contains an entry such as: |
10482 if your ~/.Xdefaults contains an entry such as: |
10472 *.beNiceToColormap: false |
10483 *.beNiceToColormap: false |
10473 the following return 'false'. |
10484 the following return 'false'. |
10474 |
10485 |
10475 Display getResource:'beNiceToColormap' class:'any' |
10486 Display getResource:'beNiceToColormap' class:'any' |
10476 Display getResource:'beNiceToColormap' class:'' |
10487 Display getResource:'beNiceToColormap' class:'' |
10477 " |
10488 " |
10478 ! |
10489 ! |
10479 |
10490 |
10480 primAtomIDOf:aStringOrSymbol create:create |
10491 primAtomIDOf:aStringOrSymbol create:create |
10481 "return an Atoms ID; if create is true, create it if not already present. |
10492 "return an Atoms ID; if create is true, create it if not already present. |
10487 Atom prop; |
10498 Atom prop; |
10488 |
10499 |
10489 if (ISCONNECTED |
10500 if (ISCONNECTED |
10490 && __isStringLike(aStringOrSymbol)) { |
10501 && __isStringLike(aStringOrSymbol)) { |
10491 |
10502 |
10492 ENTER_XLIB(); |
10503 ENTER_XLIB(); |
10493 prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), |
10504 prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), |
10494 (create == true) ? False : True); |
10505 (create == true) ? False : True); |
10495 LEAVE_XLIB(); |
10506 LEAVE_XLIB(); |
10496 if (prop == None) { |
10507 if (prop == None) { |
10497 RETURN (nil); |
10508 RETURN (nil); |
10498 } |
10509 } |
10499 RETURN ( __MKATOMOBJ(prop) ); |
10510 RETURN ( __MKATOMOBJ(prop) ); |
10500 } |
10511 } |
10501 %}. |
10512 %}. |
10502 self primitiveFailedOrClosedConnection. |
10513 self primitiveFailedOrClosedConnection. |
10503 ^ nil |
10514 ^ nil |
10504 |
10515 |
10520 in advance, since the X-server is free to return whatever it thinks is a good padding." |
10531 in advance, since the X-server is free to return whatever it thinks is a good padding." |
10521 |
10532 |
10522 |rawInfo info| |
10533 |rawInfo info| |
10523 |
10534 |
10524 ((w <= 0) or:[h <= 0]) ifTrue:[ |
10535 ((w <= 0) or:[h <= 0]) ifTrue:[ |
10525 self primitiveFailed. |
10536 self primitiveFailed. |
10526 ^ nil |
10537 ^ nil |
10527 ]. |
10538 ]. |
10528 |
10539 |
10529 rawInfo := Array new:8. |
10540 rawInfo := Array new:8. |
10530 "1 -> bit order" |
10541 "1 -> bit order" |
10531 "2 -> depth" |
10542 "2 -> depth" |
10532 "3 -> bytes_per_line" |
10543 "3 -> bytes_per_line" |
10533 "4 -> byte_order" |
10544 "4 -> byte_order" |
10534 "5 -> format" |
10545 "5 -> format" |
10535 "6 -> bitmap_unit" |
10546 "6 -> bitmap_unit" |
10536 "7 -> bitmap_pad" |
10547 "7 -> bitmap_pad" |
10537 "8 -> bits_per_pixel" |
10548 "8 -> bits_per_pixel" |
10538 |
10549 |
10539 "/ had to extract the getPixel call into a separate method, to specify |
10550 "/ had to extract the getPixel call into a separate method, to specify |
10540 "/ unlimitedStack (some implementations use alloca and require huge amounts |
10551 "/ unlimitedStack (some implementations use alloca and require huge amounts |
10541 "/ of temporary stack space |
10552 "/ of temporary stack space |
10542 |
10553 |
10543 (self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[ |
10554 (self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[ |
10544 info := IdentityDictionary new. |
10555 info := IdentityDictionary new. |
10545 info at:#bitOrder put:(rawInfo at:1). |
10556 info at:#bitOrder put:(rawInfo at:1). |
10546 info at:#depth put:(rawInfo at:2). |
10557 info at:#depth put:(rawInfo at:2). |
10547 info at:#bytesPerLine put:(rawInfo at:3). |
10558 info at:#bytesPerLine put:(rawInfo at:3). |
10548 info at:#byteOrder put:(rawInfo at:4). |
10559 info at:#byteOrder put:(rawInfo at:4). |
10549 info at:#format put:(rawInfo at:5). |
10560 info at:#format put:(rawInfo at:5). |
10550 info at:#bitmapUnit put:(rawInfo at:6). |
10561 info at:#bitmapUnit put:(rawInfo at:6). |
10551 info at:#bitmapPad put:(rawInfo at:7). |
10562 info at:#bitmapPad put:(rawInfo at:7). |
10552 info at:#bitsPerPixel put:(rawInfo at:8). |
10563 info at:#bitsPerPixel put:(rawInfo at:8). |
10553 ^ info |
10564 ^ info |
10554 ]. |
10565 ]. |
10555 " |
10566 " |
10556 some error occured - either args are not smallintegers, imageBits is not a ByteArray |
10567 some error occured - either args are not smallintegers, imageBits is not a ByteArray |
10557 or is too small to hold the bits |
10568 or is too small to hold the bits |
10558 " |
10569 " |
10573 int ret; |
10584 int ret; |
10574 int xpos, ypos; |
10585 int xpos, ypos; |
10575 |
10586 |
10576 if (ISCONNECTED |
10587 if (ISCONNECTED |
10577 && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { |
10588 && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { |
10578 win = __WindowVal(aDrawableId); |
10589 win = __WindowVal(aDrawableId); |
10579 xpos = __intVal(x); |
10590 xpos = __intVal(x); |
10580 ypos = __intVal(y); |
10591 ypos = __intVal(y); |
10581 if ((xpos < 0) || (ypos < 0)) { |
10592 if ((xpos < 0) || (ypos < 0)) { |
10582 RETURN ( __MKSMALLINT(0) ); |
10593 RETURN ( __MKSMALLINT(0) ); |
10583 } |
10594 } |
10584 ENTER_XLIB(); |
10595 ENTER_XLIB(); |
10585 img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap); |
10596 img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap); |
10586 LEAVE_XLIB(); |
10597 LEAVE_XLIB(); |
10587 if (img != 0) { |
10598 if (img != 0) { |
10588 ret = XGetPixel(img, 0, 0); |
10599 ret = XGetPixel(img, 0, 0); |
10589 XDestroyImage(img); |
10600 XDestroyImage(img); |
10590 RETURN ( __MKSMALLINT(ret) ); |
10601 RETURN ( __MKSMALLINT(ret) ); |
10591 } |
10602 } |
10592 } |
10603 } |
10593 %}. |
10604 %}. |
10594 ^ nil |
10605 ^ nil |
10595 ! |
10606 ! |
10596 |
10607 |
10610 && __isExternalAddress(aDrawableId) |
10621 && __isExternalAddress(aDrawableId) |
10611 && __bothSmallInteger(srcx, srcy) |
10622 && __bothSmallInteger(srcx, srcy) |
10612 && __bothSmallInteger(w, h) |
10623 && __bothSmallInteger(w, h) |
10613 && __isArray(info) |
10624 && __isArray(info) |
10614 && __isByteArray(imageBits)) { |
10625 && __isByteArray(imageBits)) { |
10615 Display *dpy = myDpy; |
10626 Display *dpy = myDpy; |
10616 |
10627 |
10617 win = __WindowVal(aDrawableId); |
10628 win = __WindowVal(aDrawableId); |
10618 ENTER_XLIB(); |
10629 ENTER_XLIB(); |
10619 image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy), |
10630 image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy), |
10620 __intVal(w), __intVal(h), |
10631 __intVal(w), __intVal(h), |
10621 (unsigned)AllPlanes, ZPixmap); |
10632 (unsigned)AllPlanes, ZPixmap); |
10622 LEAVE_XLIB(); |
10633 LEAVE_XLIB(); |
10623 |
10634 |
10624 if (! image) { |
10635 if (! image) { |
10625 RETURN ( false ); |
10636 RETURN ( false ); |
10626 } |
10637 } |
10627 |
10638 |
10628 pad = image->bitmap_pad; |
10639 pad = image->bitmap_pad; |
10629 #ifdef SUPERDEBUG |
10640 #ifdef SUPERDEBUG |
10630 console_printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth); |
10641 console_printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth); |
10631 #endif |
10642 #endif |
10632 switch (image->depth) { |
10643 switch (image->depth) { |
10633 case 1: |
10644 case 1: |
10634 case 2: |
10645 case 2: |
10635 case 4: |
10646 case 4: |
10636 case 8: |
10647 case 8: |
10637 case 16: |
10648 case 16: |
10638 case 24: |
10649 case 24: |
10639 case 32: |
10650 case 32: |
10640 numBytes = image->bytes_per_line * image->height; |
10651 numBytes = image->bytes_per_line * image->height; |
10641 break; |
10652 break; |
10642 |
10653 |
10643 default: |
10654 default: |
10644 /* unsupported depth ? */ |
10655 /* unsupported depth ? */ |
10645 console_fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth); |
10656 console_fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth); |
10646 numBytes = image->bytes_per_line * image->height; |
10657 numBytes = image->bytes_per_line * image->height; |
10647 break; |
10658 break; |
10648 } |
10659 } |
10649 |
10660 |
10650 #ifdef SUPERDEBUG |
10661 #ifdef SUPERDEBUG |
10651 console_printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits)); |
10662 console_printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits)); |
10652 #endif |
10663 #endif |
10653 |
10664 |
10654 if (numBytes > __byteArraySize(imageBits)) { |
10665 if (numBytes > __byteArraySize(imageBits)) { |
10655 /* imageBits too small */ |
10666 /* imageBits too small */ |
10656 console_fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n"); |
10667 console_fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n"); |
10657 console_fprintf(stderr, " bytes need:%d given:%d\n", numBytes, (int)__byteArraySize(imageBits)); |
10668 console_fprintf(stderr, " bytes need:%d given:%d\n", numBytes, (int)__byteArraySize(imageBits)); |
10658 console_fprintf(stderr, " pad:%d depth:%d imgBytesPerLine:%d\n", |
10669 console_fprintf(stderr, " pad:%d depth:%d imgBytesPerLine:%d\n", |
10659 image->bitmap_pad, image->depth, image->bytes_per_line); |
10670 image->bitmap_pad, image->depth, image->bytes_per_line); |
10660 goto fail; |
10671 goto fail; |
10661 } |
10672 } |
10662 if (image->bitmap_bit_order == MSBFirst) |
10673 if (image->bitmap_bit_order == MSBFirst) |
10663 __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst); |
10674 __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst); |
10664 else |
10675 else |
10665 __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst); |
10676 __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst); |
10666 __ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth); |
10677 __ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth); |
10667 __ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line); |
10678 __ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line); |
10668 if (image->byte_order == MSBFirst) |
10679 if (image->byte_order == MSBFirst) |
10669 __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst); |
10680 __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst); |
10670 else |
10681 else |
10671 __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst); |
10682 __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst); |
10672 if (image->format == XYBitmap) |
10683 if (image->format == XYBitmap) |
10673 __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap); |
10684 __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap); |
10674 else if (image->format == XYPixmap) |
10685 else if (image->format == XYPixmap) |
10675 __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap); |
10686 __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap); |
10676 else if (image->format == ZPixmap) |
10687 else if (image->format == ZPixmap) |
10677 __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap); |
10688 __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap); |
10678 |
10689 |
10679 __ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit); |
10690 __ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit); |
10680 __ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad); |
10691 __ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad); |
10681 __ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel); |
10692 __ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel); |
10682 bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes); |
10693 bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes); |
10683 XDestroyImage(image); |
10694 XDestroyImage(image); |
10684 RETURN ( true ); |
10695 RETURN ( true ); |
10685 } |
10696 } |
10686 fail: |
10697 fail: |
10687 if (image) { |
10698 if (image) { |
10688 XDestroyImage(image); |
10699 XDestroyImage(image); |
10689 } |
10700 } |
10690 %}. |
10701 %}. |
10691 ^ false |
10702 ^ false |
10692 ! ! |
10703 ! ! |
10693 |
10704 |
10701 |
10712 |
10702 |selectionOwnerWindowId selection| |
10713 |selectionOwnerWindowId selection| |
10703 |
10714 |
10704 selectionOwnerWindowId := self getSelectionOwnerOf:clipboardAtom. |
10715 selectionOwnerWindowId := self getSelectionOwnerOf:clipboardAtom. |
10705 selectionOwnerWindowId isNil ifTrue:[ |
10716 selectionOwnerWindowId isNil ifTrue:[ |
10706 "no selection. There is the possibilty that one of our (modal) |
10717 "no selection. There is the possibilty that one of our (modal) |
10707 views has been closed. Get the selection from the copyBuffer" |
10718 views has been closed. Get the selection from the copyBuffer" |
10708 ^ copyBuffer. |
10719 ^ copyBuffer. |
10709 ]. |
10720 ]. |
10710 selectionOwnerWindowId = selectionOwner ifTrue:[ |
10721 selectionOwnerWindowId = selectionOwner ifTrue:[ |
10711 "I still hold the selection, so return my locally buffered data" |
10722 "I still hold the selection, so return my locally buffered data" |
10712 ^ copyBuffer |
10723 ^ copyBuffer |
10713 ]. |
10724 ]. |
10714 |
10725 |
10715 drawableId notNil ifTrue:[ |
10726 drawableId notNil ifTrue:[ |
10716 "sorry, cannot fetch a selection, if there is no drawableId. |
10727 "sorry, cannot fetch a selection, if there is no drawableId. |
10717 Should I borrow a drawableId from another window?" |
10728 Should I borrow a drawableId from another window?" |
10718 |
10729 |
10719 selection := SelectionFetcher |
10730 selection := SelectionFetcher |
10720 requestSelection:clipboardAtom |
10731 requestSelection:clipboardAtom |
10721 type:(self atomIDOf:#'ST_OBJECT') |
10732 type:(self atomIDOf:#'ST_OBJECT') |
10722 onDevice:self for:drawableId. |
10733 onDevice:self for:drawableId. |
10723 |
10734 |
10724 "/ should not happen |
10735 "/ should not happen |
10725 false ifTrue:[ |
10736 false ifTrue:[ |
10726 "/ cg: disabled the code below: I don't want any string here (when asking for an object) |
10737 "/ cg: disabled the code below: I don't want any string here (when asking for an object) |
10727 selection isEmptyOrNil ifTrue:[ |
10738 selection isEmptyOrNil ifTrue:[ |
10728 selection := SelectionFetcher |
10739 selection := SelectionFetcher |
10729 requestSelection:clipboardAtom |
10740 requestSelection:clipboardAtom |
10730 type:(self atomIDOf:#'UTF8_STRING') |
10741 type:(self atomIDOf:#'UTF8_STRING') |
10731 onDevice:self for:drawableId. |
10742 onDevice:self for:drawableId. |
10732 |
10743 |
10733 selection isNil ifTrue:[ |
10744 selection isNil ifTrue:[ |
10734 selection := SelectionFetcher |
10745 selection := SelectionFetcher |
10735 requestSelection:clipboardAtom |
10746 requestSelection:clipboardAtom |
10736 type:(self atomIDOf:#STRING) |
10747 type:(self atomIDOf:#STRING) |
10737 onDevice:self for:drawableId. |
10748 onDevice:self for:drawableId. |
10738 ]. |
10749 ]. |
10739 ]. |
10750 ]. |
10740 ]. |
10751 ]. |
10741 ]. |
10752 ]. |
10742 selection isEmptyOrNil ifTrue:[ ^ copyBuffer ]. |
10753 selection isEmptyOrNil ifTrue:[ ^ copyBuffer ]. |
10743 |
10754 |
10744 ^ selection. |
10755 ^ selection. |
10753 Returns nil, if no selection is available" |
10764 Returns nil, if no selection is available" |
10754 |
10765 |
10755 |selectionId selectionOwnerWindowId selection| |
10766 |selectionId selectionOwnerWindowId selection| |
10756 |
10767 |
10757 selectionBufferSymbol == #selection ifTrue:[ |
10768 selectionBufferSymbol == #selection ifTrue:[ |
10758 selectionId := primaryAtom. |
10769 selectionId := primaryAtom. |
10759 ] ifFalse:[ |
10770 ] ifFalse:[ |
10760 selectionId := clipboardAtom. |
10771 selectionId := clipboardAtom. |
10761 ]. |
10772 ]. |
10762 |
10773 |
10763 selectionOwnerWindowId := self getSelectionOwnerOf:selectionId. |
10774 selectionOwnerWindowId := self getSelectionOwnerOf:selectionId. |
10764 selectionOwnerWindowId isNil ifTrue:[ |
10775 selectionOwnerWindowId isNil ifTrue:[ |
10765 "no selection. There is the possibilty that one of our (modal) |
10776 "no selection. There is the possibilty that one of our (modal) |
10766 views has been closed. Get the selection from the copyBuffer" |
10777 views has been closed. Get the selection from the copyBuffer" |
10767 ^ self copyBufferAsString. |
10778 ^ self copyBufferAsString. |
10768 ]. |
10779 ]. |
10769 |
10780 |
10770 selectionOwnerWindowId = selectionOwner ifTrue:[ |
10781 selectionOwnerWindowId = selectionOwner ifTrue:[ |
10771 "I still hold the selection, so return my locally buffered data" |
10782 "I still hold the selection, so return my locally buffered data" |
10772 "JV@2012-04-02: Added support for PRIMARY/SELECTION buffers." |
10783 "JV@2012-04-02: Added support for PRIMARY/SELECTION buffers." |
10773 ^ selectionId == primaryAtom ifTrue:[ |
10784 ^ selectionId == primaryAtom ifTrue:[ |
10774 self primaryBufferAsString |
10785 self primaryBufferAsString |
10775 ] ifFalse:[ |
10786 ] ifFalse:[ |
10776 self copyBufferAsString. |
10787 self copyBufferAsString. |
10777 ] |
10788 ] |
10778 ]. |
10789 ]. |
10779 |
10790 |
10780 drawableId notNil ifTrue:[ |
10791 drawableId notNil ifTrue:[ |
10781 "sorry, cannot fetch a selection, if there is no drawableId. |
10792 "sorry, cannot fetch a selection, if there is no drawableId. |
10782 Should I borrow a drawableId from another window?" |
10793 Should I borrow a drawableId from another window?" |
10783 |
10794 |
10784 selection := SelectionFetcher |
10795 selection := SelectionFetcher |
10785 requestSelection:selectionId |
10796 requestSelection:selectionId |
10786 type:(self atomIDOf:#'UTF8_STRING') |
10797 type:(self atomIDOf:#'UTF8_STRING') |
10787 onDevice:self for:drawableId. |
10798 onDevice:self for:drawableId. |
10788 |
10799 |
10789 selection isNil ifTrue:[ |
10800 selection isNil ifTrue:[ |
10790 selection := SelectionFetcher |
10801 selection := SelectionFetcher |
10791 requestSelection:selectionId |
10802 requestSelection:selectionId |
10792 type:(self atomIDOf:#STRING) |
10803 type:(self atomIDOf:#STRING) |
10793 onDevice:self for:drawableId. |
10804 onDevice:self for:drawableId. |
10794 ]. |
10805 ]. |
10795 ]. |
10806 ]. |
10796 |
10807 |
10797 ^ selection |
10808 ^ selection |
10798 |
10809 |
10799 " |
10810 " |
10804 "Modified: / 02-04-2012 / 10:34:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10815 "Modified: / 02-04-2012 / 10:34:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10805 ! ! |
10816 ! ! |
10806 |
10817 |
10807 !XWorkstation methodsFor:'selection sending'! |
10818 !XWorkstation methodsFor:'selection sending'! |
10808 |
10819 |
10809 copyBufferAs:aTargetAtom |
10820 selectionBuffer:bufferGetSelector as:aTargetAtomID |
10810 "convert the current selection to the format defined by aTargetAtom. |
10821 "convert the current selection to the format defined by aTargetAtom. |
10811 Answer the converted selection" |
10822 Answer an association with the type of converted selection (an atomID) |
10812 |
10823 and the converted selection" |
10813 (aTargetAtom == (self atomIDOf:#STRING)) ifTrue:[ |
10824 |
10814 "/ 'string' printCR. |
10825 |buffer bufferAsString| |
10815 "the other view wants the selection as string" |
10826 |
10816 ^ self copyBufferAsString. |
10827 buffer := self perform:bufferGetSelector. |
10817 ]. |
10828 |
10818 |
10829 (aTargetAtomID == (self atomIDOf:#'ST_OBJECT')) ifTrue:[ |
10819 (aTargetAtom == (self atomIDOf:#UTF8_STRING)) ifTrue:[ |
10830 "/ 'st-object' printCR. |
10820 "/ 'utf string' printCR. |
10831 "send the selection in binaryStore format" |
10821 "the other view wants the selection as utf8 string" |
10832 "require libboss to be loaded" |
10822 ^ self copyBufferAsString utf8Encoded. |
10833 (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[ |
10823 ]. |
10834 'XWorkstation: cannot use binary store for copy buffer (libboss missing)' errorPrintCR. |
10824 |
10835 ^ nil -> nil. |
10825 (aTargetAtom == (self atomIDOf:#TIMESTAMP)) ifTrue:[ |
10836 ]. |
10826 "the other view wants to know when we acquired ownership of the selection" |
10837 |
10827 ^ selectionTime. |
10838 [ |
10828 ]. |
10839 ^ aTargetAtomID -> (buffer binaryStoreBytes). |
10829 |
10840 ] on:Error do:[:ex| |
10830 (aTargetAtom == (self atomIDOf:#TARGETS)) ifTrue:[ |
10841 'XWorkstation: error on binary store of copy buffer: ' errorPrint. |
10831 "the other view wants to know which targets we support" |
10842 ex description errorPrintCR. |
10832 ^ self supportedTargetAtoms. |
10843 ^ nil. |
10833 ]. |
10844 ]. |
10834 |
10845 ]. |
10835 (aTargetAtom == (self atomIDOf:#'ST_OBJECT')) ifTrue:[ |
10846 |
10836 "/ 'st-object' printCR. |
10847 bufferAsString := self class bufferAsString:buffer. |
10837 "send the selection in binaryStore format" |
10848 |
10838 "require libboss to be loaded" |
10849 (aTargetAtomID == (self atomIDOf:#STRING) |
10839 (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[ |
10850 or:[aTargetAtomID == (self atomIDOf:#'text/plain')] |
10840 'XWorkstation: cannot use binary store for copy buffer (libboss missing)' errorPrintCR. |
10851 ) ifTrue:[ |
10841 ^ nil |
10852 "/ 'string' printCR. |
10842 ]. |
10853 "the other view wants the selection as string" |
10843 |
10854 ^ aTargetAtomID -> (bufferAsString asSingleByteStringReplaceInvalidWith:$#). |
10844 [ |
10855 ]. |
10845 ^ self getCopyBuffer binaryStoreBytes. |
10856 |
10846 ] on:Error do:[:ex| |
10857 (aTargetAtomID == (self atomIDOf:#UTF8_STRING) |
10847 'XWorkstation: error on binary store of copy buffer: ' errorPrint. |
10858 or:[aTargetAtomID == (self atomIDOf:#'text/plain;codeset=utf-8')] |
10848 ex description errorPrintCR. |
10859 ) ifTrue:[ |
10849 ^ nil. |
10860 "/ 'utf string' printCR. |
10850 ]. |
10861 "the other view wants the selection as utf8 string" |
10851 ]. |
10862 ^ aTargetAtomID -> (bufferAsString utf8Encoded). |
10852 |
10863 ]. |
10853 aTargetAtom == (self atomIDOf:#LENGTH) ifTrue:[ |
10864 |
10854 "the other one wants to know the size of our selection. |
10865 aTargetAtomID == (self atomIDOf:#LENGTH) ifTrue:[ |
10855 LENGTH is deprecated, since we do not know how the selection is |
10866 "the other one wants to know the size of our selection. |
10856 going to be converted. The client must not rely on the length returned" |
10867 LENGTH is deprecated, since we do not know how the selection is |
10857 |
10868 going to be converted. The client must not rely on the length returned" |
10858 ^ self copyBufferAsString size |
10869 |
10870 ^ (self atomIDOf:#INTEGER) -> (bufferAsString size). |
|
10859 ]. |
10871 ]. |
10860 |
10872 |
10861 "we do not support the requestet target type" |
10873 "we do not support the requestet target type" |
10862 ^ nil. |
10874 ^ nil -> nil. |
10863 |
10875 |
10864 "Modified: / 23-08-2006 / 15:56:08 / cg" |
10876 "Modified: / 23-08-2006 / 15:56:08 / cg" |
10865 ! |
|
10866 |
|
10867 primaryBufferAs:aTargetAtom |
|
10868 "convert the current selection to the format defined by aTargetAtom. |
|
10869 Answer the converted selection" |
|
10870 |
|
10871 (aTargetAtom == (self atomIDOf:#STRING)) ifTrue:[ |
|
10872 "the other view wants the selection as string" |
|
10873 ^ self primaryBufferAsString. |
|
10874 ]. |
|
10875 |
|
10876 (aTargetAtom == (self atomIDOf:#UTF8_STRING)) ifTrue:[ |
|
10877 "the other view wants the selection as utf8 string" |
|
10878 ^ self primaryBufferAsString utf8Encoded. |
|
10879 ]. |
|
10880 |
|
10881 (aTargetAtom == (self atomIDOf:#TIMESTAMP)) ifTrue:[ |
|
10882 "the other view wants to know when we acquired ownership of the selection" |
|
10883 ^ selectionTime. |
|
10884 ]. |
|
10885 |
|
10886 (aTargetAtom == (self atomIDOf:#TARGETS)) ifTrue:[ |
|
10887 "the other view wants to know which targets we support" |
|
10888 ^ self supportedTargetAtoms copyWithoutFirst "/we do not support ST_OBJECT in primary |
|
10889 ]. |
|
10890 |
|
10891 aTargetAtom == (self atomIDOf:#LENGTH) ifTrue:[ |
|
10892 "the other one wants to know the size of our selection. |
|
10893 LENGTH is deprecated, since we do not know how the selection is |
|
10894 going to be converted. The client must not rely on the length returned" |
|
10895 |
|
10896 ^ self primaryBufferAsString size |
|
10897 ]. |
|
10898 |
|
10899 "we do not support the requestet target type" |
|
10900 ^ nil. |
|
10901 |
|
10902 "Modified: / 23-08-2006 / 15:56:08 / cg" |
|
10903 "Created: / 27-03-2012 / 14:49:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10904 ! |
10877 ! |
10905 |
10878 |
10906 setClipboardObject:anObject owner:aWindowId |
10879 setClipboardObject:anObject owner:aWindowId |
10907 "set the object selection, and make aWindowId be the owner. |
10880 "set the object selection, and make aWindowId be the owner. |
10908 This can be used by other Smalltalk(X) applications only. |
10881 This can be used by other Smalltalk(X) applications only. |
10909 We set only the CLIPBOARD selection" |
10882 We set only the CLIPBOARD selection" |
10910 |
10883 |
10911 selectionTime := lastEventTime. |
10884 clipboardSelectionTime := lastEventTime. |
10912 self setSelectionOwner:aWindowId of:clipboardAtom time:selectionTime |
10885 self setSelectionOwner:aWindowId of:clipboardAtom time:clipboardSelectionTime |
10913 ! |
10886 ! |
10914 |
10887 |
10915 setClipboardText:aString owner:aWindowId |
10888 setClipboardText:aString owner:aWindowId |
10916 "set the text selection, and make aWindowId be the owner. |
10889 "set the text selection, and make aWindowId be the owner. |
10917 This can be used by any other X application. |
10890 This can be used by any other X application. |
10918 |
10891 |
10919 We set both the PRIMARY and CLIPBOARD, so that you can paste |
10892 We set both the PRIMARY and CLIPBOARD, so that you can paste |
10920 into xterm." |
10893 into xterm." |
10921 |
10894 |
10922 selectionTime := lastEventTime. |
10895 clipboardSelectionTime := primarySelectionTime := lastEventTime. |
10923 |
10896 |
10924 self setSelectionOwner:aWindowId of:clipboardAtom time:selectionTime. |
10897 self setSelectionOwner:aWindowId of:clipboardAtom time:clipboardSelectionTime. |
10925 self setSelectionOwner:aWindowId of:primaryAtom time:selectionTime. |
10898 self setSelectionOwner:aWindowId of:primaryAtom time:primarySelectionTime. |
10926 |
10899 |
10927 "Modified: / 17.6.1998 / 19:48:54 / cg" |
10900 "Modified: / 17.6.1998 / 19:48:54 / cg" |
10928 ! |
10901 ! |
10929 |
10902 |
10930 setPrimaryText:aString owner:aWindowId |
10903 setPrimaryText:aString owner:aWindowId |
10931 "set the PRIMARY selection, and make aWindowId be the owner. |
10904 "set the PRIMARY selection, and make aWindowId be the owner. |
10932 This can be used by any other X application when middle-click |
10905 This can be used by any other X application when middle-click |
10933 pasting. X Window specific." |
10906 pasting. X Window specific." |
10934 |
10907 |
10935 selectionTime := lastEventTime. |
10908 primarySelectionTime := lastEventTime. |
10936 |
10909 |
10937 self setSelectionOwner:aWindowId of:primaryAtom time:selectionTime. |
10910 self setSelectionOwner:aWindowId of:primaryAtom time:primarySelectionTime. |
10938 |
10911 |
10939 "Created: / 27-03-2012 / 14:16:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10912 "Created: / 27-03-2012 / 14:16:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10940 ! |
10913 ! |
10941 |
10914 |
10942 supportedTargetAtoms |
10915 supportedTargetAtoms |
10943 "answer an integer array containing the list of supported targets |
10916 "answer an integer array containing the list of supported targets |
10944 i.e. supported clipboard formats" |
10917 i.e. supported clipboard formats" |
10945 |
10918 |
10946 |supportedTargets numericTargetArray| |
|
10947 |
|
10948 "Note: some sender code assumes that ST_OBJECT is first" |
10919 "Note: some sender code assumes that ST_OBJECT is first" |
10949 supportedTargets := #(ST_OBJECT STRING UTF8_STRING TIMESTAMP TARGETS LENGTH). |
10920 ^ #(ST_OBJECT STRING UTF8_STRING TIMESTAMP TARGETS LENGTH |
10950 |
10921 #'text/plain' #'text/plain;codeset=utf-8' |
10951 numericTargetArray := IntegerArray new:supportedTargets size. |
10922 ) collect:[:eachTargetSymbol| |
10952 supportedTargets keysAndValuesDo:[:index :targetSymbol| |
10923 self atomIDOf:eachTargetSymbol |
10953 numericTargetArray at:index put:(self atomIDOf:targetSymbol) |
10924 ] as:IntegerArray. |
10954 ]. |
|
10955 |
|
10956 ^ numericTargetArray |
|
10957 ! ! |
10925 ! ! |
10958 |
10926 |
10959 !XWorkstation methodsFor:'selections-basic'! |
10927 !XWorkstation methodsFor:'selections-basic'! |
10960 |
10928 |
10961 getSelectionOwnerOf:selectionAtomSymbolOrID |
10929 getSelectionOwnerOf:selectionAtomSymbolOrID |
10965 <context:#return> |
10933 <context:#return> |
10966 |
10934 |
10967 |selectionAtomID| |
10935 |selectionAtomID| |
10968 |
10936 |
10969 selectionAtomSymbolOrID isString ifTrue:[ |
10937 selectionAtomSymbolOrID isString ifTrue:[ |
10970 selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false. |
10938 selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false. |
10971 ] ifFalse:[ |
10939 ] ifFalse:[ |
10972 selectionAtomID := selectionAtomSymbolOrID. |
10940 selectionAtomID := selectionAtomSymbolOrID. |
10973 ]. |
10941 ]. |
10974 |
10942 |
10975 %{ |
10943 %{ |
10976 Window window; |
10944 Window window; |
10977 |
10945 |
10978 if (__isAtomID(selectionAtomID) && ISCONNECTED) { |
10946 if (__isAtomID(selectionAtomID) && ISCONNECTED) { |
10979 Display *dpy = myDpy; |
10947 Display *dpy = myDpy; |
10980 |
10948 |
10981 ENTER_XLIB(); |
10949 ENTER_XLIB(); |
10982 window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID)); |
10950 window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID)); |
10983 LEAVE_XLIB(); |
10951 LEAVE_XLIB(); |
10984 RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window)); |
10952 RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window)); |
10985 } |
10953 } |
10986 %}. |
10954 %}. |
10987 self primitiveFailedOrClosedConnection. |
10955 self primitiveFailedOrClosedConnection. |
10988 ^ nil |
10956 ^ nil |
10989 ! |
10957 ! |
11003 |
10971 |
11004 if (ISCONNECTED |
10972 if (ISCONNECTED |
11005 && __isAtomID(typeID) |
10973 && __isAtomID(typeID) |
11006 && __isAtomID(propertyID) |
10974 && __isAtomID(propertyID) |
11007 && __isAtomID(selectionID)) { |
10975 && __isAtomID(selectionID)) { |
11008 Display *dpy = myDpy; |
10976 Display *dpy = myDpy; |
11009 Window w; |
10977 Window w; |
11010 Time time; |
10978 Time time; |
11011 |
10979 |
11012 if (__isExternalAddress(aWindowId)) { |
10980 if (__isExternalAddress(aWindowId)) { |
11013 w = __WindowVal(aWindowId); |
10981 w = __WindowVal(aWindowId); |
11014 } else if (aWindowId == nil) { |
10982 } else if (aWindowId == nil) { |
11015 w = (Window)0; |
10983 w = (Window)0; |
11016 } else |
10984 } else |
11017 goto err; |
10985 goto err; |
11018 |
10986 |
11019 if (anIntegerTimestamp == nil) { |
10987 if (anIntegerTimestamp == nil) { |
11020 /* |
10988 /* |
11021 * the ICCCM convention says: you should set the time to the time when |
10989 * the ICCCM convention says: you should set the time to the time when |
11022 * the selection was requested and not to CurrentTime |
10990 * the selection was requested and not to CurrentTime |
11023 */ |
10991 */ |
11024 time = CurrentTime; |
10992 time = CurrentTime; |
11025 } else if (__isInteger(anIntegerTimestamp)) { |
10993 } else if (__isInteger(anIntegerTimestamp)) { |
11026 time = __unsignedLongIntVal(anIntegerTimestamp); |
10994 time = __unsignedLongIntVal(anIntegerTimestamp); |
11027 } else |
10995 } else |
11028 goto err; |
10996 goto err; |
11029 |
10997 |
11030 ENTER_XLIB(); |
10998 ENTER_XLIB(); |
11031 XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID), |
10999 XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID), |
11032 __AtomVal(propertyID), w, time); |
11000 __AtomVal(propertyID), w, time); |
11033 LEAVE_XLIB(); |
11001 LEAVE_XLIB(); |
11034 |
11002 |
11035 RETURN (true); |
11003 RETURN (true); |
11036 err:; |
11004 err:; |
11037 } |
11005 } |
11038 %}. |
11006 %}. |
11039 self primitiveFailedOrClosedConnection. |
11007 self primitiveFailedOrClosedConnection. |
11040 ^ false |
11008 ^ false |
11041 |
11009 |
11042 " |
11010 " |
11043 Display |
11011 Display |
11044 requestSelection:(Display atomIDOf:'PRIMARY') |
11012 requestSelection:(Display atomIDOf:'PRIMARY') |
11045 property:(Display atomIDOf:'VT_SELECTION') |
11013 property:(Display atomIDOf:'VT_SELECTION') |
11046 type:(Display atomIDOf:'STRING') |
11014 type:(Display atomIDOf:'STRING') |
11047 for:Transcript id |
11015 for:Transcript id |
11048 " |
11016 " |
11049 " |
11017 " |
11050 Display |
11018 Display |
11051 requestSelection:(Display atomIDOf:'PRIMARY') |
11019 requestSelection:(Display atomIDOf:'PRIMARY') |
11052 property:(Display atomIDOf:'VT_SELECTION') |
11020 property:(Display atomIDOf:'VT_SELECTION') |
11053 type:(Display atomIDOf:'C_STRING') |
11021 type:(Display atomIDOf:'C_STRING') |
11054 for:Transcript id |
11022 for:Transcript id |
11055 " |
11023 " |
11056 ! |
11024 ! |
11057 |
11025 |
11058 sendNotifySelection:selectionID property:propertyID target:targetID time:aTime to:requestorID |
11026 sendNotifySelection:selectionID property:propertyID target:targetID time:aTime to:requestorID |
11059 "send a selectionNotify back from a SelectionRequest. |
11027 "send a selectionNotify back from a SelectionRequest. |
11063 Time should be the time when the selection has been acquired" |
11031 Time should be the time when the selection has been acquired" |
11064 |
11032 |
11065 <context: #return> |
11033 <context: #return> |
11066 %{ |
11034 %{ |
11067 if (ISCONNECTED |
11035 if (ISCONNECTED |
11068 && (__isAtomID(propertyID) || propertyID == nil) |
11036 && (__isAtomID(propertyID) || propertyID == nil) |
11069 && __isAtomID(targetID) && __isAtomID(selectionID)) { |
11037 && __isAtomID(targetID) && __isAtomID(selectionID)) { |
11070 Display *dpy = myDpy; |
11038 Display *dpy = myDpy; |
11071 XEvent ev; |
11039 XEvent ev; |
11072 Window requestor; |
11040 Window requestor; |
11073 Status result; |
11041 Status result; |
11074 |
11042 |
11075 if (__isExternalAddress(requestorID)) { |
11043 if (__isExternalAddress(requestorID)) { |
11076 requestor = __WindowVal(requestorID); |
11044 requestor = __WindowVal(requestorID); |
11077 } else if (__isSmallInteger(requestorID)) { |
11045 } else if (__isSmallInteger(requestorID)) { |
11078 requestor = (Window)__smallIntegerVal(requestorID); |
11046 requestor = (Window)__smallIntegerVal(requestorID); |
11079 } else if (requestorID == nil) { |
11047 } else if (requestorID == nil) { |
11080 requestor = DefaultRootWindow(dpy); |
11048 requestor = DefaultRootWindow(dpy); |
11081 } else { |
11049 } else { |
11082 requestor = (Window)__unsignedLongIntVal(requestorID); |
11050 requestor = (Window)__unsignedLongIntVal(requestorID); |
11083 } |
11051 } |
11084 |
11052 |
11085 ev.xselection.type = SelectionNotify; |
11053 ev.xselection.type = SelectionNotify; |
11086 ev.xselection.display = dpy; |
11054 ev.xselection.display = dpy; |
11087 ev.xselection.selection = __AtomVal(selectionID); |
11055 ev.xselection.selection = __AtomVal(selectionID); |
11088 ev.xselection.target = __AtomVal(targetID); |
11056 ev.xselection.target = __AtomVal(targetID); |
11089 ev.xselection.requestor = requestor; |
11057 ev.xselection.requestor = requestor; |
11090 |
11058 |
11091 if (__isExternalAddress(aTime)) { |
11059 if (__isExternalAddress(aTime)) { |
11092 ev.xselection.time = (INT)(__externalAddressVal(aTime)); |
11060 ev.xselection.time = (INT)(__externalAddressVal(aTime)); |
11093 } else if (__isSmallInteger(aTime)) { |
11061 } else if (__isSmallInteger(aTime)) { |
11094 ev.xselection.time = __smallIntegerVal(aTime); |
11062 ev.xselection.time = __smallIntegerVal(aTime); |
11095 } else if (aTime == nil) { |
11063 } else if (aTime == nil) { |
11096 ev.xselection.time = CurrentTime; |
11064 ev.xselection.time = CurrentTime; |
11097 } else { |
11065 } else { |
11098 ev.xselection.time = (INT)__unsignedLongIntVal(aTime); |
11066 ev.xselection.time = (INT)__unsignedLongIntVal(aTime); |
11099 } |
11067 } |
11100 #if 0 |
11068 #if 0 |
11101 console_printf("ev.xselection.selection: %x\n", ev.xselection.selection); |
11069 console_printf("ev.xselection.selection: %x\n", ev.xselection.selection); |
11102 console_printf("ev.xselection.target: %x\n", ev.xselection.target); |
11070 console_printf("ev.xselection.target: %x\n", ev.xselection.target); |
11103 console_printf("ev.xselection.requestor: %x\n", ev.xselection.requestor); |
11071 console_printf("ev.xselection.requestor: %x\n", ev.xselection.requestor); |
11104 console_printf("ev.xselection.time: %x\n", ev.xselection.time); |
11072 console_printf("ev.xselection.time: %x\n", ev.xselection.time); |
11105 console_printf("requestor: %x\n", requestor); |
11073 console_printf("requestor: %x\n", requestor); |
11106 #endif |
11074 #endif |
11107 |
11075 |
11108 /* send nil property if selection cannot be converted */ |
11076 /* send nil property if selection cannot be converted */ |
11109 if (propertyID == nil) |
11077 if (propertyID == nil) |
11110 ev.xselection.property = None; |
11078 ev.xselection.property = None; |
11111 else |
11079 else |
11112 ev.xselection.property = __AtomVal(propertyID); |
11080 ev.xselection.property = __AtomVal(propertyID); |
11113 |
11081 |
11114 |
11082 |
11115 DPRINTF(("sending SelectionNotify sel=%"_lx_" prop=%"_lx_" target=%"_lx_" requestor=%"_lx_" to %"_lx_"\n", |
11083 DPRINTF(("sending SelectionNotify sel=%"_lx_" prop=%"_lx_" target=%"_lx_" requestor=%"_lx_" to %"_lx_"\n", |
11116 (INT)ev.xselection.selection, |
11084 (INT)ev.xselection.selection, |
11117 (INT)ev.xselection.property, |
11085 (INT)ev.xselection.property, |
11118 (INT)ev.xselection.target, |
11086 (INT)ev.xselection.target, |
11119 (INT)ev.xselection.requestor, |
11087 (INT)ev.xselection.requestor, |
11120 (INT)requestor)); |
11088 (INT)requestor)); |
11121 |
11089 |
11122 ENTER_XLIB(); |
11090 ENTER_XLIB(); |
11123 result = XSendEvent(dpy, requestor, False, 0 , &ev); |
11091 result = XSendEvent(dpy, requestor, False, 0 , &ev); |
11124 LEAVE_XLIB(); |
11092 LEAVE_XLIB(); |
11125 |
11093 |
11126 if ((result == BadValue) || (result == BadWindow)) { |
11094 if ((result == BadValue) || (result == BadWindow)) { |
11127 DPRINTF(("bad status\n")); |
11095 DPRINTF(("bad status\n")); |
11128 RETURN (false); |
11096 RETURN (false); |
11129 } |
11097 } |
11130 ENTER_XLIB(); |
11098 ENTER_XLIB(); |
11131 XFlush(dpy); |
11099 XFlush(dpy); |
11132 LEAVE_XLIB(); |
11100 LEAVE_XLIB(); |
11133 RETURN (true) |
11101 RETURN (true) |
11134 } |
11102 } |
11135 %}. |
11103 %}. |
11136 self primitiveFailedOrClosedConnection. |
11104 self primitiveFailedOrClosedConnection. |
11137 ^ false |
11105 ^ false |
11138 |
11106 |
11151 we can avoid the X11 overhead" |
11119 we can avoid the X11 overhead" |
11152 |
11120 |
11153 selectionOwner := aWindowId. |
11121 selectionOwner := aWindowId. |
11154 |
11122 |
11155 selectionAtomSymbolOrID isString ifTrue:[ |
11123 selectionAtomSymbolOrID isString ifTrue:[ |
11156 selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false. |
11124 selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false. |
11157 ] ifFalse:[ |
11125 ] ifFalse:[ |
11158 selectionAtomID := selectionAtomSymbolOrID. |
11126 selectionAtomID := selectionAtomSymbolOrID. |
11159 ]. |
11127 ]. |
11160 |
11128 |
11161 %{ |
11129 %{ |
11162 Window win; |
11130 Window win; |
11163 |
11131 |
11164 if (__isExternalAddress(aWindowId) |
11132 if (__isExternalAddress(aWindowId) |
11165 && __isAtomID(selectionAtomID) |
11133 && __isAtomID(selectionAtomID) |
11166 && ISCONNECTED) { |
11134 && ISCONNECTED) { |
11167 Display *dpy = myDpy; |
11135 Display *dpy = myDpy; |
11168 Time time; |
11136 Time time; |
11169 |
11137 |
11170 win = __WindowVal(aWindowId); |
11138 win = __WindowVal(aWindowId); |
11171 |
11139 |
11172 if (anIntegerTimestamp == nil) { |
11140 if (anIntegerTimestamp == nil) { |
11173 /* |
11141 /* |
11174 * the ICCCM convention says: you should set the time to the time when |
11142 * the ICCCM convention says: you should set the time to the time when |
11175 * the selection was acquired and not to CurrentTime |
11143 * the selection was acquired and not to CurrentTime |
11176 */ |
11144 */ |
11177 time = CurrentTime; |
11145 time = CurrentTime; |
11178 } else if (__isInteger(anIntegerTimestamp)) { |
11146 } else if (__isInteger(anIntegerTimestamp)) { |
11179 time = __unsignedLongIntVal(anIntegerTimestamp); |
11147 time = __unsignedLongIntVal(anIntegerTimestamp); |
11180 } else |
11148 } else |
11181 goto err; |
11149 goto err; |
11182 |
11150 |
11183 DPRINTF(("setOwner prop=%"_lx_" win=%"_lx_"\n", (INT)__AtomVal(selectionAtomID), (INT)win)); |
11151 DPRINTF(("setOwner prop=%"_lx_" win=%"_lx_"\n", (INT)__AtomVal(selectionAtomID), (INT)win)); |
11184 ENTER_XLIB(); |
11152 ENTER_XLIB(); |
11185 XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, time); |
11153 XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, time); |
11186 RETURN (self); |
11154 RETURN (self); |
11187 LEAVE_XLIB(); |
11155 LEAVE_XLIB(); |
11188 } |
11156 } |
11189 err:; |
11157 err:; |
11190 %}. |
11158 %}. |
11191 self primitiveFailedOrClosedConnection. |
11159 self primitiveFailedOrClosedConnection. |
11192 ! ! |
11160 ! ! |
11200 |childIDs allChildIDs| |
11168 |childIDs allChildIDs| |
11201 |
11169 |
11202 allChildIDs := OrderedCollection new. |
11170 allChildIDs := OrderedCollection new. |
11203 childIDs := self childIdsOf:aWindowId. |
11171 childIDs := self childIdsOf:aWindowId. |
11204 childIDs notNil ifTrue:[ |
11172 childIDs notNil ifTrue:[ |
11205 allChildIDs addAll:childIDs. |
11173 allChildIDs addAll:childIDs. |
11206 childIDs do:[:eachChildId | |
11174 childIDs do:[:eachChildId | |
11207 allChildIDs addAll:(self allChildIdsOf:eachChildId). |
11175 allChildIDs addAll:(self allChildIdsOf:eachChildId). |
11208 ]. |
11176 ]. |
11209 ]. |
11177 ]. |
11210 ^ allChildIDs |
11178 ^ allChildIDs |
11211 |
11179 |
11212 " |
11180 " |
11213 Display allChildIdsOf:(Display rootWindowId) |
11181 Display allChildIdsOf:(Display rootWindowId) |
11217 |deviceIDAtom uuidAtom| |
11185 |deviceIDAtom uuidAtom| |
11218 |
11186 |
11219 deviceIDAtom := (Display atomIDOf:#'STX_DEVICE_ID'). |
11187 deviceIDAtom := (Display atomIDOf:#'STX_DEVICE_ID'). |
11220 uuidAtom := (Display atomIDOf:#'UUID'). |
11188 uuidAtom := (Display atomIDOf:#'UUID'). |
11221 (Display allChildIdsOf:(Display rootWindowId)) |
11189 (Display allChildIdsOf:(Display rootWindowId)) |
11222 select:[:id | |
11190 select:[:id | |
11223 |uuid| |
11191 |uuid| |
11224 |
11192 |
11225 Display |
11193 Display |
11226 getProperty:deviceIDAtom |
11194 getProperty:deviceIDAtom |
11227 from:id |
11195 from:id |
11228 delete:false |
11196 delete:false |
11229 into:[:type :value | |
11197 into:[:type :value | |
11230 type == uuidAtom ifTrue:[ |
11198 type == uuidAtom ifTrue:[ |
11231 uuid := UUID fromBytes:value. |
11199 uuid := UUID fromBytes:value. |
11232 ]. |
11200 ]. |
11233 ]. |
11201 ]. |
11234 uuid notNil. |
11202 uuid notNil. |
11235 ] |
11203 ] |
11236 " |
11204 " |
11237 ! |
11205 ! |
11238 |
11206 |
11239 childIdsOf:aWindowId |
11207 childIdsOf:aWindowId |
11240 "return all children-ids of the given window. Allows for all windows to be |
11208 "return all children-ids of the given window. Allows for all windows to be |
11244 %{ |
11212 %{ |
11245 OBJ id; |
11213 OBJ id; |
11246 |
11214 |
11247 if (ISCONNECTED |
11215 if (ISCONNECTED |
11248 && __isExternalAddress(aWindowId)) { |
11216 && __isExternalAddress(aWindowId)) { |
11249 Display *dpy = myDpy; |
11217 Display *dpy = myDpy; |
11250 Window win = __WindowVal(aWindowId); |
11218 Window win = __WindowVal(aWindowId); |
11251 Window rootReturn, parentReturn; |
11219 Window rootReturn, parentReturn; |
11252 Window* children = (Window *)0; |
11220 Window* children = (Window *)0; |
11253 unsigned int numChildren; |
11221 unsigned int numChildren; |
11254 int i; |
11222 int i; |
11255 int rslt; |
11223 int rslt; |
11256 |
11224 |
11257 ENTER_XLIB(); |
11225 ENTER_XLIB(); |
11258 rslt = XQueryTree(dpy, win, |
11226 rslt = XQueryTree(dpy, win, |
11259 &rootReturn, &parentReturn, |
11227 &rootReturn, &parentReturn, |
11260 &children, &numChildren); |
11228 &children, &numChildren); |
11261 LEAVE_XLIB(); |
11229 LEAVE_XLIB(); |
11262 if (rslt) { |
11230 if (rslt) { |
11263 childIdArray = __ARRAY_NEW_INT(numChildren); |
11231 childIdArray = __ARRAY_NEW_INT(numChildren); |
11264 if (childIdArray != nil) { |
11232 if (childIdArray != nil) { |
11265 for (i=0; i < numChildren; i++) { |
11233 for (i=0; i < numChildren; i++) { |
11266 if (children[i]) { |
11234 if (children[i]) { |
11267 OBJ childId; |
11235 OBJ childId; |
11268 |
11236 |
11269 childId = __MKEXTERNALADDRESS(children[i]); |
11237 childId = __MKEXTERNALADDRESS(children[i]); |
11270 __ArrayInstPtr(childIdArray)->a_element[i] = childId; |
11238 __ArrayInstPtr(childIdArray)->a_element[i] = childId; |
11271 __STORE(childIdArray, childId); |
11239 __STORE(childIdArray, childId); |
11272 } |
11240 } |
11273 } |
11241 } |
11274 if (children) XFree(children); |
11242 if (children) XFree(children); |
11275 } |
11243 } |
11276 RETURN (childIdArray); |
11244 RETURN (childIdArray); |
11277 } |
11245 } |
11278 } |
11246 } |
11279 %}. |
11247 %}. |
11280 ^ nil. |
11248 ^ nil. |
11281 |
11249 |
11282 " |
11250 " |
11295 int screen = __intVal(__INST(screen)); |
11263 int screen = __intVal(__INST(screen)); |
11296 Window root; |
11264 Window root; |
11297 OBJ id; |
11265 OBJ id; |
11298 |
11266 |
11299 if (__INST(rootId) != nil) { |
11267 if (__INST(rootId) != nil) { |
11300 RETURN (__INST(rootId)); |
11268 RETURN (__INST(rootId)); |
11301 } |
11269 } |
11302 |
11270 |
11303 if (ISCONNECTED) { |
11271 if (ISCONNECTED) { |
11304 root = RootWindow(myDpy, screen); |
11272 root = RootWindow(myDpy, screen); |
11305 if (! root) { |
11273 if (! root) { |
11306 id = nil; |
11274 id = nil; |
11307 } else { |
11275 } else { |
11308 id = __MKEXTERNALADDRESS(root); __INST(rootId) = id; __STORE(self, id); |
11276 id = __MKEXTERNALADDRESS(root); __INST(rootId) = id; __STORE(self, id); |
11309 } |
11277 } |
11310 RETURN (id); |
11278 RETURN (id); |
11311 } |
11279 } |
11312 %}. |
11280 %}. |
11313 self primitiveFailedOrClosedConnection. |
11281 self primitiveFailedOrClosedConnection. |
11314 ^ nil |
11282 ^ nil |
11315 |
11283 |
11330 int screen = __intVal(__INST(screen)); |
11298 int screen = __intVal(__INST(screen)); |
11331 Window rootWin, vRootWin = 0; |
11299 Window rootWin, vRootWin = 0; |
11332 OBJ id; |
11300 OBJ id; |
11333 |
11301 |
11334 if (__INST(virtualRootId) != nil) { |
11302 if (__INST(virtualRootId) != nil) { |
11335 RETURN (__INST(virtualRootId)); |
11303 RETURN (__INST(virtualRootId)); |
11336 } |
11304 } |
11337 |
11305 |
11338 if (ISCONNECTED) { |
11306 if (ISCONNECTED) { |
11339 Display *dpy = myDpy; |
11307 Display *dpy = myDpy; |
11340 |
11308 |
11341 rootWin = RootWindow(dpy, screen); |
11309 rootWin = RootWindow(dpy, screen); |
11342 #ifndef IRIS |
11310 #ifndef IRIS |
11343 |
11311 |
11344 /* |
11312 /* |
11345 * on IRIS, this creates a badwindow error - why ? |
11313 * on IRIS, this creates a badwindow error - why ? |
11346 * children contains a funny window (000034) |
11314 * children contains a funny window (000034) |
11347 */ |
11315 */ |
11348 |
11316 |
11349 /* |
11317 /* |
11350 * care for virtual root windows (tvtwm & friends) |
11318 * care for virtual root windows (tvtwm & friends) |
11351 */ |
11319 */ |
11352 { |
11320 { |
11353 Atom vRootAtom, kwinAtom; |
11321 Atom vRootAtom, kwinAtom; |
11354 int i; |
11322 int i; |
11355 Window rootReturn, parentReturn; |
11323 Window rootReturn, parentReturn; |
11356 Window* children = (Window *)0; |
11324 Window* children = (Window *)0; |
11357 unsigned int numChildren; |
11325 unsigned int numChildren; |
11358 int ignoreVRoot = 0; |
11326 int ignoreVRoot = 0; |
11359 |
11327 |
11360 /* |
11328 /* |
11361 * Take care of KDE 2.1. |
11329 * Take care of KDE 2.1. |
11362 * they define _SWM_ROOT but this is not the parent of |
11330 * they define _SWM_ROOT but this is not the parent of |
11363 * the application windows. |
11331 * the application windows. |
11364 * Instead it is used for background painting |
11332 * Instead it is used for background painting |
11365 */ |
11333 */ |
11366 |
11334 |
11367 kwinAtom = XInternAtom(dpy, "KWIN_RUNNING", True); |
11335 kwinAtom = XInternAtom(dpy, "KWIN_RUNNING", True); |
11368 if (kwinAtom != None) { |
11336 if (kwinAtom != None) { |
11369 Atom actual_type; |
11337 Atom actual_type; |
11370 int actual_format; |
11338 int actual_format; |
11371 unsigned long nitems, bytesafter; |
11339 unsigned long nitems, bytesafter; |
11372 unsigned char *retVal = 0; |
11340 unsigned char *retVal = 0; |
11373 |
11341 |
11374 ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom, |
11342 ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom, |
11375 0L, 1L, False, kwinAtom, |
11343 0L, 1L, False, kwinAtom, |
11376 &actual_type, &actual_format, |
11344 &actual_type, &actual_format, |
11377 &nitems, &bytesafter, &retVal) == Success |
11345 &nitems, &bytesafter, &retVal) == Success |
11378 && actual_type != 0; |
11346 && actual_type != 0; |
11379 if (retVal) |
11347 if (retVal) |
11380 XFree(retVal); |
11348 XFree(retVal); |
11381 } |
11349 } |
11382 |
11350 |
11383 if (!ignoreVRoot) { |
11351 if (!ignoreVRoot) { |
11384 vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True); |
11352 vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True); |
11385 if (vRootAtom != None) { |
11353 if (vRootAtom != None) { |
11386 if (XQueryTree(dpy, rootWin, |
11354 if (XQueryTree(dpy, rootWin, |
11387 &rootReturn, &parentReturn, |
11355 &rootReturn, &parentReturn, |
11388 &children, &numChildren)) { |
11356 &children, &numChildren)) { |
11389 for (i=0; i < numChildren; i++) { |
11357 for (i=0; i < numChildren; i++) { |
11390 Atom actual_type; |
11358 Atom actual_type; |
11391 int actual_format; |
11359 int actual_format; |
11392 unsigned long nitems, bytesafter; |
11360 unsigned long nitems, bytesafter; |
11393 Window* newRoot = (Window*) 0; |
11361 Window* newRoot = (Window*) 0; |
11394 |
11362 |
11395 if (children[i]) { |
11363 if (children[i]) { |
11396 if (XGetWindowProperty(dpy, children[i], vRootAtom, |
11364 if (XGetWindowProperty(dpy, children[i], vRootAtom, |
11397 0L, 1L, False, XA_WINDOW, |
11365 0L, 1L, False, XA_WINDOW, |
11398 &actual_type, &actual_format, |
11366 &actual_type, &actual_format, |
11399 &nitems, &bytesafter, |
11367 &nitems, &bytesafter, |
11400 (unsigned char**) &newRoot |
11368 (unsigned char**) &newRoot |
11401 ) == Success && newRoot) { |
11369 ) == Success && newRoot) { |
11402 vRootWin = *newRoot; |
11370 vRootWin = *newRoot; |
11403 XFree(newRoot); /* XXX */ |
11371 XFree(newRoot); /* XXX */ |
11404 break; |
11372 break; |
11405 } |
11373 } |
11406 } |
11374 } |
11407 } |
11375 } |
11408 if (children) XFree(children); |
11376 if (children) XFree(children); |
11409 } |
11377 } |
11410 } |
11378 } |
11411 } |
11379 } |
11412 } |
11380 } |
11413 #endif |
11381 #endif |
11414 } |
11382 } |
11415 |
11383 |
11416 if (! vRootWin) { |
11384 if (! vRootWin) { |
11417 vRootWin = rootWin; |
11385 vRootWin = rootWin; |
11418 if (! vRootWin) { |
11386 if (! vRootWin) { |
11419 RETURN ( nil ); |
11387 RETURN ( nil ); |
11420 } |
11388 } |
11421 } |
11389 } |
11422 id = __MKEXTERNALADDRESS(rootWin); __INST(rootId) = id; __STORE(self, id); |
11390 id = __MKEXTERNALADDRESS(rootWin); __INST(rootId) = id; __STORE(self, id); |
11423 id = __MKEXTERNALADDRESS(vRootWin); __INST(virtualRootId) = id; __STORE(self, id); |
11391 id = __MKEXTERNALADDRESS(vRootWin); __INST(virtualRootId) = id; __STORE(self, id); |
11424 RETURN ( id ); |
11392 RETURN ( id ); |
11425 %} |
11393 %} |
11438 %{ |
11406 %{ |
11439 |
11407 |
11440 int w, h; |
11408 int w, h; |
11441 |
11409 |
11442 if (ISCONNECTED) { |
11410 if (ISCONNECTED) { |
11443 if (__isExternalAddress(aWindowId) |
11411 if (__isExternalAddress(aWindowId) |
11444 && __bothSmallInteger(x, y) |
11412 && __bothSmallInteger(x, y) |
11445 && __bothSmallInteger(width, height)) { |
11413 && __bothSmallInteger(width, height)) { |
11446 w = __intVal(width); |
11414 w = __intVal(width); |
11447 h = __intVal(height); |
11415 h = __intVal(height); |
11448 /* |
11416 /* |
11449 * need this check here: some servers simply dump core with bad args |
11417 * need this check here: some servers simply dump core with bad args |
11450 */ |
11418 */ |
11451 if ((w >= 0) && (h >= 0)) { |
11419 if ((w >= 0) && (h >= 0)) { |
11452 ENTER_XLIB(); |
11420 ENTER_XLIB(); |
11453 XClearArea(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0); |
11421 XClearArea(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0); |
11454 LEAVE_XLIB(); |
11422 LEAVE_XLIB(); |
11455 } |
11423 } |
11456 RETURN ( self ); |
11424 RETURN ( self ); |
11457 } |
11425 } |
11458 } |
11426 } |
11459 %}. |
11427 %}. |
11460 self primitiveFailedOrClosedConnection. |
11428 self primitiveFailedOrClosedConnection. |
11461 ! |
11429 ! |
11462 |
11430 |
11465 |
11433 |
11466 <context: #return> |
11434 <context: #return> |
11467 %{ |
11435 %{ |
11468 |
11436 |
11469 if (ISCONNECTED) { |
11437 if (ISCONNECTED) { |
11470 if (__isExternalAddress(aWindowId)) { |
11438 if (__isExternalAddress(aWindowId)) { |
11471 ENTER_XLIB(); |
11439 ENTER_XLIB(); |
11472 XClearWindow(myDpy, __WindowVal(aWindowId)); |
11440 XClearWindow(myDpy, __WindowVal(aWindowId)); |
11473 LEAVE_XLIB(); |
11441 LEAVE_XLIB(); |
11474 RETURN ( self ); |
11442 RETURN ( self ); |
11475 } |
11443 } |
11476 } |
11444 } |
11477 %}. |
11445 %}. |
11478 self primitiveFailedOrClosedConnection |
11446 self primitiveFailedOrClosedConnection |
11479 ! |
11447 ! |
11480 |
11448 |
11486 |
11454 |
11487 XWindowChanges chg; |
11455 XWindowChanges chg; |
11488 int mask = CWSibling | CWStackMode; |
11456 int mask = CWSibling | CWStackMode; |
11489 |
11457 |
11490 if (ISCONNECTED) { |
11458 if (ISCONNECTED) { |
11491 if (__isExternalAddress(aWindowId) |
11459 if (__isExternalAddress(aWindowId) |
11492 && __isExternalAddress(siblingId)) { |
11460 && __isExternalAddress(siblingId)) { |
11493 if (modeSymbol == @symbol(above)) { |
11461 if (modeSymbol == @symbol(above)) { |
11494 chg.stack_mode = Above; |
11462 chg.stack_mode = Above; |
11495 } else if (modeSymbol == @symbol(below)) { |
11463 } else if (modeSymbol == @symbol(below)) { |
11496 chg.stack_mode = Below; |
11464 chg.stack_mode = Below; |
11497 } else if (modeSymbol == @symbol(topIf)) { |
11465 } else if (modeSymbol == @symbol(topIf)) { |
11498 chg.stack_mode = TopIf; |
11466 chg.stack_mode = TopIf; |
11499 } else if (modeSymbol == @symbol(bottomIf)) { |
11467 } else if (modeSymbol == @symbol(bottomIf)) { |
11500 chg.stack_mode = BottomIf; |
11468 chg.stack_mode = BottomIf; |
11501 } else if (modeSymbol == @symbol(opposite)) { |
11469 } else if (modeSymbol == @symbol(opposite)) { |
11502 chg.stack_mode = Opposite; |
11470 chg.stack_mode = Opposite; |
11503 } else { |
11471 } else { |
11504 mask = CWSibling; |
11472 mask = CWSibling; |
11505 } |
11473 } |
11506 |
11474 |
11507 chg.sibling = __WindowVal(siblingId); |
11475 chg.sibling = __WindowVal(siblingId); |
11508 ENTER_XLIB(); |
11476 ENTER_XLIB(); |
11509 XConfigureWindow(myDpy, __WindowVal(aWindowId), |
11477 XConfigureWindow(myDpy, __WindowVal(aWindowId), |
11510 mask, &chg); |
11478 mask, &chg); |
11511 LEAVE_XLIB(); |
11479 LEAVE_XLIB(); |
11512 RETURN ( self ); |
11480 RETURN ( self ); |
11513 } |
11481 } |
11514 } |
11482 } |
11515 bad: ; |
11483 bad: ; |
11516 %}. |
11484 %}. |
11517 self primitiveFailedOrClosedConnection |
11485 self primitiveFailedOrClosedConnection |
11518 ! |
11486 ! |
11531 |x y width height depth borderWidth info| |
11499 |x y width height depth borderWidth info| |
11532 |
11500 |
11533 %{ |
11501 %{ |
11534 int x_ret, y_ret; |
11502 int x_ret, y_ret; |
11535 unsigned int width_ret, height_ret, |
11503 unsigned int width_ret, height_ret, |
11536 border_width_ret, depth_ret; |
11504 border_width_ret, depth_ret; |
11537 Window root_ret; |
11505 Window root_ret; |
11538 |
11506 |
11539 if (ISCONNECTED |
11507 if (ISCONNECTED |
11540 && __isExternalAddress(aWindowId)) { |
11508 && __isExternalAddress(aWindowId)) { |
11541 ENTER_XLIB(); |
11509 ENTER_XLIB(); |
11542 XGetGeometry(myDpy, __WindowVal(aWindowId), |
11510 XGetGeometry(myDpy, __WindowVal(aWindowId), |
11543 &root_ret, |
11511 &root_ret, |
11544 &x_ret, &y_ret, |
11512 &x_ret, &y_ret, |
11545 &width_ret, &height_ret, &border_width_ret, |
11513 &width_ret, &height_ret, &border_width_ret, |
11546 &depth_ret); |
11514 &depth_ret); |
11547 LEAVE_XLIB(); |
11515 LEAVE_XLIB(); |
11548 |
11516 |
11549 x = __MKSMALLINT(x_ret); |
11517 x = __MKSMALLINT(x_ret); |
11550 y = __MKSMALLINT(y_ret); |
11518 y = __MKSMALLINT(y_ret); |
11551 width = __MKSMALLINT(width_ret); |
11519 width = __MKSMALLINT(width_ret); |
11552 height = __MKSMALLINT(height_ret); |
11520 height = __MKSMALLINT(height_ret); |
11553 depth = __MKSMALLINT(depth_ret); |
11521 depth = __MKSMALLINT(depth_ret); |
11554 borderWidth = __MKSMALLINT(border_width_ret); |
11522 borderWidth = __MKSMALLINT(border_width_ret); |
11555 } |
11523 } |
11556 %}. |
11524 %}. |
11557 borderWidth isNil ifTrue:[ |
11525 borderWidth isNil ifTrue:[ |
11558 self primitiveFailedOrClosedConnection. |
11526 self primitiveFailedOrClosedConnection. |
11559 ^ nil |
11527 ^ nil |
11560 ]. |
11528 ]. |
11561 info := Dictionary new. |
11529 info := Dictionary new. |
11562 info at:#origin put:(x @ y). |
11530 info at:#origin put:(x @ y). |
11563 info at:#extent put:(width @ height). |
11531 info at:#extent put:(width @ height). |
11564 info at:#depth put:depth. |
11532 info at:#depth put:depth. |
11565 info at:#borderWidth put:borderWidth. |
11533 info at:#borderWidth put:borderWidth. |
11566 ^ info |
11534 ^ info |
11567 |
11535 |
11568 " |
11536 " |
11569 Transcript topView device |
11537 Transcript topView device |
11570 getGeometryOf:(Transcript id) |
11538 getGeometryOf:(Transcript id) |
11571 " |
11539 " |
11572 " |
11540 " |
11573 Transcript topView device |
11541 Transcript topView device |
11574 getGeometryOf:(Transcript topView id) |
11542 getGeometryOf:(Transcript topView id) |
11575 " |
11543 " |
11576 " |
11544 " |
11577 Display |
11545 Display |
11578 getGeometryOf:(Display viewIdFromUser) |
11546 getGeometryOf:(Display viewIdFromUser) |
11579 " |
11547 " |
11580 " |
11548 " |
11581 |d| |
11549 |d| |
11582 |
11550 |
11583 d := Transcript topView device. |
11551 d := Transcript topView device. |
11594 |
11562 |
11595 %{ |
11563 %{ |
11596 |
11564 |
11597 if (ISCONNECTED |
11565 if (ISCONNECTED |
11598 && __isExternalAddress(aWindowId)) { |
11566 && __isExternalAddress(aWindowId)) { |
11599 char *name = NULL; |
11567 char *name = NULL; |
11600 Status ok; |
11568 Status ok; |
11601 Window root, parent, *children = NULL; |
11569 Window root, parent, *children = NULL; |
11602 unsigned int nChildren; |
11570 unsigned int nChildren; |
11603 |
11571 |
11604 /* ENTER_XLIB(); */ |
11572 /* ENTER_XLIB(); */ |
11605 ok = XQueryTree(myDpy, __WindowVal(aWindowId), |
11573 ok = XQueryTree(myDpy, __WindowVal(aWindowId), |
11606 &root, &parent, &children, &nChildren); |
11574 &root, &parent, &children, &nChildren); |
11607 if (children) { |
11575 if (children) { |
11608 XFree(children); |
11576 XFree(children); |
11609 } |
11577 } |
11610 /* LEAVE_XLIB(); */ |
11578 /* LEAVE_XLIB(); */ |
11611 if (ok) { |
11579 if (ok) { |
11612 RETURN (true); |
11580 RETURN (true); |
11613 } |
11581 } |
11614 RETURN (false); |
11582 RETURN (false); |
11615 } |
11583 } |
11616 %}. |
11584 %}. |
11617 self primitiveFailedOrClosedConnection. |
11585 self primitiveFailedOrClosedConnection. |
11618 ^ false |
11586 ^ false |
11619 |
11587 |
11639 <context: #return> |
11607 <context: #return> |
11640 %{ |
11608 %{ |
11641 |
11609 |
11642 if (ISCONNECTED |
11610 if (ISCONNECTED |
11643 && __isExternalAddress(aWindowId)) { |
11611 && __isExternalAddress(aWindowId)) { |
11644 ENTER_XLIB(); |
11612 ENTER_XLIB(); |
11645 XLowerWindow(myDpy, __WindowVal(aWindowId)); |
11613 XLowerWindow(myDpy, __WindowVal(aWindowId)); |
11646 LEAVE_XLIB(); |
11614 LEAVE_XLIB(); |
11647 RETURN ( self ); |
11615 RETURN ( self ); |
11648 } |
11616 } |
11649 %}. |
11617 %}. |
11650 self primitiveFailedOrClosedConnection |
11618 self primitiveFailedOrClosedConnection |
11651 ! |
11619 ! |
11652 |
11620 |
11653 mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
11621 mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
11654 width:w height:h minExtent:minExt maxExtent:maxExt |
11622 width:w height:h minExtent:minExt maxExtent:maxExt |
11655 |
11623 |
11656 <context: #return> |
11624 <context: #return> |
11657 |
11625 |
11658 "make a window visible - either as icon or as a real view |
11626 "make a window visible - either as icon or as a real view |
11659 in addition, allow change of extend, position, minExtend and maxExtent. |
11627 in addition, allow change of extend, position, minExtend and maxExtent. |
11661 and to collaps/expand windows." |
11629 and to collaps/expand windows." |
11662 |
11630 |
11663 |wicon wiconId iconMaskId wiconView wiconViewId wlabel minW minH maxW maxH| |
11631 |wicon wiconId iconMaskId wiconView wiconViewId wlabel minW minH maxW maxH| |
11664 |
11632 |
11665 aBoolean ifTrue:[ |
11633 aBoolean ifTrue:[ |
11666 wicon := aView icon. |
11634 wicon := aView icon. |
11667 wicon notNil ifTrue:[ |
11635 wicon notNil ifTrue:[ |
11668 wiconId := wicon id. |
11636 wiconId := wicon id. |
11669 wicon mask notNil ifTrue:[ |
11637 wicon mask notNil ifTrue:[ |
11670 iconMaskId := wicon mask id. |
11638 iconMaskId := wicon mask id. |
11671 ]. |
11639 ]. |
11672 ]. |
11640 ]. |
11673 wiconView := aView iconView. |
11641 wiconView := aView iconView. |
11674 wiconView notNil ifTrue:[ |
11642 wiconView notNil ifTrue:[ |
11675 wiconViewId := wiconView id |
11643 wiconViewId := wiconView id |
11676 ]. |
11644 ]. |
11677 wlabel := aView label. |
11645 wlabel := aView label. |
11678 ]. |
11646 ]. |
11679 minExt notNil ifTrue:[ |
11647 minExt notNil ifTrue:[ |
11680 minW := minExt x. |
11648 minW := minExt x. |
11681 minH := minExt y. |
11649 minH := minExt y. |
11682 ]. |
11650 ]. |
11683 maxExt notNil ifTrue:[ |
11651 maxExt notNil ifTrue:[ |
11684 maxW := maxExt x. |
11652 maxW := maxExt x. |
11685 maxH := maxExt y. |
11653 maxH := maxExt y. |
11686 ]. |
11654 ]. |
11687 %{ |
11655 %{ |
11688 |
11656 |
11689 XWMHints wmhints; |
11657 XWMHints wmhints; |
11690 XSizeHints szhints; |
11658 XSizeHints szhints; |
11691 Window win; |
11659 Window win; |
11692 |
11660 |
11693 if (ISCONNECTED |
11661 if (ISCONNECTED |
11694 && __isExternalAddress(aWindowId)) { |
11662 && __isExternalAddress(aWindowId)) { |
11695 Display *dpy = myDpy; |
11663 Display *dpy = myDpy; |
11696 |
11664 |
11697 win = __WindowVal(aWindowId); |
11665 win = __WindowVal(aWindowId); |
11698 |
11666 |
11699 szhints.flags = 0; |
11667 szhints.flags = 0; |
11700 if (__bothSmallInteger(xPos, yPos)) { |
11668 if (__bothSmallInteger(xPos, yPos)) { |
11701 szhints.x = __intVal(xPos); |
11669 szhints.x = __intVal(xPos); |
11702 szhints.y = __intVal(yPos); |
11670 szhints.y = __intVal(yPos); |
11703 szhints.flags |= USPosition; |
11671 szhints.flags |= USPosition; |
11704 } |
11672 } |
11705 if (__bothSmallInteger(w, h)) { |
11673 if (__bothSmallInteger(w, h)) { |
11706 szhints.width = __intVal(w); |
11674 szhints.width = __intVal(w); |
11707 szhints.height = __intVal(h); |
11675 szhints.height = __intVal(h); |
11708 szhints.flags |= USSize; |
11676 szhints.flags |= USSize; |
11709 } |
11677 } |
11710 if (__bothSmallInteger(minW, minH)) { |
11678 if (__bothSmallInteger(minW, minH)) { |
11711 szhints.flags |= PMinSize; |
11679 szhints.flags |= PMinSize; |
11712 szhints.min_width = __intVal(minW); |
11680 szhints.min_width = __intVal(minW); |
11713 szhints.min_height = __intVal(minH); |
11681 szhints.min_height = __intVal(minH); |
11714 } |
11682 } |
11715 if (__bothSmallInteger(maxW, maxH)) { |
11683 if (__bothSmallInteger(maxW, maxH)) { |
11716 szhints.flags |= PMaxSize; |
11684 szhints.flags |= PMaxSize; |
11717 szhints.max_width = __intVal(maxW); |
11685 szhints.max_width = __intVal(maxW); |
11718 szhints.max_height = __intVal(maxH); |
11686 szhints.max_height = __intVal(maxH); |
11719 } |
11687 } |
11720 |
11688 |
11721 if (aBoolean == true) { |
11689 if (aBoolean == true) { |
11722 char *windowName = ""; |
11690 char *windowName = ""; |
11723 Pixmap iconBitmap = (Pixmap)0; |
11691 Pixmap iconBitmap = (Pixmap)0; |
11724 Pixmap iconMask = (Pixmap)0; |
11692 Pixmap iconMask = (Pixmap)0; |
11725 Window iconWindow = (Window)0; |
11693 Window iconWindow = (Window)0; |
11726 |
11694 |
11727 if (__isExternalAddress(wiconId)) |
11695 if (__isExternalAddress(wiconId)) |
11728 iconBitmap = __PixmapVal(wiconId); |
11696 iconBitmap = __PixmapVal(wiconId); |
11729 |
11697 |
11730 if (__isExternalAddress(iconMaskId)) { |
11698 if (__isExternalAddress(iconMaskId)) { |
11731 iconMask = __PixmapVal(iconMaskId); |
11699 iconMask = __PixmapVal(iconMaskId); |
11732 } |
11700 } |
11733 |
11701 |
11734 if (__isExternalAddress(wiconViewId)) |
11702 if (__isExternalAddress(wiconViewId)) |
11735 iconWindow = __WindowVal(wiconViewId); |
11703 iconWindow = __WindowVal(wiconViewId); |
11736 |
11704 |
11737 if (__isStringLike(wlabel)) |
11705 if (__isStringLike(wlabel)) |
11738 windowName = (char *) __stringVal(wlabel); |
11706 windowName = (char *) __stringVal(wlabel); |
11739 |
11707 |
11740 if (iconBitmap || windowName) { |
11708 if (iconBitmap || windowName) { |
11741 ENTER_XLIB(); |
11709 ENTER_XLIB(); |
11742 XSetStandardProperties(dpy, win, |
11710 XSetStandardProperties(dpy, win, |
11743 windowName, windowName, |
11711 windowName, windowName, |
11744 iconBitmap, |
11712 iconBitmap, |
11745 0, 0, &szhints); |
11713 0, 0, &szhints); |
11746 LEAVE_XLIB(); |
11714 LEAVE_XLIB(); |
11747 } |
11715 } |
11748 |
11716 |
11749 wmhints.flags = 0; |
11717 wmhints.flags = 0; |
11750 if (iconBitmap) { |
11718 if (iconBitmap) { |
11751 wmhints.flags |= IconPixmapHint; |
11719 wmhints.flags |= IconPixmapHint; |
11752 wmhints.icon_pixmap = iconBitmap; |
11720 wmhints.icon_pixmap = iconBitmap; |
11753 } |
11721 } |
11754 if (iconMask) { |
11722 if (iconMask) { |
11755 wmhints.flags |= IconMaskHint; |
11723 wmhints.flags |= IconMaskHint; |
11756 wmhints.icon_mask = iconMask; |
11724 wmhints.icon_mask = iconMask; |
11757 } |
11725 } |
11758 if (iconWindow) { |
11726 if (iconWindow) { |
11759 wmhints.flags |= IconWindowHint; |
11727 wmhints.flags |= IconWindowHint; |
11760 wmhints.icon_window = iconWindow; |
11728 wmhints.icon_window = iconWindow; |
11761 } |
11729 } |
11762 |
11730 |
11763 wmhints.initial_state = IconicState; |
11731 wmhints.initial_state = IconicState; |
11764 wmhints.flags |= StateHint; |
11732 wmhints.flags |= StateHint; |
11765 ENTER_XLIB(); |
11733 ENTER_XLIB(); |
11766 XSetWMHints(dpy, win, &wmhints); |
11734 XSetWMHints(dpy, win, &wmhints); |
11767 LEAVE_XLIB(); |
11735 LEAVE_XLIB(); |
11768 } |
11736 } |
11769 |
11737 |
11770 if (szhints.flags) { |
11738 if (szhints.flags) { |
11771 ENTER_XLIB(); |
11739 ENTER_XLIB(); |
11772 XSetNormalHints(dpy, win, &szhints); |
11740 XSetNormalHints(dpy, win, &szhints); |
11773 LEAVE_XLIB(); |
11741 LEAVE_XLIB(); |
11774 } |
11742 } |
11775 |
11743 |
11776 ENTER_XLIB(); |
11744 ENTER_XLIB(); |
11777 XMapWindow(dpy, win); |
11745 XMapWindow(dpy, win); |
11778 LEAVE_XLIB(); |
11746 LEAVE_XLIB(); |
11779 RETURN ( self ); |
11747 RETURN ( self ); |
11780 } |
11748 } |
11781 %}. |
11749 %}. |
11782 self primitiveFailedOrClosedConnection |
11750 self primitiveFailedOrClosedConnection |
11783 ! |
11751 ! |
11784 |
11752 |
11788 <context: #return> |
11756 <context: #return> |
11789 %{ |
11757 %{ |
11790 |
11758 |
11791 if (ISCONNECTED |
11759 if (ISCONNECTED |
11792 && __isExternalAddress(aWindowId)) { |
11760 && __isExternalAddress(aWindowId)) { |
11793 ENTER_XLIB(); |
11761 ENTER_XLIB(); |
11794 XMapWindow(myDpy, __WindowVal(aWindowId)); |
11762 XMapWindow(myDpy, __WindowVal(aWindowId)); |
11795 LEAVE_XLIB(); |
11763 LEAVE_XLIB(); |
11796 RETURN ( self ); |
11764 RETURN ( self ); |
11797 } |
11765 } |
11798 %}. |
11766 %}. |
11799 self primitiveFailedOrClosedConnection |
11767 self primitiveFailedOrClosedConnection |
11800 ! |
11768 ! |
11801 |
11769 |
11809 |
11777 |
11810 if (ISCONNECTED |
11778 if (ISCONNECTED |
11811 && __isExternalAddress(aWindowId) |
11779 && __isExternalAddress(aWindowId) |
11812 && __bothSmallInteger(w, h) |
11780 && __bothSmallInteger(w, h) |
11813 && __bothSmallInteger(x, y)) { |
11781 && __bothSmallInteger(x, y)) { |
11814 newWidth = __intVal(w); |
11782 newWidth = __intVal(w); |
11815 newHeight = __intVal(h); |
11783 newHeight = __intVal(h); |
11816 if (newWidth < 1) newWidth = 1; |
11784 if (newWidth < 1) newWidth = 1; |
11817 if (newHeight < 1) newHeight = 1; |
11785 if (newHeight < 1) newHeight = 1; |
11818 ENTER_XLIB(); |
11786 ENTER_XLIB(); |
11819 XMoveResizeWindow(myDpy, __WindowVal(aWindowId), |
11787 XMoveResizeWindow(myDpy, __WindowVal(aWindowId), |
11820 __intVal(x), __intVal(y), |
11788 __intVal(x), __intVal(y), |
11821 newWidth, newHeight); |
11789 newWidth, newHeight); |
11822 LEAVE_XLIB(); |
11790 LEAVE_XLIB(); |
11823 RETURN ( self ); |
11791 RETURN ( self ); |
11824 } |
11792 } |
11825 %}. |
11793 %}. |
11826 self primitiveFailedOrClosedConnection |
11794 self primitiveFailedOrClosedConnection |
11827 ! |
11795 ! |
11828 |
11796 |
11832 <context: #return> |
11800 <context: #return> |
11833 %{ |
11801 %{ |
11834 |
11802 |
11835 if (ISCONNECTED |
11803 if (ISCONNECTED |
11836 && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) { |
11804 && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) { |
11837 ENTER_XLIB(); |
11805 ENTER_XLIB(); |
11838 XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y)); |
11806 XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y)); |
11839 LEAVE_XLIB(); |
11807 LEAVE_XLIB(); |
11840 RETURN ( self ); |
11808 RETURN ( self ); |
11841 } |
11809 } |
11842 %}. |
11810 %}. |
11843 self primitiveFailedOrClosedConnection |
11811 self primitiveFailedOrClosedConnection |
11844 ! |
11812 ! |
11845 |
11813 |
11849 |
11817 |
11850 %{ |
11818 %{ |
11851 |
11819 |
11852 if (ISCONNECTED |
11820 if (ISCONNECTED |
11853 && __isExternalAddress(aWindowId)) { |
11821 && __isExternalAddress(aWindowId)) { |
11854 Status ok; |
11822 Status ok; |
11855 Window root, parent, *children = NULL; |
11823 Window root, parent, *children = NULL; |
11856 unsigned int nChildren; |
11824 unsigned int nChildren; |
11857 |
11825 |
11858 /* ENTER_XLIB(); */ |
11826 /* ENTER_XLIB(); */ |
11859 ok = XQueryTree(myDpy, __WindowVal(aWindowId), |
11827 ok = XQueryTree(myDpy, __WindowVal(aWindowId), |
11860 &root, &parent, &children, &nChildren); |
11828 &root, &parent, &children, &nChildren); |
11861 if (children) { |
11829 if (children) { |
11862 XFree(children); |
11830 XFree(children); |
11863 } |
11831 } |
11864 /* LEAVE_XLIB(); */ |
11832 /* LEAVE_XLIB(); */ |
11865 if (! ok) { |
11833 if (! ok) { |
11866 RETURN ( nil ); |
11834 RETURN ( nil ); |
11867 } |
11835 } |
11868 RETURN ( __MKEXTERNALADDRESS(parent) ); |
11836 RETURN ( __MKEXTERNALADDRESS(parent) ); |
11869 } |
11837 } |
11870 %}. |
11838 %}. |
11871 self primitiveFailedOrClosedConnection. |
11839 self primitiveFailedOrClosedConnection. |
11872 ^ false |
11840 ^ false |
11873 |
11841 |
11885 <context: #return> |
11853 <context: #return> |
11886 %{ |
11854 %{ |
11887 |
11855 |
11888 if (ISCONNECTED |
11856 if (ISCONNECTED |
11889 && __isExternalAddress(aWindowId)) { |
11857 && __isExternalAddress(aWindowId)) { |
11890 ENTER_XLIB(); |
11858 ENTER_XLIB(); |
11891 XRaiseWindow(myDpy, __WindowVal(aWindowId)); |
11859 XRaiseWindow(myDpy, __WindowVal(aWindowId)); |
11892 LEAVE_XLIB(); |
11860 LEAVE_XLIB(); |
11893 RETURN ( self ); |
11861 RETURN ( self ); |
11894 } |
11862 } |
11895 %}. |
11863 %}. |
11896 self primitiveFailedOrClosedConnection |
11864 self primitiveFailedOrClosedConnection |
11897 ! |
11865 ! |
11898 |
11866 |
11902 <context: #return> |
11870 <context: #return> |
11903 %{ |
11871 %{ |
11904 if (ISCONNECTED |
11872 if (ISCONNECTED |
11905 && __isExternalAddress(windowId) |
11873 && __isExternalAddress(windowId) |
11906 && __isExternalAddress(newParentWindowId)) { |
11874 && __isExternalAddress(newParentWindowId)) { |
11907 Display *dpy = myDpy; |
11875 Display *dpy = myDpy; |
11908 Window _child, _newParent; |
11876 Window _child, _newParent; |
11909 int i; |
11877 int i; |
11910 |
11878 |
11911 _child = __WindowVal(windowId); |
11879 _child = __WindowVal(windowId); |
11912 _newParent = __WindowVal(newParentWindowId); |
11880 _newParent = __WindowVal(newParentWindowId); |
11913 ENTER_XLIB(); |
11881 ENTER_XLIB(); |
11914 |
11882 |
11915 #if 0 |
11883 #if 0 |
11916 XWithdrawWindow (dpy, _child, DefaultScreen(dpy)); |
11884 XWithdrawWindow (dpy, _child, DefaultScreen(dpy)); |
11917 XSync (dpy, 0); |
11885 XSync (dpy, 0); |
11918 #endif |
11886 #endif |
11919 /* |
11887 /* |
11920 * Code 'stolen' from xswallow source ... |
11888 * Code 'stolen' from xswallow source ... |
11921 * ... mhmh - what is this loop for ? |
11889 * ... mhmh - what is this loop for ? |
11922 */ |
11890 */ |
11923 for (i=0; i<5; i++) { |
11891 for (i=0; i<5; i++) { |
11924 XReparentWindow (dpy, _child, _newParent, 0, 0); |
11892 XReparentWindow (dpy, _child, _newParent, 0, 0); |
11925 XSync (dpy, 0); |
11893 XSync (dpy, 0); |
11926 } |
11894 } |
11927 #if 0 |
11895 #if 0 |
11928 XMapWindow (dpy, _child); |
11896 XMapWindow (dpy, _child); |
11929 XSync (dpy, 0); |
11897 XSync (dpy, 0); |
11930 #endif |
11898 #endif |
11931 LEAVE_XLIB(); |
11899 LEAVE_XLIB(); |
11932 RETURN ( true ); |
11900 RETURN ( true ); |
11933 } |
11901 } |
11934 %}. |
11902 %}. |
11935 self primitiveFailedOrClosedConnection |
11903 self primitiveFailedOrClosedConnection |
11936 ! |
11904 ! |
11937 |
11905 |
11943 |
11911 |
11944 int newWidth, newHeight; |
11912 int newWidth, newHeight; |
11945 |
11913 |
11946 if (ISCONNECTED |
11914 if (ISCONNECTED |
11947 && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) { |
11915 && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) { |
11948 newWidth = __intVal(w); |
11916 newWidth = __intVal(w); |
11949 newHeight = __intVal(h); |
11917 newHeight = __intVal(h); |
11950 if (newWidth < 1) newWidth = 1; |
11918 if (newWidth < 1) newWidth = 1; |
11951 if (newHeight < 1) newHeight = 1; |
11919 if (newHeight < 1) newHeight = 1; |
11952 ENTER_XLIB(); |
11920 ENTER_XLIB(); |
11953 XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight); |
11921 XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight); |
11954 LEAVE_XLIB(); |
11922 LEAVE_XLIB(); |
11955 RETURN ( self ); |
11923 RETURN ( self ); |
11956 } |
11924 } |
11957 %}. |
11925 %}. |
11958 self primitiveFailedOrClosedConnection |
11926 self primitiveFailedOrClosedConnection |
11959 ! |
11927 ! |
11960 |
11928 |
11966 |
11934 |
11967 XSetWindowAttributes wa; |
11935 XSetWindowAttributes wa; |
11968 |
11936 |
11969 if (ISCONNECTED |
11937 if (ISCONNECTED |
11970 && __isExternalAddress(aWindowId)) { |
11938 && __isExternalAddress(aWindowId)) { |
11971 if (__INST(ignoreBackingStore) != true) { |
11939 if (__INST(ignoreBackingStore) != true) { |
11972 if (how == @symbol(always)) wa.backing_store = Always; |
11940 if (how == @symbol(always)) wa.backing_store = Always; |
11973 else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped; |
11941 else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped; |
11974 else if (how == true) wa.backing_store = Always; |
11942 else if (how == true) wa.backing_store = Always; |
11975 else wa.backing_store = 0; |
11943 else wa.backing_store = 0; |
11976 |
11944 |
11977 ENTER_XLIB(); |
11945 ENTER_XLIB(); |
11978 XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa); |
11946 XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa); |
11979 LEAVE_XLIB(); |
11947 LEAVE_XLIB(); |
11980 |
11948 |
11981 } |
11949 } |
11982 RETURN ( self ); |
11950 RETURN ( self ); |
11983 } |
11951 } |
11984 %}. |
11952 %}. |
11985 self primitiveFailedOrClosedConnection |
11953 self primitiveFailedOrClosedConnection |
11986 ! |
11954 ! |
11987 |
11955 |
11993 |
11961 |
11994 XSetWindowAttributes wa; |
11962 XSetWindowAttributes wa; |
11995 |
11963 |
11996 if (ISCONNECTED |
11964 if (ISCONNECTED |
11997 && __isExternalAddress(aWindowId)) { |
11965 && __isExternalAddress(aWindowId)) { |
11998 if (how == @symbol(NorthWest)) { |
11966 if (how == @symbol(NorthWest)) { |
11999 wa.bit_gravity = NorthWestGravity; |
11967 wa.bit_gravity = NorthWestGravity; |
12000 } else if (how == @symbol(NorthEast)) { |
11968 } else if (how == @symbol(NorthEast)) { |
12001 wa.bit_gravity = NorthEastGravity; |
11969 wa.bit_gravity = NorthEastGravity; |
12002 } else if (how == @symbol(SouthWest)) { |
11970 } else if (how == @symbol(SouthWest)) { |
12003 wa.bit_gravity = SouthWestGravity; |
11971 wa.bit_gravity = SouthWestGravity; |
12004 } else if (how == @symbol(SouthEast)) { |
11972 } else if (how == @symbol(SouthEast)) { |
12005 wa.bit_gravity = SouthEastGravity; |
11973 wa.bit_gravity = SouthEastGravity; |
12006 } else if (how == @symbol(Center)) { |
11974 } else if (how == @symbol(Center)) { |
12007 wa.bit_gravity = CenterGravity; |
11975 wa.bit_gravity = CenterGravity; |
12008 } else if (how == @symbol(North)) { |
11976 } else if (how == @symbol(North)) { |
12009 wa.bit_gravity = NorthGravity; |
11977 wa.bit_gravity = NorthGravity; |
12010 } else if (how == @symbol(South)) { |
11978 } else if (how == @symbol(South)) { |
12011 wa.bit_gravity = SouthGravity; |
11979 wa.bit_gravity = SouthGravity; |
12012 } else if (how == @symbol(West)) { |
11980 } else if (how == @symbol(West)) { |
12013 wa.bit_gravity = WestGravity; |
11981 wa.bit_gravity = WestGravity; |
12014 } else if (how == @symbol(East)) { |
11982 } else if (how == @symbol(East)) { |
12015 wa.bit_gravity = EastGravity; |
11983 wa.bit_gravity = EastGravity; |
12016 } else { |
11984 } else { |
12017 wa.bit_gravity = NorthWestGravity; |
11985 wa.bit_gravity = NorthWestGravity; |
12018 } |
11986 } |
12019 |
11987 |
12020 |
11988 |
12021 ENTER_XLIB(); |
11989 ENTER_XLIB(); |
12022 XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa); |
11990 XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa); |
12023 LEAVE_XLIB(); |
11991 LEAVE_XLIB(); |
12024 |
11992 |
12025 RETURN ( self ); |
11993 RETURN ( self ); |
12026 } |
11994 } |
12027 %}. |
11995 %}. |
12028 self primitiveFailedOrClosedConnection |
11996 self primitiveFailedOrClosedConnection |
12029 ! |
11997 ! |
12030 |
11998 |
12035 %{ |
12003 %{ |
12036 |
12004 |
12037 if (ISCONNECTED |
12005 if (ISCONNECTED |
12038 && __isExternalAddress(aWindowId) |
12006 && __isExternalAddress(aWindowId) |
12039 && __isExternalAddress(aCursorId)) { |
12007 && __isExternalAddress(aCursorId)) { |
12040 Display *dpy = myDpy; |
12008 Display *dpy = myDpy; |
12041 Window w = __WindowVal(aWindowId); |
12009 Window w = __WindowVal(aWindowId); |
12042 Cursor c = __CursorVal(aCursorId); |
12010 Cursor c = __CursorVal(aCursorId); |
12043 |
12011 |
12044 if (w && c) { |
12012 if (w && c) { |
12045 ENTER_XLIB(); |
12013 ENTER_XLIB(); |
12046 XDefineCursor(dpy, w, c); |
12014 XDefineCursor(dpy, w, c); |
12047 LEAVE_XLIB(); |
12015 LEAVE_XLIB(); |
12048 } |
12016 } |
12049 RETURN ( self ); |
12017 RETURN ( self ); |
12050 } |
12018 } |
12051 %}. |
12019 %}. |
12052 self primitiveFailedOrClosedConnection |
12020 self primitiveFailedOrClosedConnection |
12053 ! |
12021 ! |
12054 |
12022 |
12060 |
12028 |
12061 "/ self raiseWindow:aWindowId. |
12029 "/ self raiseWindow:aWindowId. |
12062 |
12030 |
12063 activeWindowAtom := self atomIDOf:#'_NET_ACTIVE_WINDOW' create:false. |
12031 activeWindowAtom := self atomIDOf:#'_NET_ACTIVE_WINDOW' create:false. |
12064 activeWindowAtom notNil ifTrue:[ |
12032 activeWindowAtom notNil ifTrue:[ |
12065 self |
12033 self |
12066 sendClientEvent:activeWindowAtom |
12034 sendClientEvent:activeWindowAtom |
12067 format:32 |
12035 format:32 |
12068 to:(self rootWindowId) |
12036 to:(self rootWindowId) |
12069 propagate:false |
12037 propagate:false |
12070 eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect)) |
12038 eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect)) |
12071 window:aWindowId |
12039 window:aWindowId |
12072 data1:2 "activate request from pager. This is a trick: kwm ignores requests from applications (1)" |
12040 data1:2 "activate request from pager. This is a trick: kwm ignores requests from applications (1)" |
12073 data2:nil |
12041 data2:nil |
12074 data3:nil |
12042 data3:nil |
12075 data4:nil |
12043 data4:nil |
12076 data5:nil. |
12044 data5:nil. |
12077 ]. |
12045 ]. |
12078 |
12046 |
12079 " |
12047 " |
12080 Transcript topView setForegroundWindow |
12048 Transcript topView setForegroundWindow |
12081 " |
12049 " |
12090 |
12058 |
12091 utf8StringAtom := self atomIDOf:#UTF8_STRING create:true. |
12059 utf8StringAtom := self atomIDOf:#UTF8_STRING create:true. |
12092 |
12060 |
12093 utf8String := aString utf8Encoded. |
12061 utf8String := aString utf8Encoded. |
12094 aString isWideString ifTrue:[ |
12062 aString isWideString ifTrue:[ |
12095 "/ X does not like 2-byte labels ... |
12063 "/ X does not like 2-byte labels ... |
12096 simpleString := aString asSingleByteStringReplaceInvalidWith:$? |
12064 simpleString := aString asSingleByteStringReplaceInvalidWith:$? |
12097 ] ifFalse:[ |
12065 ] ifFalse:[ |
12098 simpleString := aString. |
12066 simpleString := aString. |
12099 ]. |
12067 ]. |
12100 |
12068 |
12101 %{ |
12069 %{ |
12102 XTextProperty titleProperty; |
12070 XTextProperty titleProperty; |
12103 |
12071 |
12104 if (ISCONNECTED |
12072 if (ISCONNECTED |
12105 && __isStringLike(utf8String) |
12073 && __isStringLike(utf8String) |
12106 && __isStringLike(simpleString) |
12074 && __isStringLike(simpleString) |
12107 && __isExternalAddress(aWindowId)) { |
12075 && __isExternalAddress(aWindowId)) { |
12108 |
12076 |
12109 titleProperty.value = __stringVal(utf8String); |
12077 titleProperty.value = __stringVal(utf8String); |
12110 titleProperty.encoding = __smallIntegerVal(utf8StringAtom); |
12078 titleProperty.encoding = __smallIntegerVal(utf8StringAtom); |
12111 titleProperty.format = 8; |
12079 titleProperty.format = 8; |
12112 titleProperty.nitems = __stringSize(utf8String); |
12080 titleProperty.nitems = __stringSize(utf8String); |
12113 |
12081 |
12114 ENTER_XLIB(); |
12082 ENTER_XLIB(); |
12115 XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString)); |
12083 XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString)); |
12116 /* alternative settings for UTF8-Strings */ |
12084 /* alternative settings for UTF8-Strings */ |
12117 XSetWMIconName(myDpy, __WindowVal(aWindowId), &titleProperty); |
12085 XSetWMIconName(myDpy, __WindowVal(aWindowId), &titleProperty); |
12118 LEAVE_XLIB(); |
12086 LEAVE_XLIB(); |
12119 RETURN ( self ); |
12087 RETURN ( self ); |
12120 } |
12088 } |
12121 %}. |
12089 %}. |
12122 self primitiveFailedOrClosedConnection |
12090 self primitiveFailedOrClosedConnection |
12123 ! |
12091 ! |
12124 |
12092 |
12130 |
12098 |
12131 XSetWindowAttributes wa; |
12099 XSetWindowAttributes wa; |
12132 |
12100 |
12133 if (ISCONNECTED |
12101 if (ISCONNECTED |
12134 && __isExternalAddress(aWindowId)) { |
12102 && __isExternalAddress(aWindowId)) { |
12135 if (__INST(hasSaveUnder) == true) { |
12103 if (__INST(hasSaveUnder) == true) { |
12136 wa.save_under = (yesOrNo == true) ? 1 : 0; |
12104 wa.save_under = (yesOrNo == true) ? 1 : 0; |
12137 ENTER_XLIB(); |
12105 ENTER_XLIB(); |
12138 XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa); |
12106 XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa); |
12139 LEAVE_XLIB(); |
12107 LEAVE_XLIB(); |
12140 } |
12108 } |
12141 RETURN ( self ); |
12109 RETURN ( self ); |
12142 } |
12110 } |
12143 %}. |
12111 %}. |
12144 self primitiveFailedOrClosedConnection |
12112 self primitiveFailedOrClosedConnection |
12145 ! |
12113 ! |
12146 |
12114 |
12150 <context: #return> |
12118 <context: #return> |
12151 %{ |
12119 %{ |
12152 |
12120 |
12153 if (ISCONNECTED |
12121 if (ISCONNECTED |
12154 && __isExternalAddress(aWindowId)) { |
12122 && __isExternalAddress(aWindowId)) { |
12155 Window w; |
12123 Window w; |
12156 |
12124 |
12157 if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) { |
12125 if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) { |
12158 w = (Window) 0; |
12126 w = (Window) 0; |
12159 } else { |
12127 } else { |
12160 if (__isExternalAddress(aMainWindowId)) { |
12128 if (__isExternalAddress(aMainWindowId)) { |
12161 w = __WindowVal(aMainWindowId); |
12129 w = __WindowVal(aMainWindowId); |
12162 } else { |
12130 } else { |
12163 goto getOutOfHere; |
12131 goto getOutOfHere; |
12164 } |
12132 } |
12165 } |
12133 } |
12166 ENTER_XLIB(); |
12134 ENTER_XLIB(); |
12167 XSetTransientForHint(myDpy, __WindowVal(aWindowId), w); |
12135 XSetTransientForHint(myDpy, __WindowVal(aWindowId), w); |
12168 LEAVE_XLIB(); |
12136 LEAVE_XLIB(); |
12169 RETURN ( self ); |
12137 RETURN ( self ); |
12170 } |
12138 } |
12171 getOutOfHere: ; |
12139 getOutOfHere: ; |
12172 %}. |
12140 %}. |
12173 self primitiveFailedOrClosedConnection |
12141 self primitiveFailedOrClosedConnection |
12174 ! |
12142 ! |
12182 %{ |
12150 %{ |
12183 |
12151 |
12184 if (ISCONNECTED |
12152 if (ISCONNECTED |
12185 && __isExternalAddress(aWindowId) |
12153 && __isExternalAddress(aWindowId) |
12186 && __isSmallInteger(aColorIndex)) { |
12154 && __isSmallInteger(aColorIndex)) { |
12187 ENTER_XLIB(); |
12155 ENTER_XLIB(); |
12188 XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex)); |
12156 XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex)); |
12189 LEAVE_XLIB(); |
12157 LEAVE_XLIB(); |
12190 RETURN ( self ); |
12158 RETURN ( self ); |
12191 } |
12159 } |
12192 %}. |
12160 %}. |
12193 self primitiveFailedOrClosedConnection |
12161 self primitiveFailedOrClosedConnection |
12194 ! |
12162 ! |
12195 |
12163 |
12203 %{ /* STACK: 64000 */ |
12171 %{ /* STACK: 64000 */ |
12204 |
12172 |
12205 if (ISCONNECTED |
12173 if (ISCONNECTED |
12206 && __isExternalAddress(aWindowId) |
12174 && __isExternalAddress(aWindowId) |
12207 && __isExternalAddress(aPixmapId)) { |
12175 && __isExternalAddress(aPixmapId)) { |
12208 ENTER_XLIB(); |
12176 ENTER_XLIB(); |
12209 XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId)); |
12177 XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId)); |
12210 LEAVE_XLIB(); |
12178 LEAVE_XLIB(); |
12211 RETURN ( self ); |
12179 RETURN ( self ); |
12212 } |
12180 } |
12213 %}. |
12181 %}. |
12214 self primitiveFailedOrClosedConnection |
12182 self primitiveFailedOrClosedConnection |
12215 ! |
12183 ! |
12216 |
12184 |
12221 %{ |
12189 %{ |
12222 |
12190 |
12223 if (ISCONNECTED |
12191 if (ISCONNECTED |
12224 && __isExternalAddress(aWindowId) |
12192 && __isExternalAddress(aWindowId) |
12225 && __isSmallInteger(aColorIndex)) { |
12193 && __isSmallInteger(aColorIndex)) { |
12226 ENTER_XLIB(); |
12194 ENTER_XLIB(); |
12227 XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex)); |
12195 XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex)); |
12228 LEAVE_XLIB(); |
12196 LEAVE_XLIB(); |
12229 RETURN ( self ); |
12197 RETURN ( self ); |
12230 } |
12198 } |
12231 %}. |
12199 %}. |
12232 self primitiveFailedOrClosedConnection |
12200 self primitiveFailedOrClosedConnection |
12233 ! |
12201 ! |
12234 |
12202 |
12239 %{ |
12207 %{ |
12240 |
12208 |
12241 if (ISCONNECTED |
12209 if (ISCONNECTED |
12242 && __isExternalAddress(aWindowId) |
12210 && __isExternalAddress(aWindowId) |
12243 && __isExternalAddress(aPixmapId)) { |
12211 && __isExternalAddress(aPixmapId)) { |
12244 ENTER_XLIB(); |
12212 ENTER_XLIB(); |
12245 XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId)); |
12213 XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId)); |
12246 LEAVE_XLIB(); |
12214 LEAVE_XLIB(); |
12247 RETURN ( self ); |
12215 RETURN ( self ); |
12248 } |
12216 } |
12249 %}. |
12217 %}. |
12250 self primitiveFailedOrClosedConnection |
12218 self primitiveFailedOrClosedConnection |
12251 ! |
12219 ! |
12252 |
12220 |
12261 |
12229 |
12262 #ifdef SHAPE |
12230 #ifdef SHAPE |
12263 Pixmap shapeBitmap; |
12231 Pixmap shapeBitmap; |
12264 |
12232 |
12265 if (__isExternalAddress(aPixmapId)) |
12233 if (__isExternalAddress(aPixmapId)) |
12266 shapeBitmap = __PixmapVal(aPixmapId); |
12234 shapeBitmap = __PixmapVal(aPixmapId); |
12267 else |
12235 else |
12268 shapeBitmap = (Pixmap)0; |
12236 shapeBitmap = (Pixmap)0; |
12269 |
12237 |
12270 if (ISCONNECTED |
12238 if (ISCONNECTED |
12271 && __isExternalAddress(aWindowId)) { |
12239 && __isExternalAddress(aWindowId)) { |
12272 ENTER_XLIB(); |
12240 ENTER_XLIB(); |
12273 XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding, |
12241 XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding, |
12274 0, 0, shapeBitmap, ShapeSet); |
12242 0, 0, shapeBitmap, ShapeSet); |
12275 LEAVE_XLIB(); |
12243 LEAVE_XLIB(); |
12276 RETURN ( self ); |
12244 RETURN ( self ); |
12277 } |
12245 } |
12278 #endif |
12246 #endif |
12279 %}. |
12247 %}. |
12280 self primitiveFailedOrClosedConnection |
12248 self primitiveFailedOrClosedConnection |
12281 ! |
12249 ! |
12287 %{ |
12255 %{ |
12288 |
12256 |
12289 if (ISCONNECTED |
12257 if (ISCONNECTED |
12290 && __isExternalAddress(aWindowId) |
12258 && __isExternalAddress(aWindowId) |
12291 && __isSmallInteger(aNumber)) { |
12259 && __isSmallInteger(aNumber)) { |
12292 ENTER_XLIB(); |
12260 ENTER_XLIB(); |
12293 XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber)); |
12261 XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber)); |
12294 LEAVE_XLIB(); |
12262 LEAVE_XLIB(); |
12295 RETURN ( self ); |
12263 RETURN ( self ); |
12296 } |
12264 } |
12297 %}. |
12265 %}. |
12298 self primitiveFailedOrClosedConnection |
12266 self primitiveFailedOrClosedConnection |
12299 ! |
12267 ! |
12300 |
12268 |
12305 |
12273 |
12306 <context: #return> |
12274 <context: #return> |
12307 %{ |
12275 %{ |
12308 if (ISCONNECTED |
12276 if (ISCONNECTED |
12309 && __isExternalAddress(aWindowId)) { |
12277 && __isExternalAddress(aWindowId)) { |
12310 XClassHint classhint; |
12278 XClassHint classhint; |
12311 |
12279 |
12312 classhint.res_class = classhint.res_name = 0; |
12280 classhint.res_class = classhint.res_name = 0; |
12313 |
12281 |
12314 if (__isStringLike(wClass)) { |
12282 if (__isStringLike(wClass)) { |
12315 classhint.res_class = (char *) __stringVal(wClass); |
12283 classhint.res_class = (char *) __stringVal(wClass); |
12316 } else if (wClass != nil) |
12284 } else if (wClass != nil) |
12317 goto error; |
12285 goto error; |
12318 |
12286 |
12319 if (__isStringLike(wName)) { |
12287 if (__isStringLike(wName)) { |
12320 classhint.res_name = (char *) __stringVal(wName); |
12288 classhint.res_name = (char *) __stringVal(wName); |
12321 } else if (wName != nil) |
12289 } else if (wName != nil) |
12322 goto error; |
12290 goto error; |
12323 |
12291 |
12324 ENTER_XLIB(); |
12292 ENTER_XLIB(); |
12325 XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint); |
12293 XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint); |
12326 LEAVE_XLIB(); |
12294 LEAVE_XLIB(); |
12327 RETURN ( self ); |
12295 RETURN ( self ); |
12328 error:; |
12296 error:; |
12329 } |
12297 } |
12330 %}. |
12298 %}. |
12331 self primitiveFailedOrClosedConnection |
12299 self primitiveFailedOrClosedConnection |
12332 ! |
12300 ! |
12339 |
12307 |
12340 XSetWindowAttributes wa; |
12308 XSetWindowAttributes wa; |
12341 |
12309 |
12342 if (ISCONNECTED |
12310 if (ISCONNECTED |
12343 && __isExternalAddress(aWindowId)) { |
12311 && __isExternalAddress(aWindowId)) { |
12344 if (how == @symbol(NorthWest)) { |
12312 if (how == @symbol(NorthWest)) { |
12345 wa.win_gravity = NorthWestGravity; |
12313 wa.win_gravity = NorthWestGravity; |
12346 } else if (how == @symbol(NorthEast)) { |
12314 } else if (how == @symbol(NorthEast)) { |
12347 wa.win_gravity = NorthEastGravity; |
12315 wa.win_gravity = NorthEastGravity; |
12348 } else if (how == @symbol(SouthWest)) { |
12316 } else if (how == @symbol(SouthWest)) { |
12349 wa.win_gravity = SouthWestGravity; |
12317 wa.win_gravity = SouthWestGravity; |
12350 } else if (how == @symbol(SouthEast)) { |
12318 } else if (how == @symbol(SouthEast)) { |
12351 wa.win_gravity = SouthEastGravity; |
12319 wa.win_gravity = SouthEastGravity; |
12352 } else if (how == @symbol(Center)) { |
12320 } else if (how == @symbol(Center)) { |
12353 wa.win_gravity = CenterGravity; |
12321 wa.win_gravity = CenterGravity; |
12354 } else if (how == @symbol(North)) { |
12322 } else if (how == @symbol(North)) { |
12355 wa.win_gravity = NorthGravity; |
12323 wa.win_gravity = NorthGravity; |
12356 } else if (how == @symbol(South)) { |
12324 } else if (how == @symbol(South)) { |
12357 wa.win_gravity = SouthGravity; |
12325 wa.win_gravity = SouthGravity; |
12358 } else if (how == @symbol(West)) { |
12326 } else if (how == @symbol(West)) { |
12359 wa.win_gravity = WestGravity; |
12327 wa.win_gravity = WestGravity; |
12360 } else if (how == @symbol(East)) { |
12328 } else if (how == @symbol(East)) { |
12361 wa.win_gravity = EastGravity; |
12329 wa.win_gravity = EastGravity; |
12362 } else { |
12330 } else { |
12363 wa.win_gravity = NorthWestGravity; |
12331 wa.win_gravity = NorthWestGravity; |
12364 } |
12332 } |
12365 |
12333 |
12366 |
12334 |
12367 ENTER_XLIB(); |
12335 ENTER_XLIB(); |
12368 XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa); |
12336 XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa); |
12369 LEAVE_XLIB(); |
12337 LEAVE_XLIB(); |
12370 |
12338 |
12371 RETURN ( self ); |
12339 RETURN ( self ); |
12372 } |
12340 } |
12373 %}. |
12341 %}. |
12374 self primitiveFailedOrClosedConnection |
12342 self primitiveFailedOrClosedConnection |
12375 ! |
12343 ! |
12376 |
12344 |
12380 <context: #return> |
12348 <context: #return> |
12381 |
12349 |
12382 |iconId| |
12350 |iconId| |
12383 |
12351 |
12384 aForm notNil ifTrue:[ |
12352 aForm notNil ifTrue:[ |
12385 iconId := aForm id |
12353 iconId := aForm id |
12386 ]. |
12354 ]. |
12387 %{ |
12355 %{ |
12388 if (ISCONNECTED |
12356 if (ISCONNECTED |
12389 && __isExternalAddress(iconId) |
12357 && __isExternalAddress(iconId) |
12390 && __isExternalAddress(aWindowId)) { |
12358 && __isExternalAddress(aWindowId)) { |
12391 XWMHints hints; |
12359 XWMHints hints; |
12392 |
12360 |
12393 hints.icon_pixmap = __PixmapVal(iconId); |
12361 hints.icon_pixmap = __PixmapVal(iconId); |
12394 hints.flags = IconPixmapHint; |
12362 hints.flags = IconPixmapHint; |
12395 ENTER_XLIB(); |
12363 ENTER_XLIB(); |
12396 XSetWMHints(myDpy, __WindowVal(aWindowId), &hints); |
12364 XSetWMHints(myDpy, __WindowVal(aWindowId), &hints); |
12397 LEAVE_XLIB(); |
12365 LEAVE_XLIB(); |
12398 RETURN ( self ); |
12366 RETURN ( self ); |
12399 } |
12367 } |
12400 %}. |
12368 %}. |
12401 self primitiveFailedOrClosedConnection |
12369 self primitiveFailedOrClosedConnection |
12402 ! |
12370 ! |
12403 |
12371 |
12407 <context: #return> |
12375 <context: #return> |
12408 |
12376 |
12409 |iconId maskId| |
12377 |iconId maskId| |
12410 |
12378 |
12411 aForm notNil ifTrue:[ |
12379 aForm notNil ifTrue:[ |
12412 iconId := aForm id |
12380 iconId := aForm id |
12413 ]. |
12381 ]. |
12414 aMaskForm notNil ifTrue:[ |
12382 aMaskForm notNil ifTrue:[ |
12415 maskId := aMaskForm id. |
12383 maskId := aMaskForm id. |
12416 ]. |
12384 ]. |
12417 %{ |
12385 %{ |
12418 if (ISCONNECTED |
12386 if (ISCONNECTED |
12419 && __isExternalAddress(iconId) |
12387 && __isExternalAddress(iconId) |
12420 && __isExternalAddress(aWindowId)) { |
12388 && __isExternalAddress(aWindowId)) { |
12421 XWMHints hints; |
12389 XWMHints hints; |
12422 |
12390 |
12423 hints.icon_pixmap = __PixmapVal(iconId); |
12391 hints.icon_pixmap = __PixmapVal(iconId); |
12424 hints.flags = IconPixmapHint; |
12392 hints.flags = IconPixmapHint; |
12425 if ((maskId != nil) |
12393 if ((maskId != nil) |
12426 && __isExternalAddress(maskId)) { |
12394 && __isExternalAddress(maskId)) { |
12427 hints.icon_mask = __PixmapVal(maskId); |
12395 hints.icon_mask = __PixmapVal(maskId); |
12428 hints.flags |= IconMaskHint; |
12396 hints.flags |= IconMaskHint; |
12429 } |
12397 } |
12430 ENTER_XLIB(); |
12398 ENTER_XLIB(); |
12431 XSetWMHints(myDpy, __WindowVal(aWindowId), &hints); |
12399 XSetWMHints(myDpy, __WindowVal(aWindowId), &hints); |
12432 LEAVE_XLIB(); |
12400 LEAVE_XLIB(); |
12433 RETURN ( self ); |
12401 RETURN ( self ); |
12434 } |
12402 } |
12435 %}. |
12403 %}. |
12436 self primitiveFailedOrClosedConnection |
12404 self primitiveFailedOrClosedConnection |
12437 |
12405 |
12438 ! |
12406 ! |
12443 <context: #return> |
12411 <context: #return> |
12444 |
12412 |
12445 |iconWindowId| |
12413 |iconWindowId| |
12446 |
12414 |
12447 aView notNil ifTrue:[ |
12415 aView notNil ifTrue:[ |
12448 iconWindowId := aView id |
12416 iconWindowId := aView id |
12449 ]. |
12417 ]. |
12450 %{ |
12418 %{ |
12451 if (ISCONNECTED |
12419 if (ISCONNECTED |
12452 && __isExternalAddress(iconWindowId) |
12420 && __isExternalAddress(iconWindowId) |
12453 && __isExternalAddress(aWindowId)) { |
12421 && __isExternalAddress(aWindowId)) { |
12454 XWMHints wmhints; |
12422 XWMHints wmhints; |
12455 |
12423 |
12456 wmhints.icon_window = __WindowVal(iconWindowId); |
12424 wmhints.icon_window = __WindowVal(iconWindowId); |
12457 wmhints.flags = IconWindowHint; |
12425 wmhints.flags = IconWindowHint; |
12458 ENTER_XLIB(); |
12426 ENTER_XLIB(); |
12459 XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints); |
12427 XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints); |
12460 LEAVE_XLIB(); |
12428 LEAVE_XLIB(); |
12461 RETURN ( self ); |
12429 RETURN ( self ); |
12462 } |
12430 } |
12463 %}. |
12431 %}. |
12464 self primitiveFailedOrClosedConnection |
12432 self primitiveFailedOrClosedConnection |
12465 ! |
12433 ! |
12466 |
12434 |
12470 |
12438 |
12471 <context: #return> |
12439 <context: #return> |
12472 %{ |
12440 %{ |
12473 if (ISCONNECTED |
12441 if (ISCONNECTED |
12474 && __isExternalAddress(aWindowId)) { |
12442 && __isExternalAddress(aWindowId)) { |
12475 Display *dpy = myDpy; |
12443 Display *dpy = myDpy; |
12476 XSizeHints szhints; |
12444 XSizeHints szhints; |
12477 Window win; |
12445 Window win; |
12478 |
12446 |
12479 win = __WindowVal(aWindowId); |
12447 win = __WindowVal(aWindowId); |
12480 |
12448 |
12481 szhints.flags = 0; |
12449 szhints.flags = 0; |
12482 if (__bothSmallInteger(minW, minH)) { |
12450 if (__bothSmallInteger(minW, minH)) { |
12483 szhints.flags |= PMinSize; |
12451 szhints.flags |= PMinSize; |
12484 szhints.min_width = __intVal(minW); |
12452 szhints.min_width = __intVal(minW); |
12485 szhints.min_height = __intVal(minH); |
12453 szhints.min_height = __intVal(minH); |
12486 } |
12454 } |
12487 if (__bothSmallInteger(maxW, maxH)) { |
12455 if (__bothSmallInteger(maxW, maxH)) { |
12488 szhints.flags |= PMaxSize; |
12456 szhints.flags |= PMaxSize; |
12489 szhints.max_width = __intVal(maxW); |
12457 szhints.max_width = __intVal(maxW); |
12490 szhints.max_height = __intVal(maxH); |
12458 szhints.max_height = __intVal(maxH); |
12491 } |
12459 } |
12492 |
12460 |
12493 if (szhints.flags) { |
12461 if (szhints.flags) { |
12494 ENTER_XLIB(); |
12462 ENTER_XLIB(); |
12495 XSetNormalHints(dpy, win, &szhints); |
12463 XSetNormalHints(dpy, win, &szhints); |
12496 LEAVE_XLIB(); |
12464 LEAVE_XLIB(); |
12497 } |
12465 } |
12498 } |
12466 } |
12499 %}. |
12467 %}. |
12500 ! |
12468 ! |
12501 |
12469 |
12502 setWindowName:aString in:aWindowId |
12470 setWindowName:aString in:aWindowId |
12508 |
12476 |
12509 utf8StringAtom := self atomIDOf:#UTF8_STRING create:true. |
12477 utf8StringAtom := self atomIDOf:#UTF8_STRING create:true. |
12510 |
12478 |
12511 utf8String := aString utf8Encoded. |
12479 utf8String := aString utf8Encoded. |
12512 aString isWideString ifTrue:[ |
12480 aString isWideString ifTrue:[ |
12513 "/ X does not like 2-byte labels ... |
12481 "/ X does not like 2-byte labels ... |
12514 simpleString := aString asSingleByteStringReplaceInvalidWith:$? |
12482 simpleString := aString asSingleByteStringReplaceInvalidWith:$? |
12515 ] ifFalse:[ |
12483 ] ifFalse:[ |
12516 simpleString := aString. |
12484 simpleString := aString. |
12517 ]. |
12485 ]. |
12518 |
12486 |
12519 %{ |
12487 %{ |
12520 |
12488 |
12521 XTextProperty titleProperty; |
12489 XTextProperty titleProperty; |
12523 if (ISCONNECTED |
12491 if (ISCONNECTED |
12524 && __isStringLike(utf8String) |
12492 && __isStringLike(utf8String) |
12525 && __isStringLike(simpleString) |
12493 && __isStringLike(simpleString) |
12526 && __isExternalAddress(aWindowId)) { |
12494 && __isExternalAddress(aWindowId)) { |
12527 |
12495 |
12528 titleProperty.value = __stringVal(utf8String); |
12496 titleProperty.value = __stringVal(utf8String); |
12529 titleProperty.encoding = __smallIntegerVal(utf8StringAtom); |
12497 titleProperty.encoding = __smallIntegerVal(utf8StringAtom); |
12530 titleProperty.format = 8; |
12498 titleProperty.format = 8; |
12531 titleProperty.nitems = __stringSize(utf8String); |
12499 titleProperty.nitems = __stringSize(utf8String); |
12532 |
12500 |
12533 ENTER_XLIB(); |
12501 ENTER_XLIB(); |
12534 XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString)); |
12502 XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString)); |
12535 /* alternative settings for UTF8-Strings */ |
12503 /* alternative settings for UTF8-Strings */ |
12536 XSetWMName(myDpy, __WindowVal(aWindowId), &titleProperty); |
12504 XSetWMName(myDpy, __WindowVal(aWindowId), &titleProperty); |
12537 LEAVE_XLIB(); |
12505 LEAVE_XLIB(); |
12538 RETURN ( self ); |
12506 RETURN ( self ); |
12539 } |
12507 } |
12540 %}. |
12508 %}. |
12541 self primitiveFailedOrClosedConnection |
12509 self primitiveFailedOrClosedConnection |
12542 ! |
12510 ! |
12543 |
12511 |
12572 |
12540 |
12573 #ifdef SHAPE |
12541 #ifdef SHAPE |
12574 Pixmap shapeBitmap; |
12542 Pixmap shapeBitmap; |
12575 |
12543 |
12576 if (__isExternalAddress(aPixmapId)) |
12544 if (__isExternalAddress(aPixmapId)) |
12577 shapeBitmap = __PixmapVal(aPixmapId); |
12545 shapeBitmap = __PixmapVal(aPixmapId); |
12578 else |
12546 else |
12579 shapeBitmap = (Pixmap)0; |
12547 shapeBitmap = (Pixmap)0; |
12580 |
12548 |
12581 if (ISCONNECTED |
12549 if (ISCONNECTED |
12582 && __isExternalAddress(aWindowId)) { |
12550 && __isExternalAddress(aWindowId)) { |
12583 ENTER_XLIB(); |
12551 ENTER_XLIB(); |
12584 XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip, |
12552 XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip, |
12585 0, 0, |
12553 0, 0, |
12586 shapeBitmap, ShapeSet); |
12554 shapeBitmap, ShapeSet); |
12587 LEAVE_XLIB(); |
12555 LEAVE_XLIB(); |
12588 RETURN ( self ); |
12556 RETURN ( self ); |
12589 } |
12557 } |
12590 #endif |
12558 #endif |
12591 %}. |
12559 %}. |
12592 self primitiveFailedOrClosedConnection |
12560 self primitiveFailedOrClosedConnection |
12593 ! |
12561 ! |
12600 |
12568 |
12601 netWmWindowStateAtom := self atomIDOf:#'_NET_WM_WINDOW_STATE' create:false. |
12569 netWmWindowStateAtom := self atomIDOf:#'_NET_WM_WINDOW_STATE' create:false. |
12602 stateAtom := self atomIDOf:aSymbol create:false. |
12570 stateAtom := self atomIDOf:aSymbol create:false. |
12603 |
12571 |
12604 (netWmWindowStateAtom notNil and:[stateAtom notNil]) ifTrue:[ |
12572 (netWmWindowStateAtom notNil and:[stateAtom notNil]) ifTrue:[ |
12605 self |
12573 self |
12606 sendClientEvent:netWmWindowStateAtom |
12574 sendClientEvent:netWmWindowStateAtom |
12607 format:32 |
12575 format:32 |
12608 to:(self rootWindowId) |
12576 to:(self rootWindowId) |
12609 propagate:true |
12577 propagate:true |
12610 eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect)) |
12578 eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect)) |
12611 window:aWindowId |
12579 window:aWindowId |
12612 data1:(self atomIDOf:#'_NET_WM_STATE_ADD' create:false) |
12580 data1:(self atomIDOf:#'_NET_WM_STATE_ADD' create:false) |
12613 data2:stateAtom |
12581 data2:stateAtom |
12614 data3:nil |
12582 data3:nil |
12615 data4:1 |
12583 data4:1 |
12616 data5:nil. |
12584 data5:nil. |
12617 ] ifFalse:[self halt.]. |
12585 ] ifFalse:[self halt.]. |
12618 |
12586 |
12619 " |
12587 " |
12620 |v| |
12588 |v| |
12621 |
12589 |
12644 " |
12612 " |
12645 |
12613 |
12646 | nameAtom typeAtom valueAtom | |
12614 | nameAtom typeAtom valueAtom | |
12647 |
12615 |
12648 self assert:(#(_NET_WM_WINDOW_TYPE_DESKTOP |
12616 self assert:(#(_NET_WM_WINDOW_TYPE_DESKTOP |
12649 _NET_WM_WINDOW_TYPE_DOCK |
12617 _NET_WM_WINDOW_TYPE_DOCK |
12650 _NET_WM_WINDOW_TYPE_TOOLBAR |
12618 _NET_WM_WINDOW_TYPE_TOOLBAR |
12651 _NET_WM_WINDOW_TYPE_MENU |
12619 _NET_WM_WINDOW_TYPE_MENU |
12652 _NET_WM_WINDOW_TYPE_UTILITY |
12620 _NET_WM_WINDOW_TYPE_UTILITY |
12653 _NET_WM_WINDOW_TYPE_SPLASH |
12621 _NET_WM_WINDOW_TYPE_SPLASH |
12654 _NET_WM_WINDOW_TYPE_DIALOG |
12622 _NET_WM_WINDOW_TYPE_DIALOG |
12655 _NET_WM_WINDOW_TYPE_NORMAL) includes: aSymbol). |
12623 _NET_WM_WINDOW_TYPE_NORMAL) includes: aSymbol). |
12656 |
12624 |
12657 nameAtom := self atomIDOf:#'_NET_WM_WINDOW_TYPE' create:false. |
12625 nameAtom := self atomIDOf:#'_NET_WM_WINDOW_TYPE' create:false. |
12658 nameAtom isNil ifTrue:[ |
12626 nameAtom isNil ifTrue:[ |
12659 "/Hmm, no such property, not running under EWMH compliant WM? |
12627 "/Hmm, no such property, not running under EWMH compliant WM? |
12660 self breakPoint: #jv. |
12628 self breakPoint: #jv. |
12661 ^self |
12629 ^self |
12662 ]. |
12630 ]. |
12663 "/ Hmm, hmm, no access to XA_ATOM, XA_INTEGER and so on... |
12631 "/ Hmm, hmm, no access to XA_ATOM, XA_INTEGER and so on... |
12664 typeAtom := self atomIDOf:#'ATOM' create:false. |
12632 typeAtom := self atomIDOf:#'ATOM' create:false. |
12665 typeAtom isNil ifTrue:[ |
12633 typeAtom isNil ifTrue:[ |
12666 self error:'Oops, no ATOM atom'. |
12634 self error:'Oops, no ATOM atom'. |
12667 ]. |
12635 ]. |
12668 valueAtom := self atomIDOf: aSymbol create:false. |
12636 valueAtom := self atomIDOf: aSymbol create:false. |
12669 valueAtom isNil ifTrue:[ |
12637 valueAtom isNil ifTrue:[ |
12670 "/Hmm, no such property, not running under EWMH compliant WM? |
12638 "/Hmm, no such property, not running under EWMH compliant WM? |
12671 self breakPoint: #jv. |
12639 self breakPoint: #jv. |
12672 ^self |
12640 ^self |
12673 ]. |
12641 ]. |
12674 |
12642 |
12675 self setProperty: nameAtom type: typeAtom value: valueAtom for: aWindowId. |
12643 self setProperty: nameAtom type: typeAtom value: valueAtom for: aWindowId. |
12676 |
12644 |
12677 |
12645 |
12721 %{ |
12689 %{ |
12722 /* |
12690 /* |
12723 * ignore closed connection |
12691 * ignore closed connection |
12724 */ |
12692 */ |
12725 if (! ISCONNECTED) { |
12693 if (! ISCONNECTED) { |
12726 RETURN ( self ); |
12694 RETURN ( self ); |
12727 } |
12695 } |
12728 |
12696 |
12729 if (__isExternalAddress(aWindowId)) { |
12697 if (__isExternalAddress(aWindowId)) { |
12730 ENTER_XLIB(); |
12698 ENTER_XLIB(); |
12731 XUnmapWindow(myDpy, __WindowVal(aWindowId)); |
12699 XUnmapWindow(myDpy, __WindowVal(aWindowId)); |
12732 LEAVE_XLIB(); |
12700 LEAVE_XLIB(); |
12733 RETURN ( self ); |
12701 RETURN ( self ); |
12734 } |
12702 } |
12735 %}. |
12703 %}. |
12736 self primitiveFailed |
12704 self primitiveFailed |
12737 ! |
12705 ! |
12738 |
12706 |
12743 <context: #return> |
12711 <context: #return> |
12744 %{ |
12712 %{ |
12745 |
12713 |
12746 if (ISCONNECTED |
12714 if (ISCONNECTED |
12747 && __isExternalAddress(aWindowId)) { |
12715 && __isExternalAddress(aWindowId)) { |
12748 Atom JunkAtom; |
12716 Atom JunkAtom; |
12749 int JunkInt; |
12717 int JunkInt; |
12750 unsigned long WinState,JunkLong; |
12718 unsigned long WinState,JunkLong; |
12751 unsigned char *Property; |
12719 unsigned char *Property; |
12752 Atom WM_STATE_Atom; |
12720 Atom WM_STATE_Atom; |
12753 |
12721 |
12754 if (__INST(wmStateAtom) != nil) { |
12722 if (__INST(wmStateAtom) != nil) { |
12755 WM_STATE_Atom = __AtomVal(__INST(wmStateAtom)); |
12723 WM_STATE_Atom = __AtomVal(__INST(wmStateAtom)); |
12756 |
12724 |
12757 ENTER_XLIB(); |
12725 ENTER_XLIB(); |
12758 XGetWindowProperty(myDpy, __WindowVal(aWindowId), |
12726 XGetWindowProperty(myDpy, __WindowVal(aWindowId), |
12759 WM_STATE_Atom, |
12727 WM_STATE_Atom, |
12760 0L, 2L, False, AnyPropertyType, |
12728 0L, 2L, False, AnyPropertyType, |
12761 &JunkAtom,&JunkInt,&WinState,&JunkLong, |
12729 &JunkAtom,&JunkInt,&WinState,&JunkLong, |
12762 &Property); |
12730 &Property); |
12763 LEAVE_XLIB(); |
12731 LEAVE_XLIB(); |
12764 WinState=(unsigned long)(*((long*)Property)); |
12732 WinState=(unsigned long)(*((long*)Property)); |
12765 if (WinState==3) { |
12733 if (WinState==3) { |
12766 RETURN (true); |
12734 RETURN (true); |
12767 } |
12735 } |
12768 } |
12736 } |
12769 RETURN (false); |
12737 RETURN (false); |
12770 } |
12738 } |
12771 %}. |
12739 %}. |
12772 self primitiveFailedOrClosedConnection. |
12740 self primitiveFailedOrClosedConnection. |
12773 ^ false "/ or true or what ? |
12741 ^ false "/ or true or what ? |
12774 ! ! |
12742 ! ! |
12783 For each fetch operation an instance of this class is created. |
12751 For each fetch operation an instance of this class is created. |
12784 The asynchronous messages are queued and executed in the |
12752 The asynchronous messages are queued and executed in the |
12785 process that requests the clipboard. |
12753 process that requests the clipboard. |
12786 |
12754 |
12787 [author:] |
12755 [author:] |
12788 Stefan Vogel (stefan@zwerg) |
12756 Stefan Vogel (stefan@zwerg) |
12789 |
12757 |
12790 [instance variables:] |
12758 [instance variables:] |
12791 |
12759 |
12792 [class variables:] |
12760 [class variables:] |
12793 |
12761 |
12812 "convert the data in buffer to a selection" |
12780 "convert the data in buffer to a selection" |
12813 |
12781 |
12814 |selection| |
12782 |selection| |
12815 |
12783 |
12816 buffer isNil ifTrue:[ |
12784 buffer isNil ifTrue:[ |
12817 ^ nil. |
12785 ^ nil. |
12818 ]. |
12786 ]. |
12819 |
12787 |
12820 targetID == (display atomIDOf:#STRING) ifTrue:[ |
12788 targetID == (display atomIDOf:#STRING) ifTrue:[ |
12821 display clipboardEncoding notNil ifTrue:[ |
12789 display clipboardEncoding notNil ifTrue:[ |
12822 selection := buffer decodeFrom:display clipboardEncoding |
12790 selection := buffer decodeFrom:display clipboardEncoding |
12823 ]. |
12791 ]. |
12824 selection := buffer. |
12792 selection := buffer. |
12825 ] ifFalse:[targetID == (display atomIDOf:#'UTF8_STRING') ifTrue:[ |
12793 ] ifFalse:[targetID == (display atomIDOf:#'UTF8_STRING') ifTrue:[ |
12826 "/ Transcript show:'UTF8: '; showCR:buffer storeString. |
12794 "/ Transcript show:'UTF8: '; showCR:buffer storeString. |
12827 selection := CharacterArray fromUTF8Bytes:buffer |
12795 selection := CharacterArray fromUTF8Bytes:buffer |
12828 ] ifFalse:[targetID == (display atomIDOf:#TEXT) ifTrue:[ |
12796 ] ifFalse:[targetID == (display atomIDOf:#TEXT) ifTrue:[ |
12829 "/ Transcript show:'TEXT: '; showCR:buffer storeString. |
12797 "/ Transcript show:'TEXT: '; showCR:buffer storeString. |
12830 selection := buffer asString |
12798 selection := buffer asString |
12831 ] ifFalse:[targetID == (display atomIDOf:#'COMPOUND_TEXT') ifTrue:[ |
12799 ] ifFalse:[targetID == (display atomIDOf:#'COMPOUND_TEXT') ifTrue:[ |
12832 "/ Transcript show:'COMPOUND_TEXT: '; showCR:buffer storeString. |
12800 "/ Transcript show:'COMPOUND_TEXT: '; showCR:buffer storeString. |
12833 selection := buffer asString |
12801 selection := buffer asString |
12834 ]]]]. |
12802 ]]]]. |
12835 |
12803 |
12836 selection notNil ifTrue:[ |
12804 selection notNil ifTrue:[ |
12837 (selection endsWith:Character cr) ifTrue:[ |
12805 (selection endsWith:Character cr) ifTrue:[ |
12838 selection := selection asStringCollection copyWith:'' |
12806 selection := selection asStringCollection copyWith:'' |
12839 ]. |
12807 ]. |
12840 ^ selection. |
12808 ^ selection. |
12841 ]. |
12809 ]. |
12842 |
12810 |
12843 targetID == (display atomIDOf:#'TARGETS') ifTrue:[ |
12811 targetID == (display atomIDOf:#'TARGETS') ifTrue:[ |
12844 ^ buffer |
12812 ^ buffer |
12845 ]. |
12813 ]. |
12846 targetID == (display atomIDOf:#'ST_OBJECT') ifTrue:[ |
12814 targetID == (display atomIDOf:#'ST_OBJECT') ifTrue:[ |
12847 "require libboss to be loaded" |
12815 "require libboss to be loaded" |
12848 (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[ |
12816 (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[ |
12849 'SelectionFetch: cannot decode object (libboss library missing)' errorPrintCR. |
12817 'SelectionFetch: cannot decode object (libboss library missing)' errorPrintCR. |
12850 ^ nil |
12818 ^ nil |
12851 ]. |
12819 ]. |
12852 ^ (Object |
12820 ^ (Object |
12853 readBinaryFrom:(ReadStream on:buffer) |
12821 readBinaryFrom:(ReadStream on:buffer) |
12854 onError:[:ex | |
12822 onError:[:ex | |
12855 ('SelectionFetch: error while decoding binary object: ',ex description) errorPrintCR. |
12823 ('SelectionFetch: error while decoding binary object: ',ex description) errorPrintCR. |
12856 nil |
12824 nil |
12857 ]) |
12825 ]) |
12858 ]. |
12826 ]. |
12859 |
12827 |
12860 'XWorkstation: unimplemented property targetID: ' infoPrint. (display atomName:targetID) infoPrint. |
12828 'XWorkstation: unimplemented property targetID: ' infoPrint. (display atomName:targetID) infoPrint. |
12861 ' buffer:' infoPrint. buffer infoPrintCR. |
12829 ' buffer:' infoPrint. buffer infoPrintCR. |
12862 ^ nil |
12830 ^ nil |
12869 message:aMessage |
12837 message:aMessage |
12870 "got an asynchronous event from the display. |
12838 "got an asynchronous event from the display. |
12871 Save and wake up waiters" |
12839 Save and wake up waiters" |
12872 |
12840 |
12873 aMessage selector == #propertyChange:property:state:time: ifTrue:[ |
12841 aMessage selector == #propertyChange:property:state:time: ifTrue:[ |
12874 (aMessage arguments at:2) ~~ propertyID ifTrue:[ |
12842 (aMessage arguments at:2) ~~ propertyID ifTrue:[ |
12875 "I am only interested in changes of the property used to |
12843 "I am only interested in changes of the property used to |
12876 store the selection" |
12844 store the selection" |
12877 ^ self. |
12845 ^ self. |
12878 ]. |
12846 ]. |
12879 message notNil ifTrue:[ |
12847 message notNil ifTrue:[ |
12880 "this should not happen - bad selection holder?" |
12848 "this should not happen - bad selection holder?" |
12881 'XWorkstation(error): message overflow: ' errorPrint. display errorPrintCR. |
12849 'XWorkstation(error): message overflow: ' errorPrint. display errorPrintCR. |
12882 ^ self. |
12850 ^ self. |
12883 ]. |
12851 ]. |
12884 ]. |
12852 ]. |
12885 |
12853 |
12886 "we get a propertyChange before the selectionNotify. |
12854 "we get a propertyChange before the selectionNotify. |
12887 Since the propertyChange will be ignored anyway (because we are not in incremental mod, |
12855 Since the propertyChange will be ignored anyway (because we are not in incremental mod, |
12888 a selectionNotify message may overwrite a propertyChange message" |
12856 a selectionNotify message may overwrite a propertyChange message" |
12895 "this is a forwarded propretyChange event from XWorkstation" |
12863 "this is a forwarded propretyChange event from XWorkstation" |
12896 |
12864 |
12897 |property propertyValue| |
12865 |property propertyValue| |
12898 |
12866 |
12899 incremental ifFalse:[ |
12867 incremental ifFalse:[ |
12900 "ignore property changes until we are in incremental mode" |
12868 "ignore property changes until we are in incremental mode" |
12901 ^ self. |
12869 ^ self. |
12902 ]. |
12870 ]. |
12903 |
12871 |
12904 property := display getProperty:propertyID from:drawableID delete:true. |
12872 property := display getProperty:propertyID from:drawableID delete:true. |
12905 propertyValue := property value. |
12873 propertyValue := property value. |
12906 |
12874 |
12907 propertyValue size == 0 ifTrue:[ |
12875 propertyValue size == 0 ifTrue:[ |
12908 "property with size 0 signals end of transfer" |
12876 "property with size 0 signals end of transfer" |
12909 done := true. |
12877 done := true. |
12910 ] ifFalse:[ |
12878 ] ifFalse:[ |
12911 buffer isNil ifTrue:[ |
12879 buffer isNil ifTrue:[ |
12912 targetID := property key. |
12880 targetID := property key. |
12913 buffer := propertyValue. |
12881 buffer := propertyValue. |
12914 ] ifFalse:[ |
12882 ] ifFalse:[ |
12915 targetID ~= property key ifTrue:[ |
12883 targetID ~= property key ifTrue:[ |
12916 'XWorkstation(warning): targetID change in incremental select: ' errorPrint. display errorPrintCR. |
12884 'XWorkstation(warning): targetID change in incremental select: ' errorPrint. display errorPrintCR. |
12917 ]. |
12885 ]. |
12918 buffer := buffer, propertyValue. |
12886 buffer := buffer, propertyValue. |
12919 ]. |
12887 ]. |
12920 ]. |
12888 ]. |
12921 ! |
12889 ! |
12922 |
12890 |
12923 selectionClear:aView selection:selectionId time:time |
12891 selectionClear:aView selection:selectionId time:time |
12924 "sent when another X-client has created a selection. |
12892 "sent when another X-client has created a selection. |
12929 "this is a forwarded selectionNotify event from XWorkstation" |
12897 "this is a forwarded selectionNotify event from XWorkstation" |
12930 |
12898 |
12931 |property propertyKey atomName| |
12899 |property propertyKey atomName| |
12932 |
12900 |
12933 aSelectionID ~~ selectionID ifTrue:[ |
12901 aSelectionID ~~ selectionID ifTrue:[ |
12934 "ignore notification that is not for our selection" |
12902 "ignore notification that is not for our selection" |
12935 ^ self. |
12903 ^ self. |
12936 ]. |
12904 ]. |
12937 |
12905 |
12938 aPropertyID == 0 ifTrue:[ |
12906 aPropertyID == 0 ifTrue:[ |
12939 "the selection owner could not convert the selection to our target type" |
12907 "the selection owner could not convert the selection to our target type" |
12940 done := true. |
12908 done := true. |
12941 ^ self. |
12909 ^ self. |
12942 ]. |
12910 ]. |
12943 |
12911 |
12944 property := display getProperty:aPropertyID from:drawableID delete:true. |
12912 property := display getProperty:aPropertyID from:drawableID delete:true. |
12945 property isNil ifTrue:[ |
12913 property isNil ifTrue:[ |
12946 "the property does not exist in the specified window" |
12914 "the property does not exist in the specified window" |
12947 done := true. |
12915 done := true. |
12948 ^ self |
12916 ^ self |
12949 ]. |
12917 ]. |
12950 |
12918 |
12951 propertyKey := property key. |
12919 propertyKey := property key. |
12952 propertyKey == aTargetID ifTrue:[ |
12920 propertyKey == aTargetID ifTrue:[ |
12953 "good, the property is consistent with our request. |
12921 "good, the property is consistent with our request. |
12954 The whole selection is in the property" |
12922 The whole selection is in the property" |
12955 buffer := property value. |
12923 buffer := property value. |
12956 done := true. |
12924 done := true. |
12957 ] ifFalse:[propertyKey == (display atomIDOf:#INCR) ifTrue:[ |
12925 ] ifFalse:[propertyKey == (display atomIDOf:#INCR) ifTrue:[ |
12958 "this is an incremental transfer. Wait for property change" |
12926 "this is an incremental transfer. Wait for property change" |
12959 incremental := true. |
12927 incremental := true. |
12960 ] ifFalse:[ |
12928 ] ifFalse:[ |
12961 atomName := (display atomName:propertyKey) ? propertyKey. |
12929 atomName := (display atomName:propertyKey) ? propertyKey. |
12962 'XWorkstation(error): unexpected targetID (' errorPrint. |
12930 'XWorkstation(error): unexpected targetID (' errorPrint. |
12963 atomName errorPrint. |
12931 atomName errorPrint. |
12964 ') in selectionNotify: ' errorPrint. |
12932 ') in selectionNotify: ' errorPrint. |
12965 display errorPrintCR. |
12933 display errorPrintCR. |
12966 done := true. |
12934 done := true. |
12967 ]]. |
12935 ]]. |
12968 ! ! |
12936 ! ! |
12969 |
12937 |
12970 !XWorkstation::SelectionFetcher methodsFor:'selection actions'! |
12938 !XWorkstation::SelectionFetcher methodsFor:'selection actions'! |
12971 |
12939 |
12982 sema := Semaphore new name:'X11SelectionFetcher'. |
12950 sema := Semaphore new name:'X11SelectionFetcher'. |
12983 done := false. |
12951 done := false. |
12984 incremental := false. |
12952 incremental := false. |
12985 |
12953 |
12986 [ |
12954 [ |
12987 |timeout| |
12955 |timeout| |
12988 |
12956 |
12989 display registerSelectionFetcher:self. |
12957 display registerSelectionFetcher:self. |
12990 |
12958 |
12991 display |
12959 display |
12992 requestSelection:aSelectionId |
12960 requestSelection:aSelectionId |
12993 type:aTargetId |
12961 type:aTargetId |
12994 for:drawableID |
12962 for:drawableID |
12995 intoProperty:propertyID. |
12963 intoProperty:propertyID. |
12996 |
12964 |
12997 timeout := display xlibTimeout. |
12965 timeout := display xlibTimeout. |
12998 [ |
12966 [ |
12999 |currentMessage| |
12967 |currentMessage| |
13000 |
12968 |
13001 (sema waitWithTimeout:timeout) isNil ifTrue:[ |
12969 (sema waitWithTimeout:timeout) isNil ifTrue:[ |
13002 "the selection owner didn't respond within reasonable time" |
12970 "the selection owner didn't respond within reasonable time" |
13003 'XWorkstation(error): selection owner does not respond:' infoPrint. display infoPrintCR. |
12971 'XWorkstation(error): selection owner does not respond:' infoPrint. display infoPrintCR. |
13004 ^ nil. |
12972 ^ nil. |
13005 ]. |
12973 ]. |
13006 currentMessage := message. |
12974 currentMessage := message. |
13007 message := nil. |
12975 message := nil. |
13008 currentMessage notNil ifTrue:[currentMessage sendTo:self]. |
12976 currentMessage notNil ifTrue:[currentMessage sendTo:self]. |
13009 ] doUntil:[done]. |
12977 ] doUntil:[done]. |
13010 ] ensure:[ |
12978 ] ensure:[ |
13011 display unregisterSelectionFetcher:self. |
12979 display unregisterSelectionFetcher:self. |
13012 ]. |
12980 ]. |
13013 |
12981 |
13014 ^ self getSelection |
12982 ^ self getSelection |
13015 ! ! |
12983 ! ! |
13016 |
12984 |
13028 " |
12996 " |
13029 A special window to serve as window group id. This window |
12997 A special window to serve as window group id. This window |
13030 is newer mapped. |
12998 is newer mapped. |
13031 |
12999 |
13032 [author:] |
13000 [author:] |
13033 Jan Vrany <jan.vrany@fit.cvut.cz> |
13001 Jan Vrany <jan.vrany@fit.cvut.cz> |
13034 |
13002 |
13035 [instance variables:] |
13003 [instance variables:] |
13036 |
13004 |
13037 [class variables:] |
13005 [class variables:] |
13038 |
13006 |
13039 [see also:] |
13007 [see also:] |
13040 Inter-Client Communication Conventions Manual [http://tronche.com/gui/x/icccm/] |
13008 Inter-Client Communication Conventions Manual [http://tronche.com/gui/x/icccm/] |
13041 |
13009 |
13042 |
13010 |
13043 " |
13011 " |
13044 ! ! |
13012 ! ! |
13045 |
13013 |
13046 !XWorkstation class methodsFor:'documentation'! |
13014 !XWorkstation class methodsFor:'documentation'! |
13047 |
13015 |
13048 version |
13016 version |
13049 ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.575 2013-11-25 10:51:46 cg Exp $' |
13017 ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.576 2013-11-25 11:00:04 stefan Exp $' |
13050 ! |
13018 ! |
13051 |
13019 |
13052 version_CVS |
13020 version_CVS |
13053 ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.575 2013-11-25 10:51:46 cg Exp $' |
13021 ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.576 2013-11-25 11:00:04 stefan Exp $' |
13054 ! |
13022 ! |
13055 |
13023 |
13056 version_SVN |
13024 version_SVN |
13057 ^ '$ Id $' |
13025 ^ '$ Id $' |
13058 ! ! |
13026 ! ! |