8 #include <X11/keysym.h>
9 #include <X11/cursorfont.h>
11 /********** data ************/
14 #define CHECK_BUTTON_ON_WIDTH 16
15 #define CHECK_BUTTON_ON_HEIGHT 16
17 static char *CHECK_BUTTON_ON
[] = {
35 #define CHECK_BUTTON_OFF_WIDTH 16
36 #define CHECK_BUTTON_OFF_HEIGHT 16
38 static char *CHECK_BUTTON_OFF
[] = {
56 #define RADIO_BUTTON_ON_WIDTH 15
57 #define RADIO_BUTTON_ON_HEIGHT 15
58 static char *RADIO_BUTTON_ON
[] = {
76 #define RADIO_BUTTON_OFF_WIDTH 15
77 #define RADIO_BUTTON_OFF_HEIGHT 15
78 static char *RADIO_BUTTON_OFF
[] = {
97 static char *BUTTON_ARROW
[] = {
100 "...#.%....#... ...",
101 "..#..%#####... ...",
102 ".#............ ...",
103 "#............. ...",
104 ".#............ ...",
106 "...#. ............",
110 #define BUTTON_ARROW_WIDTH 18
111 #define BUTTON_ARROW_HEIGHT 10
114 static char *BUTTON_ARROW2
[] = {
127 #define BUTTON_ARROW2_WIDTH 18
128 #define BUTTON_ARROW2_HEIGHT 10
131 static char *SCROLLER_DIMPLE
[] = {
140 #define SCROLLER_DIMPLE_WIDTH 6
141 #define SCROLLER_DIMPLE_HEIGHT 6
144 static char *SCROLLER_ARROW_UP
[] = {
156 static char *HI_SCROLLER_ARROW_UP
[] = {
168 #define SCROLLER_ARROW_UP_WIDTH 9
169 #define SCROLLER_ARROW_UP_HEIGHT 9
172 static char *SCROLLER_ARROW_DOWN
[] = {
184 static char *HI_SCROLLER_ARROW_DOWN
[] = {
196 #define SCROLLER_ARROW_DOWN_WIDTH 9
197 #define SCROLLER_ARROW_DOWN_HEIGHT 9
201 static char *SCROLLER_ARROW_LEFT
[] = {
213 static char *HI_SCROLLER_ARROW_LEFT
[] = {
225 #define SCROLLER_ARROW_LEFT_WIDTH 9
226 #define SCROLLER_ARROW_LEFT_HEIGHT 9
229 static char *SCROLLER_ARROW_RIGHT
[] = {
241 static char *HI_SCROLLER_ARROW_RIGHT
[] = {
253 #define SCROLLER_ARROW_RIGHT_WIDTH 9
254 #define SCROLLER_ARROW_RIGHT_HEIGHT 9
257 static char *POPUP_INDICATOR
[] = {
268 #define POPUP_INDICATOR_WIDTH 11
269 #define POPUP_INDICATOR_HEIGHT 8
273 static char *PULLDOWN_INDICATOR
[] = {
282 #define PULLDOWN_INDICATOR_WIDTH 9
283 #define PULLDOWN_INDICATOR_HEIGHT 7
286 #define CHECK_MARK_WIDTH 8
287 #define CHECK_MARK_HEIGHT 10
289 static char *CHECK_MARK
[] = {
302 #define STIPPLE_WIDTH 8
303 #define STIPPLE_HEIGHT 8
304 static unsigned char STIPPLE_BITS
[] = {
305 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
311 extern void W_ReadConfigurations(void);
314 static int userWidgetCount
=0;
317 /***** end data ******/
321 renderPixmap(W_Screen
*screen
, Pixmap d
, Pixmap mask
, char **data
,
322 int width
, int height
)
325 GC whiteGC
= WMColorGC(screen
->white
);
326 GC blackGC
= WMColorGC(screen
->black
);
327 GC lightGC
= WMColorGC(screen
->gray
);
328 GC darkGC
= WMColorGC(screen
->darkGray
);
332 XSetForeground(screen
->display
, screen
->monoGC
, 0);
334 for (y
= 0; y
< height
; y
++) {
335 for (x
= 0; x
< width
; x
++) {
336 switch (data
[y
][x
]) {
339 XDrawPoint(screen
->display
, d
, whiteGC
, x
, y
);
344 XDrawPoint(screen
->display
, mask
, screen
->monoGC
, x
, y
);
348 XDrawPoint(screen
->display
, d
, lightGC
, x
, y
);
353 XDrawPoint(screen
->display
, d
, darkGC
, x
, y
);
359 XDrawPoint(screen
->display
, d
, blackGC
, x
, y
);
369 makePixmap(W_Screen
*sPtr
, char **data
, int width
, int height
, int masked
)
371 Pixmap pixmap
, mask
= None
;
373 pixmap
= XCreatePixmap(sPtr
->display
, W_DRAWABLE(sPtr
), width
, height
,
377 mask
= XCreatePixmap(sPtr
->display
, W_DRAWABLE(sPtr
), width
, height
, 1);
378 XSetForeground(sPtr
->display
, sPtr
->monoGC
, 1);
379 XFillRectangle(sPtr
->display
, mask
, sPtr
->monoGC
, 0, 0, width
, height
);
382 renderPixmap(sPtr
, pixmap
, mask
, data
, width
, height
);
384 return WMCreatePixmapFromXPixmaps(sPtr
, pixmap
, mask
, width
, height
,
389 #define T_WINGS_IMAGES_FILE RESOURCE_PATH"/Images.tiff"
390 #define T_DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.tiff"
392 #define X_WINGS_IMAGES_FILE RESOURCE_PATH"/Images.xpm"
393 #define X_DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.xpm"
397 loadPixmaps(WMScreen
*scr
)
411 image
= RLoadImage(scr
->rcontext
, T_WINGS_IMAGES_FILE
, 0);
413 image
= RLoadImage(scr
->rcontext
, X_WINGS_IMAGES_FILE
, 0);
415 wwarning(_("WINGs: could not load widget images file: %s"),
416 RMessageForError(RErrorCode
));
420 /* make it have a gray background */
421 tmp
= RGetSubImage(image
, 0, 0, 24, 24);
422 RCombineImageWithColor(tmp
, &gray
);
423 scr
->homeIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
425 /* make it have a white background */
426 tmp
= RGetSubImage(image
, 0, 0, 24, 24);
427 RCombineImageWithColor(tmp
, &white
);
428 scr
->altHomeIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
432 tmp
= RGetSubImage(image
, 104, 0, 24, 24);
433 RCombineImageWithColor(tmp
, &white
);
434 scr
->trashcanIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
436 tmp
= RGetSubImage(image
, 104, 0, 24, 24);
437 RCombineImageWithColor(tmp
, &white
);
438 scr
->altTrashcanIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
441 tmp
= RGetSubImage(image
, 104, 24, 24, 24);
442 RCombineImageWithColor(tmp
, &white
);
443 scr
->createDirIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
445 tmp
= RGetSubImage(image
, 104, 24, 24, 24);
446 RCombineImageWithColor(tmp
, &white
);
447 scr
->altCreateDirIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
450 tmp
= RGetSubImage(image
, 24, 80, 24, 24);
451 RCombineImageWithColor(tmp
, &white
);
452 scr
->disketteIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
454 tmp
= RGetSubImage(image
, 24, 80, 24, 24);
455 RCombineImageWithColor(tmp
, &white
);
456 scr
->altDisketteIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
459 tmp
= RGetSubImage(image
, 0, 80, 24, 24);
460 RCombineImageWithColor(tmp
, &white
);
461 scr
->unmountIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
463 tmp
= RGetSubImage(image
, 0, 80, 24, 24);
464 RCombineImageWithColor(tmp
, &white
);
465 scr
->altUnmountIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
468 /* Magnifying Glass Icon for ColorPanel */
469 tmp
= RGetSubImage(image
, 24, 0, 40, 32);
470 RCombineImageWithColor(tmp
, &gray
);
471 scr
->magnifyIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
473 /* ColorWheel Icon for ColorPanel */
474 tmp
= RGetSubImage(image
, 0, 25, 24, 24);
475 scr
->wheelIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
477 /* GrayScale Icon for ColorPanel */
478 tmp
= RGetSubImage(image
, 65, 0, 40, 24);
479 scr
->grayIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
481 /* RGB Icon for ColorPanel */
482 tmp
= RGetSubImage(image
, 25, 33, 40, 24);
483 scr
->rgbIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
485 /* CMYK Icon for ColorPanel */
486 tmp
= RGetSubImage(image
, 65, 25, 40, 24);
487 scr
->cmykIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
489 /* HSB Icon for ColorPanel */
490 tmp
= RGetSubImage(image
, 0, 57, 40, 24);
491 scr
->hsbIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
493 /* CustomColorPalette Icon for ColorPanel */
494 tmp
= RGetSubImage(image
, 81, 57, 40, 24);
495 scr
->customPaletteIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
497 /* ColorList Icon for ColorPanel */
498 tmp
= RGetSubImage(image
, 41, 57, 40, 24);
499 scr
->colorListIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
502 RReleaseImage(image
);
505 scr
->defaultObjectIcon
=
506 WMCreatePixmapFromFile(scr
, T_DEFAULT_OBJECT_ICON_FILE
);
507 if (!scr
->defaultObjectIcon
) {
508 scr
->defaultObjectIcon
=
509 WMCreatePixmapFromFile(scr
, X_DEFAULT_OBJECT_ICON_FILE
);
511 if (!scr
->defaultObjectIcon
) {
512 wwarning("WINGs: could not load default icon file");
521 WMOpenScreen(const char *display
)
523 Display
*dpy
= XOpenDisplay(display
);
526 wwarning("WINGs: could not open display %s",
527 XDisplayName(display
));
531 return WMCreateSimpleApplicationScreen(dpy
);
536 WMCreateSimpleApplicationScreen(Display
*display
)
540 scr
= WMCreateScreen(display
, DefaultScreen(display
));
542 scr
->aflags
.hasAppIcon
= 0;
543 scr
->aflags
.simpleApplication
= 1;
551 WMCreateScreen(Display
*display
, int screen
)
553 return WMCreateScreenWithRContext(display
, screen
,
554 RCreateContext(display
, screen
, NULL
));
559 WMCreateScreenWithRContext(Display
*display
, int screen
, RContext
*context
)
564 static int initialized
= 0;
565 static char *atomNames
[] = {
584 "_WINGS_DND_MOUSE_OFFSET",
587 Atom atoms
[sizeof(atomNames
)/sizeof(char*)];
594 W_ReadConfigurations();
596 assert(W_ApplicationInitialized());
599 scrPtr
= malloc(sizeof(W_Screen
));
602 memset(scrPtr
, 0, sizeof(W_Screen
));
604 scrPtr
->aflags
.hasAppIcon
= 1;
606 scrPtr
->display
= display
;
607 scrPtr
->screen
= screen
;
608 scrPtr
->rcontext
= context
;
610 scrPtr
->depth
= context
->depth
;
612 scrPtr
->visual
= context
->visual
;
613 scrPtr
->lastEventTime
= 0;
615 scrPtr
->colormap
= context
->cmap
;
617 scrPtr
->rootWin
= RootWindow(display
, screen
);
619 scrPtr
->fontCache
= WMCreateHashTable(WMStringPointerHashCallbacks
);
622 /* create input method stuff */
623 W_InitIMStuff(scrPtr
);
625 /* Create missing CUT_BUFFERs */
628 int exists
[8] = {0, 0, 0, 0, 0, 0, 0, 0};
631 rootWinProps
= XListProperties(display
, scrPtr
->rootWin
, &count
);
632 for (i
=0; i
<count
; i
++) {
633 switch(rootWinProps
[i
]) {
635 exists
[0] = 1; break;
637 exists
[1] = 1; break;
639 exists
[2] = 1; break;
641 exists
[3] = 1; break;
643 exists
[4] = 1; break;
645 exists
[5] = 1; break;
647 exists
[6] = 1; break;
649 exists
[7] = 1; break;
657 for (i
=0; i
<8; i
++) {
659 XStoreBuffer(display
, "", 0, i
);
664 scrPtr
->ignoredModifierMask
= 0;
667 XModifierKeymap
*modmap
;
668 KeyCode nlock
, slock
;
669 static int mask_table
[8] = {
670 ShiftMask
,LockMask
,ControlMask
,Mod1Mask
,
671 Mod2Mask
, Mod3Mask
, Mod4Mask
, Mod5Mask
673 unsigned int numLockMask
, scrollLockMask
;
675 nlock
= XKeysymToKeycode(display
, XK_Num_Lock
);
676 slock
= XKeysymToKeycode(display
, XK_Scroll_Lock
);
679 * Find out the masks for the NumLock and ScrollLock modifiers,
680 * so that we can bind the grabs for when they are enabled too.
682 modmap
= XGetModifierMapping(display
);
684 if (modmap
!=NULL
&& modmap
->max_keypermod
>0) {
685 for (i
=0; i
<8*modmap
->max_keypermod
; i
++) {
686 if (modmap
->modifiermap
[i
]==nlock
&& nlock
!=0)
687 numLockMask
= mask_table
[i
/modmap
->max_keypermod
];
688 else if (modmap
->modifiermap
[i
]==slock
&& slock
!=0)
689 scrollLockMask
= mask_table
[i
/modmap
->max_keypermod
];
694 XFreeModifiermap(modmap
);
697 scrPtr
->ignoredModifierMask
= numLockMask
|scrollLockMask
|LockMask
;
700 /* initially allocate some colors */
701 WMWhiteColor(scrPtr
);
702 WMBlackColor(scrPtr
);
704 WMDarkGrayColor(scrPtr
);
706 gcv
.graphics_exposures
= False
;
708 gcv
.function
= GXxor
;
709 gcv
.foreground
= W_PIXEL(scrPtr
->white
);
710 if (gcv
.foreground
== 0) gcv
.foreground
= 1;
711 scrPtr
->xorGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
712 |GCGraphicsExposures
|GCForeground
, &gcv
);
714 gcv
.function
= GXxor
;
715 gcv
.foreground
= W_PIXEL(scrPtr
->gray
);
716 gcv
.subwindow_mode
= IncludeInferiors
;
717 scrPtr
->ixorGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
718 |GCGraphicsExposures
|GCForeground
719 |GCSubwindowMode
, &gcv
);
721 gcv
.function
= GXcopy
;
722 scrPtr
->copyGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
723 |GCGraphicsExposures
, &gcv
);
725 scrPtr
->clipGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
726 |GCGraphicsExposures
, &gcv
);
729 stipple
= XCreateBitmapFromData(display
, W_DRAWABLE(scrPtr
),
730 STIPPLE_BITS
, STIPPLE_WIDTH
, STIPPLE_HEIGHT
);
731 gcv
.foreground
= W_PIXEL(scrPtr
->darkGray
);
732 gcv
.background
= W_PIXEL(scrPtr
->gray
);
733 gcv
.fill_style
= FillStippled
;
734 gcv
.stipple
= stipple
;
735 scrPtr
->stippleGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
),
736 GCForeground
|GCBackground
|GCStipple
737 |GCFillStyle
|GCGraphicsExposures
, &gcv
);
739 gcv
.foreground
= W_PIXEL(scrPtr
->black
);
740 gcv
.background
= W_PIXEL(scrPtr
->white
);
741 scrPtr
->textFieldGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
),
742 GCForeground
|GCBackground
, &gcv
);
744 /* we need a 1bpp drawable for the monoGC, so borrow this one */
745 scrPtr
->monoGC
= XCreateGC(display
, stipple
, 0, NULL
);
747 scrPtr
->stipple
= stipple
;
749 scrPtr
->useMultiByte
= WINGsConfiguration
.useMultiByte
;
751 scrPtr
->normalFont
= WMSystemFontOfSize(scrPtr
,
752 WINGsConfiguration
.defaultFontSize
);
754 scrPtr
->boldFont
= WMBoldSystemFontOfSize(scrPtr
,
755 WINGsConfiguration
.defaultFontSize
);
757 if (!scrPtr
->boldFont
)
758 scrPtr
->boldFont
= scrPtr
->normalFont
;
760 if (!scrPtr
->normalFont
) {
761 wwarning(_("could not load any fonts. Make sure your font installation"
762 "and locale settings are correct."));
767 scrPtr
->checkButtonImageOn
= makePixmap(scrPtr
, CHECK_BUTTON_ON
,
768 CHECK_BUTTON_ON_WIDTH
,
769 CHECK_BUTTON_ON_HEIGHT
, False
);
771 scrPtr
->checkButtonImageOff
= makePixmap(scrPtr
, CHECK_BUTTON_OFF
,
772 CHECK_BUTTON_OFF_WIDTH
,
773 CHECK_BUTTON_OFF_HEIGHT
, False
);
775 scrPtr
->radioButtonImageOn
= makePixmap(scrPtr
, RADIO_BUTTON_ON
,
776 RADIO_BUTTON_ON_WIDTH
,
777 RADIO_BUTTON_ON_HEIGHT
, False
);
779 scrPtr
->radioButtonImageOff
= makePixmap(scrPtr
, RADIO_BUTTON_OFF
,
780 RADIO_BUTTON_OFF_WIDTH
,
781 RADIO_BUTTON_OFF_HEIGHT
, False
);
783 scrPtr
->buttonArrow
= makePixmap(scrPtr
, BUTTON_ARROW
,
784 BUTTON_ARROW_WIDTH
, BUTTON_ARROW_HEIGHT
,
787 scrPtr
->pushedButtonArrow
= makePixmap(scrPtr
, BUTTON_ARROW2
,
788 BUTTON_ARROW2_WIDTH
, BUTTON_ARROW2_HEIGHT
,
792 scrPtr
->scrollerDimple
= makePixmap(scrPtr
, SCROLLER_DIMPLE
,
793 SCROLLER_DIMPLE_WIDTH
,
794 SCROLLER_DIMPLE_HEIGHT
, False
);
797 scrPtr
->upArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_UP
,
798 SCROLLER_ARROW_UP_WIDTH
,
799 SCROLLER_ARROW_UP_HEIGHT
, True
);
801 scrPtr
->downArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_DOWN
,
802 SCROLLER_ARROW_DOWN_WIDTH
,
803 SCROLLER_ARROW_DOWN_HEIGHT
, True
);
805 scrPtr
->leftArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_LEFT
,
806 SCROLLER_ARROW_LEFT_WIDTH
,
807 SCROLLER_ARROW_LEFT_HEIGHT
, True
);
809 scrPtr
->rightArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_RIGHT
,
810 SCROLLER_ARROW_RIGHT_WIDTH
,
811 SCROLLER_ARROW_RIGHT_HEIGHT
, True
);
813 scrPtr
->hiUpArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_UP
,
814 SCROLLER_ARROW_UP_WIDTH
,
815 SCROLLER_ARROW_UP_HEIGHT
, True
);
817 scrPtr
->hiDownArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_DOWN
,
818 SCROLLER_ARROW_DOWN_WIDTH
,
819 SCROLLER_ARROW_DOWN_HEIGHT
, True
);
821 scrPtr
->hiLeftArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_LEFT
,
822 SCROLLER_ARROW_LEFT_WIDTH
,
823 SCROLLER_ARROW_LEFT_HEIGHT
, True
);
825 scrPtr
->hiRightArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_RIGHT
,
826 SCROLLER_ARROW_RIGHT_WIDTH
,
827 SCROLLER_ARROW_RIGHT_HEIGHT
, True
);
829 scrPtr
->popUpIndicator
= makePixmap(scrPtr
, POPUP_INDICATOR
,
830 POPUP_INDICATOR_WIDTH
,
831 POPUP_INDICATOR_HEIGHT
, True
);
833 scrPtr
->pullDownIndicator
= makePixmap(scrPtr
, PULLDOWN_INDICATOR
,
834 PULLDOWN_INDICATOR_WIDTH
,
835 PULLDOWN_INDICATOR_HEIGHT
, True
);
837 scrPtr
->checkMark
= makePixmap(scrPtr
, CHECK_MARK
,
839 CHECK_MARK_HEIGHT
, True
);
843 scrPtr
->defaultCursor
= XCreateFontCursor(display
, XC_left_ptr
);
845 scrPtr
->textCursor
= XCreateFontCursor(display
, XC_xterm
);
851 blank
= XCreatePixmap(display
, scrPtr
->stipple
, 1, 1, 1);
852 XSetForeground(display
, scrPtr
->monoGC
, 0);
853 XFillRectangle(display
, blank
, scrPtr
->monoGC
, 0, 0, 1, 1);
855 scrPtr
->invisibleCursor
= XCreatePixmapCursor(display
, blank
, blank
,
857 XFreePixmap(display
, blank
);
860 #ifdef HAVE_XINTERNATOMS
861 XInternAtoms(display
, atomNames
, sizeof(atomNames
)/sizeof(char*), False
,
864 for (i
= 0; i
< sizeof(atomNames
)/sizeof(char*); i
++) {
865 atoms
[i
] = XInternAtom(display
, atomNames
[i
], False
);
870 scrPtr
->attribsAtom
= atoms
[i
++];
872 scrPtr
->deleteWindowAtom
= atoms
[i
++];
874 scrPtr
->protocolsAtom
= atoms
[i
++];
876 scrPtr
->clipboardAtom
= atoms
[i
++];
878 scrPtr
->xdndAwareAtom
= atoms
[i
++];
879 scrPtr
->xdndSelectionAtom
= atoms
[i
++];
880 scrPtr
->xdndEnterAtom
= atoms
[i
++];
881 scrPtr
->xdndLeaveAtom
= atoms
[i
++];
882 scrPtr
->xdndPositionAtom
= atoms
[i
++];
883 scrPtr
->xdndDropAtom
= atoms
[i
++];
884 scrPtr
->xdndFinishedAtom
= atoms
[i
++];
885 scrPtr
->xdndTypeListAtom
= atoms
[i
++];
886 scrPtr
->xdndStatusAtom
= atoms
[i
++];
888 scrPtr
->xdndActionCopy
= atoms
[i
++];
889 scrPtr
->xdndActionMove
= atoms
[i
++];
890 scrPtr
->xdndActionLink
= atoms
[i
++];
891 scrPtr
->xdndActionAsk
= atoms
[i
++];
892 scrPtr
->xdndActionPrivate
= atoms
[i
++];
894 scrPtr
->wmIconDragOffsetAtom
= atoms
[i
++];
896 scrPtr
->wmStateAtom
= atoms
[i
++];
898 scrPtr
->rootView
= W_CreateRootView(scrPtr
);
900 scrPtr
->balloon
= W_CreateBalloon(scrPtr
);
903 W_InitApplication(scrPtr
);
911 WMSetWidgetDefaultFont(WMScreen
*scr
, WMFont
*font
)
913 WMReleaseFont(scr
->normalFont
);
914 scr
->normalFont
= WMRetainFont(font
);
919 WMSetWidgetDefaultBoldFont(WMScreen
*scr
, WMFont
*font
)
921 WMReleaseFont(scr
->boldFont
);
922 scr
->boldFont
= WMRetainFont(font
);
928 WMHangData(WMWidget
*widget
, void *data
)
930 W_VIEW(widget
)->hangedData
= data
;
935 WMGetHangedData(WMWidget
*widget
)
937 return W_VIEW(widget
)->hangedData
;
943 WMDestroyWidget(WMWidget
*widget
)
945 W_UnmapView(W_VIEW(widget
));
946 W_DestroyView(W_VIEW(widget
));
951 WMSetFocusToWidget(WMWidget
*widget
)
953 W_SetFocusOfTopLevel(W_TopLevelOfView(W_VIEW(widget
)), W_VIEW(widget
));
959 * Realizes the widget and all it's children.
963 WMRealizeWidget(WMWidget
*w
)
965 W_RealizeView(W_VIEW(w
));
969 WMMapWidget(WMWidget
*w
)
971 W_MapView(W_VIEW(w
));
976 WMReparentWidget(WMWidget
*w
, WMWidget
*newParent
, int x
, int y
)
978 W_ReparentView(W_VIEW(w
), W_VIEW(newParent
), x
, y
);
983 makeChildrenAutomap(W_View
*view
, int flag
)
985 view
= view
->childrenList
;
988 view
->flags
.mapWhenRealized
= flag
;
989 makeChildrenAutomap(view
, flag
);
991 view
= view
->nextSister
;
997 WMMapSubwidgets(WMWidget
*w
)
999 /* make sure that subwidgets created after the parent was realized
1001 if (!W_VIEW(w
)->flags
.realized
) {
1002 makeChildrenAutomap(W_VIEW(w
), True
);
1004 W_MapSubviews(W_VIEW(w
));
1010 WMUnmapSubwidgets(WMWidget
*w
)
1012 if (!W_VIEW(w
)->flags
.realized
) {
1013 makeChildrenAutomap(W_VIEW(w
), False
);
1015 W_UnmapSubviews(W_VIEW(w
));
1022 WMUnmapWidget(WMWidget
*w
)
1024 W_UnmapView(W_VIEW(w
));
1029 WMWidgetIsMapped(WMWidget
*w
)
1031 return W_VIEW(w
)->flags
.mapped
;
1036 WMSetWidgetBackgroundColor(WMWidget
*w
, WMColor
*color
)
1038 W_SetViewBackgroundColor(W_VIEW(w
), color
);
1039 if (W_VIEW(w
)->flags
.mapped
)
1040 WMRedisplayWidget(w
);
1045 WMRaiseWidget(WMWidget
*w
)
1047 W_RaiseView(W_VIEW(w
));
1052 WMLowerWidget(WMWidget
*w
)
1054 W_LowerView(W_VIEW(w
));
1059 WMMoveWidget(WMWidget
*w
, int x
, int y
)
1061 W_MoveView(W_VIEW(w
), x
, y
);
1066 WMResizeWidget(WMWidget
*w
, unsigned int width
, unsigned int height
)
1068 W_ResizeView(W_VIEW(w
), width
, height
);
1074 W_RegisterUserWidget(void)
1078 return userWidgetCount
+ WC_UserWidget
- 1;
1084 WMScreenRContext(WMScreen
*scr
)
1086 return scr
->rcontext
;
1092 WMWidgetWidth(WMWidget
*w
)
1094 return W_VIEW(w
)->size
.width
;
1099 WMWidgetHeight(WMWidget
*w
)
1101 return W_VIEW(w
)->size
.height
;
1106 WMWidgetXID(WMWidget
*w
)
1108 return W_VIEW(w
)->window
;
1113 WMWidgetScreen(WMWidget
*w
)
1115 return W_VIEW(w
)->screen
;
1121 WMScreenMainLoop(WMScreen
*scr
)
1126 WMNextEvent(scr
->display
, &event
);
1127 WMHandleEvent(&event
);
1133 WMBreakModalLoop(WMScreen
*scr
)
1140 WMRunModalLoop(WMScreen
*scr
, WMView
*view
)
1142 /* why is scr passed if is determined from the view? */
1143 /*WMScreen *scr = view->screen;*/
1144 int oldModalLoop
= scr
->modalLoop
;
1145 WMView
*oldModalView
= scr
->modalView
;
1147 scr
->modalView
= view
;
1150 while (scr
->modalLoop
) {
1153 WMNextEvent(scr
->display
, &event
);
1154 WMHandleEvent(&event
);
1157 scr
->modalView
= oldModalView
;
1158 scr
->modalLoop
= oldModalLoop
;
1163 WMScreenDisplay(WMScreen
*scr
)
1165 return scr
->display
;
1170 WMScreenDepth(WMScreen
*scr
)
1177 WMScreenWidth(WMScreen
*scr
)
1179 return scr
->rootView
->size
.width
;
1184 WMScreenHeight(WMScreen
*scr
)
1186 return scr
->rootView
->size
.height
;
1191 WMRedisplayWidget(WMWidget
*w
)
1193 W_RedisplayView(W_VIEW(w
));