7 #include <X11/keysym.h>
8 #include <X11/cursorfont.h>
10 /********** data ************/
13 #define CHECK_BUTTON_ON_WIDTH 16
14 #define CHECK_BUTTON_ON_HEIGHT 16
16 static char *CHECK_BUTTON_ON
[] = {
34 #define CHECK_BUTTON_OFF_WIDTH 16
35 #define CHECK_BUTTON_OFF_HEIGHT 16
37 static char *CHECK_BUTTON_OFF
[] = {
55 #define RADIO_BUTTON_ON_WIDTH 15
56 #define RADIO_BUTTON_ON_HEIGHT 15
57 static char *RADIO_BUTTON_ON
[] = {
75 #define RADIO_BUTTON_OFF_WIDTH 15
76 #define RADIO_BUTTON_OFF_HEIGHT 15
77 static char *RADIO_BUTTON_OFF
[] = {
96 static char *BUTTON_ARROW
[] = {
100 "..#..%#####... ...",
101 ".#............ ...",
102 "#............. ...",
103 ".#............ ...",
105 "...#. ............",
109 #define BUTTON_ARROW_WIDTH 18
110 #define BUTTON_ARROW_HEIGHT 10
113 static char *BUTTON_ARROW2
[] = {
126 #define BUTTON_ARROW2_WIDTH 18
127 #define BUTTON_ARROW2_HEIGHT 10
130 static char *SCROLLER_DIMPLE
[] = {
139 #define SCROLLER_DIMPLE_WIDTH 6
140 #define SCROLLER_DIMPLE_HEIGHT 6
143 static char *SCROLLER_ARROW_UP
[] = {
155 static char *HI_SCROLLER_ARROW_UP
[] = {
167 #define SCROLLER_ARROW_UP_WIDTH 9
168 #define SCROLLER_ARROW_UP_HEIGHT 9
171 static char *SCROLLER_ARROW_DOWN
[] = {
183 static char *HI_SCROLLER_ARROW_DOWN
[] = {
195 #define SCROLLER_ARROW_DOWN_WIDTH 9
196 #define SCROLLER_ARROW_DOWN_HEIGHT 9
200 static char *SCROLLER_ARROW_LEFT
[] = {
212 static char *HI_SCROLLER_ARROW_LEFT
[] = {
224 #define SCROLLER_ARROW_LEFT_WIDTH 9
225 #define SCROLLER_ARROW_LEFT_HEIGHT 9
228 static char *SCROLLER_ARROW_RIGHT
[] = {
240 static char *HI_SCROLLER_ARROW_RIGHT
[] = {
252 #define SCROLLER_ARROW_RIGHT_WIDTH 9
253 #define SCROLLER_ARROW_RIGHT_HEIGHT 9
256 static char *POPUP_INDICATOR
[] = {
267 #define POPUP_INDICATOR_WIDTH 11
268 #define POPUP_INDICATOR_HEIGHT 8
272 static char *PULLDOWN_INDICATOR
[] = {
281 #define PULLDOWN_INDICATOR_WIDTH 9
282 #define PULLDOWN_INDICATOR_HEIGHT 7
285 #define CHECK_MARK_WIDTH 8
286 #define CHECK_MARK_HEIGHT 10
288 static char *CHECK_MARK
[] = {
301 #define STIPPLE_WIDTH 8
302 #define STIPPLE_HEIGHT 8
303 static unsigned char STIPPLE_BITS
[] = {
304 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
310 extern void W_ReadConfigurations(void);
313 static int userWidgetCount
=0;
316 /***** end data ******/
320 renderPixmap(W_Screen
*screen
, Pixmap d
, Pixmap mask
, char **data
,
321 int width
, int height
)
324 GC whiteGC
= WMColorGC(screen
->white
);
325 GC blackGC
= WMColorGC(screen
->black
);
326 GC lightGC
= WMColorGC(screen
->gray
);
327 GC darkGC
= WMColorGC(screen
->darkGray
);
331 XSetForeground(screen
->display
, screen
->monoGC
, 0);
333 for (y
= 0; y
< height
; y
++) {
334 for (x
= 0; x
< width
; x
++) {
335 switch (data
[y
][x
]) {
338 XDrawPoint(screen
->display
, d
, whiteGC
, x
, y
);
343 XDrawPoint(screen
->display
, mask
, screen
->monoGC
, x
, y
);
347 XDrawPoint(screen
->display
, d
, lightGC
, x
, y
);
352 XDrawPoint(screen
->display
, d
, darkGC
, x
, y
);
358 XDrawPoint(screen
->display
, d
, blackGC
, x
, y
);
368 makePixmap(W_Screen
*sPtr
, char **data
, int width
, int height
, int masked
)
370 Pixmap pixmap
, mask
= None
;
372 pixmap
= XCreatePixmap(sPtr
->display
, W_DRAWABLE(sPtr
), width
, height
,
376 mask
= XCreatePixmap(sPtr
->display
, W_DRAWABLE(sPtr
), width
, height
, 1);
377 XSetForeground(sPtr
->display
, sPtr
->monoGC
, 1);
378 XFillRectangle(sPtr
->display
, mask
, sPtr
->monoGC
, 0, 0, width
, height
);
381 renderPixmap(sPtr
, pixmap
, mask
, data
, width
, height
);
383 return WMCreatePixmapFromXPixmaps(sPtr
, pixmap
, mask
, width
, height
,
388 #define T_WINGS_IMAGES_FILE RESOURCE_PATH"/Images.tiff"
389 #define T_DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.tiff"
391 #define X_WINGS_IMAGES_FILE RESOURCE_PATH"/Images.xpm"
392 #define X_DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.xpm"
396 loadPixmaps(WMScreen
*scr
)
410 image
= RLoadImage(scr
->rcontext
, T_WINGS_IMAGES_FILE
, 0);
412 image
= RLoadImage(scr
->rcontext
, X_WINGS_IMAGES_FILE
, 0);
414 wwarning("WINGs: could not load widget images file: %s",
415 RMessageForError(RErrorCode
));
419 /* make it have a gray background */
420 tmp
= RGetSubImage(image
, 0, 0, 24, 24);
421 RCombineImageWithColor(tmp
, &gray
);
422 scr
->homeIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
424 /* make it have a white background */
425 tmp
= RGetSubImage(image
, 0, 0, 24, 24);
426 RCombineImageWithColor(tmp
, &white
);
427 scr
->altHomeIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
431 tmp
= RGetSubImage(image
, 104, 0, 24, 24);
432 RCombineImageWithColor(tmp
, &white
);
433 scr
->trashcanIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
435 tmp
= RGetSubImage(image
, 104, 0, 24, 24);
436 RCombineImageWithColor(tmp
, &white
);
437 scr
->altTrashcanIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
440 tmp
= RGetSubImage(image
, 104, 24, 24, 24);
441 RCombineImageWithColor(tmp
, &white
);
442 scr
->createDirIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
444 tmp
= RGetSubImage(image
, 104, 24, 24, 24);
445 RCombineImageWithColor(tmp
, &white
);
446 scr
->altCreateDirIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
449 tmp
= RGetSubImage(image
, 24, 80, 24, 24);
450 RCombineImageWithColor(tmp
, &white
);
451 scr
->disketteIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
453 tmp
= RGetSubImage(image
, 24, 80, 24, 24);
454 RCombineImageWithColor(tmp
, &white
);
455 scr
->altDisketteIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
458 tmp
= RGetSubImage(image
, 0, 80, 24, 24);
459 RCombineImageWithColor(tmp
, &white
);
460 scr
->unmountIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
462 tmp
= RGetSubImage(image
, 0, 80, 24, 24);
463 RCombineImageWithColor(tmp
, &white
);
464 scr
->altUnmountIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
467 /* Magnifying Glass Icon for ColorPanel */
468 tmp
= RGetSubImage(image
, 24, 0, 40, 32);
469 RCombineImageWithColor(tmp
, &gray
);
470 scr
->magnifyIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
472 /* ColorWheel Icon for ColorPanel */
473 tmp
= RGetSubImage(image
, 0, 25, 24, 24);
474 scr
->wheelIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
476 /* GrayScale Icon for ColorPanel */
477 tmp
= RGetSubImage(image
, 65, 0, 40, 24);
478 scr
->grayIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
480 /* RGB Icon for ColorPanel */
481 tmp
= RGetSubImage(image
, 25, 33, 40, 24);
482 scr
->rgbIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
484 /* CMYK Icon for ColorPanel */
485 tmp
= RGetSubImage(image
, 65, 25, 40, 24);
486 scr
->cmykIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
488 /* HSB Icon for ColorPanel */
489 tmp
= RGetSubImage(image
, 0, 57, 40, 24);
490 scr
->hsbIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
492 /* CustomColorPalette Icon for ColorPanel */
493 tmp
= RGetSubImage(image
, 81, 57, 40, 24);
494 scr
->customPaletteIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
496 /* ColorList Icon for ColorPanel */
497 tmp
= RGetSubImage(image
, 41, 57, 40, 24);
498 scr
->colorListIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
501 RReleaseImage(image
);
504 scr
->defaultObjectIcon
=
505 WMCreatePixmapFromFile(scr
, T_DEFAULT_OBJECT_ICON_FILE
);
506 if (!scr
->defaultObjectIcon
) {
507 scr
->defaultObjectIcon
=
508 WMCreatePixmapFromFile(scr
, X_DEFAULT_OBJECT_ICON_FILE
);
510 if (!scr
->defaultObjectIcon
) {
511 wwarning("WINGs: could not load default icon file");
520 WMOpenScreen(const char *display
)
522 Display
*dpy
= XOpenDisplay(display
);
525 wwarning("WINGs: could not open display %s",
526 XDisplayName(display
));
530 return WMCreateSimpleApplicationScreen(dpy
);
535 WMCreateSimpleApplicationScreen(Display
*display
)
539 scr
= WMCreateScreen(display
, DefaultScreen(display
));
541 scr
->aflags
.hasAppIcon
= 0;
542 scr
->aflags
.simpleApplication
= 1;
550 WMCreateScreen(Display
*display
, int screen
)
552 return WMCreateScreenWithRContext(display
, screen
,
553 RCreateContext(display
, screen
, NULL
));
558 WMCreateScreenWithRContext(Display
*display
, int screen
, RContext
*context
)
563 static int initialized
= 0;
564 static char *atomNames
[] = {
583 "_WINGS_DND_MOUSE_OFFSET",
586 Atom atoms
[sizeof(atomNames
)/sizeof(char*)];
593 W_ReadConfigurations();
595 assert(W_ApplicationInitialized());
598 scrPtr
= malloc(sizeof(W_Screen
));
601 memset(scrPtr
, 0, sizeof(W_Screen
));
603 scrPtr
->aflags
.hasAppIcon
= 1;
605 scrPtr
->display
= display
;
606 scrPtr
->screen
= screen
;
607 scrPtr
->rcontext
= context
;
609 scrPtr
->depth
= context
->depth
;
611 scrPtr
->visual
= context
->visual
;
612 scrPtr
->lastEventTime
= 0;
614 scrPtr
->colormap
= context
->cmap
;
616 scrPtr
->rootWin
= RootWindow(display
, screen
);
618 scrPtr
->fontCache
= WMCreateHashTable(WMStringPointerHashCallbacks
);
620 /* Create missing CUT_BUFFERs */
623 int exists
[8] = {0, 0, 0, 0, 0, 0, 0, 0};
626 rootWinProps
= XListProperties(display
, scrPtr
->rootWin
, &count
);
627 for (i
=0; i
<count
; i
++) {
628 switch(rootWinProps
[i
]) {
630 exists
[0] = 1; break;
632 exists
[1] = 1; break;
634 exists
[2] = 1; break;
636 exists
[3] = 1; break;
638 exists
[4] = 1; break;
640 exists
[5] = 1; break;
642 exists
[6] = 1; break;
644 exists
[7] = 1; break;
652 for (i
=0; i
<8; i
++) {
654 XStoreBuffer(display
, "", 0, i
);
659 scrPtr
->ignoredModifierMask
= 0;
662 XModifierKeymap
*modmap
;
663 KeyCode nlock
, slock
;
664 static int mask_table
[8] = {
665 ShiftMask
,LockMask
,ControlMask
,Mod1Mask
,
666 Mod2Mask
, Mod3Mask
, Mod4Mask
, Mod5Mask
668 unsigned int numLockMask
, scrollLockMask
;
670 nlock
= XKeysymToKeycode(display
, XK_Num_Lock
);
671 slock
= XKeysymToKeycode(display
, XK_Scroll_Lock
);
674 * Find out the masks for the NumLock and ScrollLock modifiers,
675 * so that we can bind the grabs for when they are enabled too.
677 modmap
= XGetModifierMapping(display
);
679 if (modmap
!=NULL
&& modmap
->max_keypermod
>0) {
680 for (i
=0; i
<8*modmap
->max_keypermod
; i
++) {
681 if (modmap
->modifiermap
[i
]==nlock
&& nlock
!=0)
682 numLockMask
= mask_table
[i
/modmap
->max_keypermod
];
683 else if (modmap
->modifiermap
[i
]==slock
&& slock
!=0)
684 scrollLockMask
= mask_table
[i
/modmap
->max_keypermod
];
689 XFreeModifiermap(modmap
);
692 scrPtr
->ignoredModifierMask
= numLockMask
|scrollLockMask
|LockMask
;
695 /* initially allocate some colors */
696 WMWhiteColor(scrPtr
);
697 WMBlackColor(scrPtr
);
699 WMDarkGrayColor(scrPtr
);
701 gcv
.graphics_exposures
= False
;
703 gcv
.function
= GXxor
;
704 gcv
.foreground
= W_PIXEL(scrPtr
->white
);
705 if (gcv
.foreground
== 0) gcv
.foreground
= 1;
706 scrPtr
->xorGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
707 |GCGraphicsExposures
|GCForeground
, &gcv
);
709 gcv
.function
= GXxor
;
710 gcv
.foreground
= W_PIXEL(scrPtr
->gray
);
711 gcv
.subwindow_mode
= IncludeInferiors
;
712 scrPtr
->ixorGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
713 |GCGraphicsExposures
|GCForeground
714 |GCSubwindowMode
, &gcv
);
716 gcv
.function
= GXcopy
;
717 scrPtr
->copyGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
718 |GCGraphicsExposures
, &gcv
);
720 scrPtr
->clipGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
721 |GCGraphicsExposures
, &gcv
);
724 stipple
= XCreateBitmapFromData(display
, W_DRAWABLE(scrPtr
),
725 STIPPLE_BITS
, STIPPLE_WIDTH
, STIPPLE_HEIGHT
);
726 gcv
.foreground
= W_PIXEL(scrPtr
->darkGray
);
727 gcv
.background
= W_PIXEL(scrPtr
->gray
);
728 gcv
.fill_style
= FillStippled
;
729 gcv
.stipple
= stipple
;
730 scrPtr
->stippleGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
),
731 GCForeground
|GCBackground
|GCStipple
732 |GCFillStyle
|GCGraphicsExposures
, &gcv
);
734 gcv
.foreground
= W_PIXEL(scrPtr
->black
);
735 gcv
.background
= W_PIXEL(scrPtr
->white
);
736 scrPtr
->textFieldGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
),
737 GCForeground
|GCBackground
, &gcv
);
739 /* we need a 1bpp drawable for the monoGC, so borrow this one */
740 scrPtr
->monoGC
= XCreateGC(display
, stipple
, 0, NULL
);
742 scrPtr
->stipple
= stipple
;
744 scrPtr
->useMultiByte
= WINGsConfiguration
.useMultiByte
;
746 scrPtr
->normalFont
= WMSystemFontOfSize(scrPtr
,
747 WINGsConfiguration
.defaultFontSize
);
749 scrPtr
->boldFont
= WMBoldSystemFontOfSize(scrPtr
,
750 WINGsConfiguration
.defaultFontSize
);
752 if (!scrPtr
->boldFont
)
753 scrPtr
->boldFont
= scrPtr
->normalFont
;
755 if (!scrPtr
->normalFont
) {
756 wwarning("could not load any fonts. Make sure your font installation"
757 "and locale settings are correct.");
762 scrPtr
->checkButtonImageOn
= makePixmap(scrPtr
, CHECK_BUTTON_ON
,
763 CHECK_BUTTON_ON_WIDTH
,
764 CHECK_BUTTON_ON_HEIGHT
, False
);
766 scrPtr
->checkButtonImageOff
= makePixmap(scrPtr
, CHECK_BUTTON_OFF
,
767 CHECK_BUTTON_OFF_WIDTH
,
768 CHECK_BUTTON_OFF_HEIGHT
, False
);
770 scrPtr
->radioButtonImageOn
= makePixmap(scrPtr
, RADIO_BUTTON_ON
,
771 RADIO_BUTTON_ON_WIDTH
,
772 RADIO_BUTTON_ON_HEIGHT
, False
);
774 scrPtr
->radioButtonImageOff
= makePixmap(scrPtr
, RADIO_BUTTON_OFF
,
775 RADIO_BUTTON_OFF_WIDTH
,
776 RADIO_BUTTON_OFF_HEIGHT
, False
);
778 scrPtr
->buttonArrow
= makePixmap(scrPtr
, BUTTON_ARROW
,
779 BUTTON_ARROW_WIDTH
, BUTTON_ARROW_HEIGHT
,
782 scrPtr
->pushedButtonArrow
= makePixmap(scrPtr
, BUTTON_ARROW2
,
783 BUTTON_ARROW2_WIDTH
, BUTTON_ARROW2_HEIGHT
,
787 scrPtr
->scrollerDimple
= makePixmap(scrPtr
, SCROLLER_DIMPLE
,
788 SCROLLER_DIMPLE_WIDTH
,
789 SCROLLER_DIMPLE_HEIGHT
, False
);
792 scrPtr
->upArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_UP
,
793 SCROLLER_ARROW_UP_WIDTH
,
794 SCROLLER_ARROW_UP_HEIGHT
, True
);
796 scrPtr
->downArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_DOWN
,
797 SCROLLER_ARROW_DOWN_WIDTH
,
798 SCROLLER_ARROW_DOWN_HEIGHT
, True
);
800 scrPtr
->leftArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_LEFT
,
801 SCROLLER_ARROW_LEFT_WIDTH
,
802 SCROLLER_ARROW_LEFT_HEIGHT
, True
);
804 scrPtr
->rightArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_RIGHT
,
805 SCROLLER_ARROW_RIGHT_WIDTH
,
806 SCROLLER_ARROW_RIGHT_HEIGHT
, True
);
808 scrPtr
->hiUpArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_UP
,
809 SCROLLER_ARROW_UP_WIDTH
,
810 SCROLLER_ARROW_UP_HEIGHT
, True
);
812 scrPtr
->hiDownArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_DOWN
,
813 SCROLLER_ARROW_DOWN_WIDTH
,
814 SCROLLER_ARROW_DOWN_HEIGHT
, True
);
816 scrPtr
->hiLeftArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_LEFT
,
817 SCROLLER_ARROW_LEFT_WIDTH
,
818 SCROLLER_ARROW_LEFT_HEIGHT
, True
);
820 scrPtr
->hiRightArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_RIGHT
,
821 SCROLLER_ARROW_RIGHT_WIDTH
,
822 SCROLLER_ARROW_RIGHT_HEIGHT
, True
);
824 scrPtr
->popUpIndicator
= makePixmap(scrPtr
, POPUP_INDICATOR
,
825 POPUP_INDICATOR_WIDTH
,
826 POPUP_INDICATOR_HEIGHT
, True
);
828 scrPtr
->pullDownIndicator
= makePixmap(scrPtr
, PULLDOWN_INDICATOR
,
829 PULLDOWN_INDICATOR_WIDTH
,
830 PULLDOWN_INDICATOR_HEIGHT
, True
);
832 scrPtr
->checkMark
= makePixmap(scrPtr
, CHECK_MARK
,
834 CHECK_MARK_HEIGHT
, True
);
838 scrPtr
->defaultCursor
= XCreateFontCursor(display
, XC_left_ptr
);
840 scrPtr
->textCursor
= XCreateFontCursor(display
, XC_xterm
);
846 blank
= XCreatePixmap(display
, scrPtr
->stipple
, 1, 1, 1);
847 XSetForeground(display
, scrPtr
->monoGC
, 0);
848 XFillRectangle(display
, blank
, scrPtr
->monoGC
, 0, 0, 1, 1);
850 scrPtr
->invisibleCursor
= XCreatePixmapCursor(display
, blank
, blank
,
852 XFreePixmap(display
, blank
);
855 #ifdef HAVE_XINTERNATOMS
856 XInternAtoms(display
, atomNames
, sizeof(atomNames
)/sizeof(char*), False
,
859 for (i
= 0; i
< sizeof(atomNames
)/sizeof(char*); i
++) {
860 atoms
[i
] = XInternAtom(display
, atomNames
[i
], False
);
865 scrPtr
->attribsAtom
= atoms
[i
++];
867 scrPtr
->deleteWindowAtom
= atoms
[i
++];
869 scrPtr
->protocolsAtom
= atoms
[i
++];
871 scrPtr
->clipboardAtom
= atoms
[i
++];
873 scrPtr
->xdndAwareAtom
= atoms
[i
++];
874 scrPtr
->xdndSelectionAtom
= atoms
[i
++];
875 scrPtr
->xdndEnterAtom
= atoms
[i
++];
876 scrPtr
->xdndLeaveAtom
= atoms
[i
++];
877 scrPtr
->xdndPositionAtom
= atoms
[i
++];
878 scrPtr
->xdndDropAtom
= atoms
[i
++];
879 scrPtr
->xdndFinishedAtom
= atoms
[i
++];
880 scrPtr
->xdndTypeListAtom
= atoms
[i
++];
881 scrPtr
->xdndStatusAtom
= atoms
[i
++];
883 scrPtr
->xdndActionCopy
= atoms
[i
++];
884 scrPtr
->xdndActionMove
= atoms
[i
++];
885 scrPtr
->xdndActionLink
= atoms
[i
++];
886 scrPtr
->xdndActionAsk
= atoms
[i
++];
887 scrPtr
->xdndActionPrivate
= atoms
[i
++];
889 scrPtr
->wmIconDragOffsetAtom
= atoms
[i
++];
891 scrPtr
->wmStateAtom
= atoms
[i
++];
893 scrPtr
->rootView
= W_CreateRootView(scrPtr
);
895 scrPtr
->balloon
= W_CreateBalloon(scrPtr
);
898 W_InitApplication(scrPtr
);
906 WMSetWidgetDefaultFont(WMScreen
*scr
, WMFont
*font
)
908 WMReleaseFont(scr
->normalFont
);
909 scr
->normalFont
= WMRetainFont(font
);
914 WMSetWidgetDefaultBoldFont(WMScreen
*scr
, WMFont
*font
)
916 WMReleaseFont(scr
->boldFont
);
917 scr
->boldFont
= WMRetainFont(font
);
923 WMHangData(WMWidget
*widget
, void *data
)
925 W_VIEW(widget
)->hangedData
= data
;
930 WMGetHangedData(WMWidget
*widget
)
932 return W_VIEW(widget
)->hangedData
;
938 WMDestroyWidget(WMWidget
*widget
)
940 W_UnmapView(W_VIEW(widget
));
941 W_DestroyView(W_VIEW(widget
));
946 WMSetFocusToWidget(WMWidget
*widget
)
948 W_SetFocusOfTopLevel(W_TopLevelOfView(W_VIEW(widget
)), W_VIEW(widget
));
954 * Realizes the widget and all it's children.
958 WMRealizeWidget(WMWidget
*w
)
960 W_RealizeView(W_VIEW(w
));
964 WMMapWidget(WMWidget
*w
)
966 W_MapView(W_VIEW(w
));
971 WMReparentWidget(WMWidget
*w
, WMWidget
*newParent
, int x
, int y
)
973 W_ReparentView(W_VIEW(w
), W_VIEW(newParent
), x
, y
);
978 makeChildrenAutomap(W_View
*view
, int flag
)
980 view
= view
->childrenList
;
983 view
->flags
.mapWhenRealized
= flag
;
984 makeChildrenAutomap(view
, flag
);
986 view
= view
->nextSister
;
992 WMMapSubwidgets(WMWidget
*w
)
994 /* make sure that subwidgets created after the parent was realized
996 if (!W_VIEW(w
)->flags
.realized
) {
997 makeChildrenAutomap(W_VIEW(w
), True
);
999 W_MapSubviews(W_VIEW(w
));
1005 WMUnmapSubwidgets(WMWidget
*w
)
1007 if (!W_VIEW(w
)->flags
.realized
) {
1008 makeChildrenAutomap(W_VIEW(w
), False
);
1010 W_UnmapSubviews(W_VIEW(w
));
1017 WMUnmapWidget(WMWidget
*w
)
1019 W_UnmapView(W_VIEW(w
));
1024 WMWidgetIsMapped(WMWidget
*w
)
1026 return W_VIEW(w
)->flags
.mapped
;
1031 WMSetWidgetBackgroundColor(WMWidget
*w
, WMColor
*color
)
1033 W_SetViewBackgroundColor(W_VIEW(w
), color
);
1034 if (W_VIEW(w
)->flags
.mapped
)
1035 WMRedisplayWidget(w
);
1040 WMRaiseWidget(WMWidget
*w
)
1042 W_RaiseView(W_VIEW(w
));
1047 WMLowerWidget(WMWidget
*w
)
1049 W_LowerView(W_VIEW(w
));
1054 WMMoveWidget(WMWidget
*w
, int x
, int y
)
1056 W_MoveView(W_VIEW(w
), x
, y
);
1061 WMResizeWidget(WMWidget
*w
, unsigned int width
, unsigned int height
)
1063 W_ResizeView(W_VIEW(w
), width
, height
);
1069 W_RegisterUserWidget(void)
1073 return userWidgetCount
+ WC_UserWidget
- 1;
1079 WMScreenRContext(WMScreen
*scr
)
1081 return scr
->rcontext
;
1087 WMWidgetWidth(WMWidget
*w
)
1089 return W_VIEW(w
)->size
.width
;
1094 WMWidgetHeight(WMWidget
*w
)
1096 return W_VIEW(w
)->size
.height
;
1101 WMWidgetXID(WMWidget
*w
)
1103 return W_VIEW(w
)->window
;
1108 WMWidgetScreen(WMWidget
*w
)
1110 return W_VIEW(w
)->screen
;
1116 WMScreenMainLoop(WMScreen
*scr
)
1121 WMNextEvent(scr
->display
, &event
);
1122 WMHandleEvent(&event
);
1128 WMBreakModalLoop(WMScreen
*scr
)
1135 WMRunModalLoop(WMScreen
*scr
, WMView
*view
)
1137 /* why is scr passed if is determined from the view? */
1138 /*WMScreen *scr = view->screen;*/
1139 int oldModalLoop
= scr
->modalLoop
;
1140 WMView
*oldModalView
= scr
->modalView
;
1142 scr
->modalView
= view
;
1145 while (scr
->modalLoop
) {
1148 WMNextEvent(scr
->display
, &event
);
1149 WMHandleEvent(&event
);
1152 scr
->modalView
= oldModalView
;
1153 scr
->modalLoop
= oldModalLoop
;
1158 WMScreenDisplay(WMScreen
*scr
)
1160 return scr
->display
;
1165 WMScreenDepth(WMScreen
*scr
)
1172 WMScreenWidth(WMScreen
*scr
)
1174 return scr
->rootView
->size
.width
;
1179 WMScreenHeight(WMScreen
*scr
)
1181 return scr
->rootView
->size
.height
;
1186 WMRedisplayWidget(WMWidget
*w
)
1188 W_RedisplayView(W_VIEW(w
));