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
);
621 scrPtr
->fontSetCache
= WMCreateHashTable(WMStringPointerHashCallbacks
);
624 /* create input method stuff */
625 W_InitIMStuff(scrPtr
);
627 /* Create missing CUT_BUFFERs */
630 int exists
[8] = {0, 0, 0, 0, 0, 0, 0, 0};
633 rootWinProps
= XListProperties(display
, scrPtr
->rootWin
, &count
);
634 for (i
=0; i
<count
; i
++) {
635 switch(rootWinProps
[i
]) {
637 exists
[0] = 1; break;
639 exists
[1] = 1; break;
641 exists
[2] = 1; break;
643 exists
[3] = 1; break;
645 exists
[4] = 1; break;
647 exists
[5] = 1; break;
649 exists
[6] = 1; break;
651 exists
[7] = 1; break;
659 for (i
=0; i
<8; i
++) {
661 XStoreBuffer(display
, "", 0, i
);
666 scrPtr
->ignoredModifierMask
= 0;
669 XModifierKeymap
*modmap
;
670 KeyCode nlock
, slock
;
671 static int mask_table
[8] = {
672 ShiftMask
,LockMask
,ControlMask
,Mod1Mask
,
673 Mod2Mask
, Mod3Mask
, Mod4Mask
, Mod5Mask
675 unsigned int numLockMask
, scrollLockMask
;
677 nlock
= XKeysymToKeycode(display
, XK_Num_Lock
);
678 slock
= XKeysymToKeycode(display
, XK_Scroll_Lock
);
681 * Find out the masks for the NumLock and ScrollLock modifiers,
682 * so that we can bind the grabs for when they are enabled too.
684 modmap
= XGetModifierMapping(display
);
686 if (modmap
!=NULL
&& modmap
->max_keypermod
>0) {
687 for (i
=0; i
<8*modmap
->max_keypermod
; i
++) {
688 if (modmap
->modifiermap
[i
]==nlock
&& nlock
!=0)
689 numLockMask
= mask_table
[i
/modmap
->max_keypermod
];
690 else if (modmap
->modifiermap
[i
]==slock
&& slock
!=0)
691 scrollLockMask
= mask_table
[i
/modmap
->max_keypermod
];
696 XFreeModifiermap(modmap
);
699 scrPtr
->ignoredModifierMask
= numLockMask
|scrollLockMask
|LockMask
;
702 /* initially allocate some colors */
703 WMWhiteColor(scrPtr
);
704 WMBlackColor(scrPtr
);
706 WMDarkGrayColor(scrPtr
);
708 gcv
.graphics_exposures
= False
;
710 gcv
.function
= GXxor
;
711 gcv
.foreground
= W_PIXEL(scrPtr
->white
);
712 if (gcv
.foreground
== 0) gcv
.foreground
= 1;
713 scrPtr
->xorGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
714 |GCGraphicsExposures
|GCForeground
, &gcv
);
716 gcv
.function
= GXxor
;
717 gcv
.foreground
= W_PIXEL(scrPtr
->gray
);
718 gcv
.subwindow_mode
= IncludeInferiors
;
719 scrPtr
->ixorGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
720 |GCGraphicsExposures
|GCForeground
721 |GCSubwindowMode
, &gcv
);
723 gcv
.function
= GXcopy
;
724 scrPtr
->copyGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
725 |GCGraphicsExposures
, &gcv
);
727 scrPtr
->clipGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
728 |GCGraphicsExposures
, &gcv
);
731 stipple
= XCreateBitmapFromData(display
, W_DRAWABLE(scrPtr
),
732 STIPPLE_BITS
, STIPPLE_WIDTH
, STIPPLE_HEIGHT
);
733 gcv
.foreground
= W_PIXEL(scrPtr
->darkGray
);
734 gcv
.background
= W_PIXEL(scrPtr
->gray
);
735 gcv
.fill_style
= FillStippled
;
736 gcv
.stipple
= stipple
;
737 scrPtr
->stippleGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
),
738 GCForeground
|GCBackground
|GCStipple
739 |GCFillStyle
|GCGraphicsExposures
, &gcv
);
741 gcv
.foreground
= W_PIXEL(scrPtr
->black
);
742 gcv
.background
= W_PIXEL(scrPtr
->white
);
743 scrPtr
->textFieldGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
),
744 GCForeground
|GCBackground
, &gcv
);
746 /* we need a 1bpp drawable for the monoGC, so borrow this one */
747 scrPtr
->monoGC
= XCreateGC(display
, stipple
, 0, NULL
);
749 scrPtr
->stipple
= stipple
;
751 scrPtr
->useMultiByte
= WINGsConfiguration
.useMultiByte
;
753 scrPtr
->normalFont
= WMSystemFontOfSize(scrPtr
,
754 WINGsConfiguration
.defaultFontSize
);
756 scrPtr
->boldFont
= WMBoldSystemFontOfSize(scrPtr
,
757 WINGsConfiguration
.defaultFontSize
);
759 if (!scrPtr
->boldFont
)
760 scrPtr
->boldFont
= scrPtr
->normalFont
;
762 if (!scrPtr
->normalFont
) {
763 wwarning(_("could not load any fonts. Make sure your font installation"
764 " and locale settings are correct."));
769 scrPtr
->checkButtonImageOn
= makePixmap(scrPtr
, CHECK_BUTTON_ON
,
770 CHECK_BUTTON_ON_WIDTH
,
771 CHECK_BUTTON_ON_HEIGHT
, False
);
773 scrPtr
->checkButtonImageOff
= makePixmap(scrPtr
, CHECK_BUTTON_OFF
,
774 CHECK_BUTTON_OFF_WIDTH
,
775 CHECK_BUTTON_OFF_HEIGHT
, False
);
777 scrPtr
->radioButtonImageOn
= makePixmap(scrPtr
, RADIO_BUTTON_ON
,
778 RADIO_BUTTON_ON_WIDTH
,
779 RADIO_BUTTON_ON_HEIGHT
, False
);
781 scrPtr
->radioButtonImageOff
= makePixmap(scrPtr
, RADIO_BUTTON_OFF
,
782 RADIO_BUTTON_OFF_WIDTH
,
783 RADIO_BUTTON_OFF_HEIGHT
, False
);
785 scrPtr
->buttonArrow
= makePixmap(scrPtr
, BUTTON_ARROW
,
786 BUTTON_ARROW_WIDTH
, BUTTON_ARROW_HEIGHT
,
789 scrPtr
->pushedButtonArrow
= makePixmap(scrPtr
, BUTTON_ARROW2
,
790 BUTTON_ARROW2_WIDTH
, BUTTON_ARROW2_HEIGHT
,
794 scrPtr
->scrollerDimple
= makePixmap(scrPtr
, SCROLLER_DIMPLE
,
795 SCROLLER_DIMPLE_WIDTH
,
796 SCROLLER_DIMPLE_HEIGHT
, False
);
799 scrPtr
->upArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_UP
,
800 SCROLLER_ARROW_UP_WIDTH
,
801 SCROLLER_ARROW_UP_HEIGHT
, True
);
803 scrPtr
->downArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_DOWN
,
804 SCROLLER_ARROW_DOWN_WIDTH
,
805 SCROLLER_ARROW_DOWN_HEIGHT
, True
);
807 scrPtr
->leftArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_LEFT
,
808 SCROLLER_ARROW_LEFT_WIDTH
,
809 SCROLLER_ARROW_LEFT_HEIGHT
, True
);
811 scrPtr
->rightArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_RIGHT
,
812 SCROLLER_ARROW_RIGHT_WIDTH
,
813 SCROLLER_ARROW_RIGHT_HEIGHT
, True
);
815 scrPtr
->hiUpArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_UP
,
816 SCROLLER_ARROW_UP_WIDTH
,
817 SCROLLER_ARROW_UP_HEIGHT
, True
);
819 scrPtr
->hiDownArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_DOWN
,
820 SCROLLER_ARROW_DOWN_WIDTH
,
821 SCROLLER_ARROW_DOWN_HEIGHT
, True
);
823 scrPtr
->hiLeftArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_LEFT
,
824 SCROLLER_ARROW_LEFT_WIDTH
,
825 SCROLLER_ARROW_LEFT_HEIGHT
, True
);
827 scrPtr
->hiRightArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_RIGHT
,
828 SCROLLER_ARROW_RIGHT_WIDTH
,
829 SCROLLER_ARROW_RIGHT_HEIGHT
, True
);
831 scrPtr
->popUpIndicator
= makePixmap(scrPtr
, POPUP_INDICATOR
,
832 POPUP_INDICATOR_WIDTH
,
833 POPUP_INDICATOR_HEIGHT
, True
);
835 scrPtr
->pullDownIndicator
= makePixmap(scrPtr
, PULLDOWN_INDICATOR
,
836 PULLDOWN_INDICATOR_WIDTH
,
837 PULLDOWN_INDICATOR_HEIGHT
, True
);
839 scrPtr
->checkMark
= makePixmap(scrPtr
, CHECK_MARK
,
841 CHECK_MARK_HEIGHT
, True
);
845 scrPtr
->defaultCursor
= XCreateFontCursor(display
, XC_left_ptr
);
847 scrPtr
->textCursor
= XCreateFontCursor(display
, XC_xterm
);
853 blank
= XCreatePixmap(display
, scrPtr
->stipple
, 1, 1, 1);
854 XSetForeground(display
, scrPtr
->monoGC
, 0);
855 XFillRectangle(display
, blank
, scrPtr
->monoGC
, 0, 0, 1, 1);
857 scrPtr
->invisibleCursor
= XCreatePixmapCursor(display
, blank
, blank
,
859 XFreePixmap(display
, blank
);
862 #ifdef HAVE_XINTERNATOMS
863 XInternAtoms(display
, atomNames
, sizeof(atomNames
)/sizeof(char*), False
,
866 for (i
= 0; i
< sizeof(atomNames
)/sizeof(char*); i
++) {
867 atoms
[i
] = XInternAtom(display
, atomNames
[i
], False
);
872 scrPtr
->attribsAtom
= atoms
[i
++];
874 scrPtr
->deleteWindowAtom
= atoms
[i
++];
876 scrPtr
->protocolsAtom
= atoms
[i
++];
878 scrPtr
->clipboardAtom
= atoms
[i
++];
880 scrPtr
->xdndAwareAtom
= atoms
[i
++];
881 scrPtr
->xdndSelectionAtom
= atoms
[i
++];
882 scrPtr
->xdndEnterAtom
= atoms
[i
++];
883 scrPtr
->xdndLeaveAtom
= atoms
[i
++];
884 scrPtr
->xdndPositionAtom
= atoms
[i
++];
885 scrPtr
->xdndDropAtom
= atoms
[i
++];
886 scrPtr
->xdndFinishedAtom
= atoms
[i
++];
887 scrPtr
->xdndTypeListAtom
= atoms
[i
++];
888 scrPtr
->xdndStatusAtom
= atoms
[i
++];
890 scrPtr
->xdndActionCopy
= atoms
[i
++];
891 scrPtr
->xdndActionMove
= atoms
[i
++];
892 scrPtr
->xdndActionLink
= atoms
[i
++];
893 scrPtr
->xdndActionAsk
= atoms
[i
++];
894 scrPtr
->xdndActionPrivate
= atoms
[i
++];
896 scrPtr
->wmIconDragOffsetAtom
= atoms
[i
++];
898 scrPtr
->wmStateAtom
= atoms
[i
++];
900 scrPtr
->rootView
= W_CreateRootView(scrPtr
);
902 scrPtr
->balloon
= W_CreateBalloon(scrPtr
);
905 W_InitApplication(scrPtr
);
913 WMSetWidgetDefaultFont(WMScreen
*scr
, WMFont
*font
)
915 WMReleaseFont(scr
->normalFont
);
916 scr
->normalFont
= WMRetainFont(font
);
921 WMSetWidgetDefaultBoldFont(WMScreen
*scr
, WMFont
*font
)
923 WMReleaseFont(scr
->boldFont
);
924 scr
->boldFont
= WMRetainFont(font
);
930 WMHangData(WMWidget
*widget
, void *data
)
932 W_VIEW(widget
)->hangedData
= data
;
937 WMGetHangedData(WMWidget
*widget
)
939 return W_VIEW(widget
)->hangedData
;
945 WMDestroyWidget(WMWidget
*widget
)
947 W_UnmapView(W_VIEW(widget
));
948 W_DestroyView(W_VIEW(widget
));
953 WMSetFocusToWidget(WMWidget
*widget
)
955 W_SetFocusOfTopLevel(W_TopLevelOfView(W_VIEW(widget
)), W_VIEW(widget
));
961 * Realizes the widget and all it's children.
965 WMRealizeWidget(WMWidget
*w
)
967 W_RealizeView(W_VIEW(w
));
971 WMMapWidget(WMWidget
*w
)
973 W_MapView(W_VIEW(w
));
978 WMReparentWidget(WMWidget
*w
, WMWidget
*newParent
, int x
, int y
)
980 W_ReparentView(W_VIEW(w
), W_VIEW(newParent
), x
, y
);
985 makeChildrenAutomap(W_View
*view
, int flag
)
987 view
= view
->childrenList
;
990 view
->flags
.mapWhenRealized
= flag
;
991 makeChildrenAutomap(view
, flag
);
993 view
= view
->nextSister
;
999 WMMapSubwidgets(WMWidget
*w
)
1001 /* make sure that subwidgets created after the parent was realized
1003 if (!W_VIEW(w
)->flags
.realized
) {
1004 makeChildrenAutomap(W_VIEW(w
), True
);
1006 W_MapSubviews(W_VIEW(w
));
1012 WMUnmapSubwidgets(WMWidget
*w
)
1014 if (!W_VIEW(w
)->flags
.realized
) {
1015 makeChildrenAutomap(W_VIEW(w
), False
);
1017 W_UnmapSubviews(W_VIEW(w
));
1024 WMUnmapWidget(WMWidget
*w
)
1026 W_UnmapView(W_VIEW(w
));
1031 WMWidgetIsMapped(WMWidget
*w
)
1033 return W_VIEW(w
)->flags
.mapped
;
1038 WMSetWidgetBackgroundColor(WMWidget
*w
, WMColor
*color
)
1040 W_SetViewBackgroundColor(W_VIEW(w
), color
);
1041 if (W_VIEW(w
)->flags
.mapped
)
1042 WMRedisplayWidget(w
);
1047 WMRaiseWidget(WMWidget
*w
)
1049 W_RaiseView(W_VIEW(w
));
1054 WMLowerWidget(WMWidget
*w
)
1056 W_LowerView(W_VIEW(w
));
1061 WMMoveWidget(WMWidget
*w
, int x
, int y
)
1063 W_MoveView(W_VIEW(w
), x
, y
);
1068 WMResizeWidget(WMWidget
*w
, unsigned int width
, unsigned int height
)
1070 W_ResizeView(W_VIEW(w
), width
, height
);
1076 W_RegisterUserWidget(void)
1080 return userWidgetCount
+ WC_UserWidget
- 1;
1086 WMScreenRContext(WMScreen
*scr
)
1088 return scr
->rcontext
;
1094 WMWidgetWidth(WMWidget
*w
)
1096 return W_VIEW(w
)->size
.width
;
1101 WMWidgetHeight(WMWidget
*w
)
1103 return W_VIEW(w
)->size
.height
;
1108 WMWidgetXID(WMWidget
*w
)
1110 return W_VIEW(w
)->window
;
1115 WMWidgetScreen(WMWidget
*w
)
1117 return W_VIEW(w
)->screen
;
1123 WMScreenMainLoop(WMScreen
*scr
)
1128 WMNextEvent(scr
->display
, &event
);
1129 WMHandleEvent(&event
);
1135 WMBreakModalLoop(WMScreen
*scr
)
1142 WMRunModalLoop(WMScreen
*scr
, WMView
*view
)
1144 /* why is scr passed if is determined from the view? */
1145 /*WMScreen *scr = view->screen;*/
1146 int oldModalLoop
= scr
->modalLoop
;
1147 WMView
*oldModalView
= scr
->modalView
;
1149 scr
->modalView
= view
;
1152 while (scr
->modalLoop
) {
1155 WMNextEvent(scr
->display
, &event
);
1156 WMHandleEvent(&event
);
1159 scr
->modalView
= oldModalView
;
1160 scr
->modalLoop
= oldModalLoop
;
1165 WMScreenDisplay(WMScreen
*scr
)
1167 return scr
->display
;
1172 WMScreenDepth(WMScreen
*scr
)
1179 WMScreenWidth(WMScreen
*scr
)
1181 return scr
->rootView
->size
.width
;
1186 WMScreenHeight(WMScreen
*scr
)
1188 return scr
->rootView
->size
.height
;
1193 WMRedisplayWidget(WMWidget
*w
)
1195 W_RedisplayView(W_VIEW(w
));