6 #include <X11/Xft/Xft.h>
10 #include <X11/keysym.h>
11 #include <X11/cursorfont.h>
13 #include <X11/Xlocale.h>
15 /********** data ************/
18 #define CHECK_BUTTON_ON_WIDTH 16
19 #define CHECK_BUTTON_ON_HEIGHT 16
21 static char *CHECK_BUTTON_ON
[] = {
39 #define CHECK_BUTTON_OFF_WIDTH 16
40 #define CHECK_BUTTON_OFF_HEIGHT 16
42 static char *CHECK_BUTTON_OFF
[] = {
60 #define RADIO_BUTTON_ON_WIDTH 15
61 #define RADIO_BUTTON_ON_HEIGHT 15
62 static char *RADIO_BUTTON_ON
[] = {
80 #define RADIO_BUTTON_OFF_WIDTH 15
81 #define RADIO_BUTTON_OFF_HEIGHT 15
82 static char *RADIO_BUTTON_OFF
[] = {
101 static char *BUTTON_ARROW
[] = {
102 "..................",
103 "....##....#### ...",
104 "...#.%....#... ...",
105 "..#..%#####... ...",
106 ".#............ ...",
107 "#............. ...",
108 ".#............ ...",
110 "...#. ............",
114 #define BUTTON_ARROW_WIDTH 18
115 #define BUTTON_ARROW_HEIGHT 10
118 static char *BUTTON_ARROW2
[] = {
131 #define BUTTON_ARROW2_WIDTH 18
132 #define BUTTON_ARROW2_HEIGHT 10
135 static char *SCROLLER_DIMPLE
[] = {
144 #define SCROLLER_DIMPLE_WIDTH 6
145 #define SCROLLER_DIMPLE_HEIGHT 6
148 static char *SCROLLER_ARROW_UP
[] = {
160 static char *HI_SCROLLER_ARROW_UP
[] = {
172 #define SCROLLER_ARROW_UP_WIDTH 9
173 #define SCROLLER_ARROW_UP_HEIGHT 9
176 static char *SCROLLER_ARROW_DOWN
[] = {
188 static char *HI_SCROLLER_ARROW_DOWN
[] = {
200 #define SCROLLER_ARROW_DOWN_WIDTH 9
201 #define SCROLLER_ARROW_DOWN_HEIGHT 9
205 static char *SCROLLER_ARROW_LEFT
[] = {
217 static char *HI_SCROLLER_ARROW_LEFT
[] = {
229 #define SCROLLER_ARROW_LEFT_WIDTH 9
230 #define SCROLLER_ARROW_LEFT_HEIGHT 9
233 static char *SCROLLER_ARROW_RIGHT
[] = {
245 static char *HI_SCROLLER_ARROW_RIGHT
[] = {
257 #define SCROLLER_ARROW_RIGHT_WIDTH 9
258 #define SCROLLER_ARROW_RIGHT_HEIGHT 9
261 static char *POPUP_INDICATOR
[] = {
272 #define POPUP_INDICATOR_WIDTH 11
273 #define POPUP_INDICATOR_HEIGHT 8
277 static char *PULLDOWN_INDICATOR
[] = {
286 #define PULLDOWN_INDICATOR_WIDTH 9
287 #define PULLDOWN_INDICATOR_HEIGHT 7
290 #define CHECK_MARK_WIDTH 8
291 #define CHECK_MARK_HEIGHT 10
293 static char *CHECK_MARK
[] = {
306 #define STIPPLE_WIDTH 8
307 #define STIPPLE_HEIGHT 8
308 static unsigned char STIPPLE_BITS
[] = {
309 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55
315 extern void W_ReadConfigurations(void);
318 static int userWidgetCount
=0;
321 /***** end data ******/
325 renderPixmap(W_Screen
*screen
, Pixmap d
, Pixmap mask
, char **data
,
326 int width
, int height
)
329 GC whiteGC
= WMColorGC(screen
->white
);
330 GC blackGC
= WMColorGC(screen
->black
);
331 GC lightGC
= WMColorGC(screen
->gray
);
332 GC darkGC
= WMColorGC(screen
->darkGray
);
336 XSetForeground(screen
->display
, screen
->monoGC
, 0);
338 for (y
= 0; y
< height
; y
++) {
339 for (x
= 0; x
< width
; x
++) {
340 switch (data
[y
][x
]) {
343 XDrawPoint(screen
->display
, d
, whiteGC
, x
, y
);
348 XDrawPoint(screen
->display
, mask
, screen
->monoGC
, x
, y
);
352 XDrawPoint(screen
->display
, d
, lightGC
, x
, y
);
357 XDrawPoint(screen
->display
, d
, darkGC
, x
, y
);
363 XDrawPoint(screen
->display
, d
, blackGC
, x
, y
);
373 makePixmap(W_Screen
*sPtr
, char **data
, int width
, int height
, int masked
)
375 Pixmap pixmap
, mask
= None
;
377 pixmap
= XCreatePixmap(sPtr
->display
, W_DRAWABLE(sPtr
), width
, height
,
381 mask
= XCreatePixmap(sPtr
->display
, W_DRAWABLE(sPtr
), width
, height
, 1);
382 XSetForeground(sPtr
->display
, sPtr
->monoGC
, 1);
383 XFillRectangle(sPtr
->display
, mask
, sPtr
->monoGC
, 0, 0, width
, height
);
386 renderPixmap(sPtr
, pixmap
, mask
, data
, width
, height
);
388 return WMCreatePixmapFromXPixmaps(sPtr
, pixmap
, mask
, width
, height
,
393 #define T_WINGS_IMAGES_FILE RESOURCE_PATH"/Images.tiff"
394 #define T_DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.tiff"
396 #define X_WINGS_IMAGES_FILE RESOURCE_PATH"/Images.xpm"
397 #define X_DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.xpm"
401 loadPixmaps(WMScreen
*scr
)
415 image
= RLoadImage(scr
->rcontext
, T_WINGS_IMAGES_FILE
, 0);
417 image
= RLoadImage(scr
->rcontext
, X_WINGS_IMAGES_FILE
, 0);
419 wwarning(_("WINGs: could not load widget images file: %s"),
420 RMessageForError(RErrorCode
));
424 /* make it have a gray background */
425 tmp
= RGetSubImage(image
, 0, 0, 24, 24);
426 RCombineImageWithColor(tmp
, &gray
);
427 scr
->homeIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
429 /* make it have a white background */
430 tmp
= RGetSubImage(image
, 0, 0, 24, 24);
431 RCombineImageWithColor(tmp
, &white
);
432 scr
->altHomeIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
436 tmp
= RGetSubImage(image
, 104, 0, 24, 24);
437 RCombineImageWithColor(tmp
, &white
);
438 scr
->trashcanIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
440 tmp
= RGetSubImage(image
, 104, 0, 24, 24);
441 RCombineImageWithColor(tmp
, &white
);
442 scr
->altTrashcanIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
445 tmp
= RGetSubImage(image
, 104, 24, 24, 24);
446 RCombineImageWithColor(tmp
, &white
);
447 scr
->createDirIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
449 tmp
= RGetSubImage(image
, 104, 24, 24, 24);
450 RCombineImageWithColor(tmp
, &white
);
451 scr
->altCreateDirIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
454 tmp
= RGetSubImage(image
, 24, 80, 24, 24);
455 RCombineImageWithColor(tmp
, &white
);
456 scr
->disketteIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
458 tmp
= RGetSubImage(image
, 24, 80, 24, 24);
459 RCombineImageWithColor(tmp
, &white
);
460 scr
->altDisketteIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
463 tmp
= RGetSubImage(image
, 0, 80, 24, 24);
464 RCombineImageWithColor(tmp
, &white
);
465 scr
->unmountIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
467 tmp
= RGetSubImage(image
, 0, 80, 24, 24);
468 RCombineImageWithColor(tmp
, &white
);
469 scr
->altUnmountIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
472 /* Magnifying Glass Icon for ColorPanel */
473 tmp
= RGetSubImage(image
, 24, 0, 40, 32);
474 RCombineImageWithColor(tmp
, &gray
);
475 scr
->magnifyIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
477 /* ColorWheel Icon for ColorPanel */
478 tmp
= RGetSubImage(image
, 0, 25, 24, 24);
479 scr
->wheelIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
481 /* GrayScale Icon for ColorPanel */
482 tmp
= RGetSubImage(image
, 65, 0, 40, 24);
483 scr
->grayIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
485 /* RGB Icon for ColorPanel */
486 tmp
= RGetSubImage(image
, 25, 33, 40, 24);
487 scr
->rgbIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
489 /* CMYK Icon for ColorPanel */
490 tmp
= RGetSubImage(image
, 65, 25, 40, 24);
491 scr
->cmykIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
493 /* HSB Icon for ColorPanel */
494 tmp
= RGetSubImage(image
, 0, 57, 40, 24);
495 scr
->hsbIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
497 /* CustomColorPalette Icon for ColorPanel */
498 tmp
= RGetSubImage(image
, 81, 57, 40, 24);
499 scr
->customPaletteIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
501 /* ColorList Icon for ColorPanel */
502 tmp
= RGetSubImage(image
, 41, 57, 40, 24);
503 scr
->colorListIcon
= WMCreatePixmapFromRImage(scr
, tmp
, 128);
506 RReleaseImage(image
);
509 scr
->defaultObjectIcon
=
510 WMCreatePixmapFromFile(scr
, T_DEFAULT_OBJECT_ICON_FILE
);
511 if (!scr
->defaultObjectIcon
) {
512 scr
->defaultObjectIcon
=
513 WMCreatePixmapFromFile(scr
, X_DEFAULT_OBJECT_ICON_FILE
);
515 if (!scr
->defaultObjectIcon
) {
516 wwarning("WINGs: could not load default icon file");
525 WMOpenScreen(const char *display
)
527 Display
*dpy
= XOpenDisplay(display
);
530 wwarning("WINGs: could not open display %s",
531 XDisplayName(display
));
535 return WMCreateSimpleApplicationScreen(dpy
);
540 WMCreateSimpleApplicationScreen(Display
*display
)
544 scr
= WMCreateScreen(display
, DefaultScreen(display
));
546 scr
->aflags
.hasAppIcon
= 0;
547 scr
->aflags
.simpleApplication
= 1;
555 WMCreateScreen(Display
*display
, int screen
)
557 return WMCreateScreenWithRContext(display
, screen
,
558 RCreateContext(display
, screen
, NULL
));
563 WMCreateScreenWithRContext(Display
*display
, int screen
, RContext
*context
)
568 static int initialized
= 0;
569 static char *atomNames
[] = {
583 "XdndActionDescription",
590 "_WINGS_DND_MOUSE_OFFSET",
597 Atom atoms
[sizeof(atomNames
)/sizeof(char*)];
604 W_ReadConfigurations();
606 assert(W_ApplicationInitialized());
609 scrPtr
= malloc(sizeof(W_Screen
));
612 memset(scrPtr
, 0, sizeof(W_Screen
));
614 scrPtr
->aflags
.hasAppIcon
= 1;
616 scrPtr
->display
= display
;
617 scrPtr
->screen
= screen
;
618 scrPtr
->rcontext
= context
;
620 scrPtr
->depth
= context
->depth
;
622 scrPtr
->visual
= context
->visual
;
623 scrPtr
->lastEventTime
= 0;
625 scrPtr
->colormap
= context
->cmap
;
627 scrPtr
->rootWin
= RootWindow(display
, screen
);
629 scrPtr
->fontCache
= WMCreateHashTable(WMStringPointerHashCallbacks
);
631 scrPtr
->xftdraw
= XftDrawCreate(scrPtr
->display
, W_DRAWABLE(scrPtr
),
632 scrPtr
->visual
, scrPtr
->colormap
);
634 /* Create missing CUT_BUFFERs */
637 int exists
[8] = {0, 0, 0, 0, 0, 0, 0, 0};
640 rootWinProps
= XListProperties(display
, scrPtr
->rootWin
, &count
);
641 for (i
=0; i
<count
; i
++) {
642 switch(rootWinProps
[i
]) {
644 exists
[0] = 1; break;
646 exists
[1] = 1; break;
648 exists
[2] = 1; break;
650 exists
[3] = 1; break;
652 exists
[4] = 1; break;
654 exists
[5] = 1; break;
656 exists
[6] = 1; break;
658 exists
[7] = 1; break;
666 for (i
=0; i
<8; i
++) {
668 XStoreBuffer(display
, "", 0, i
);
673 scrPtr
->ignoredModifierMask
= 0;
676 XModifierKeymap
*modmap
;
677 KeyCode nlock
, slock
;
678 static int mask_table
[8] = {
679 ShiftMask
,LockMask
,ControlMask
,Mod1Mask
,
680 Mod2Mask
, Mod3Mask
, Mod4Mask
, Mod5Mask
682 unsigned int numLockMask
=0, scrollLockMask
=0;
684 nlock
= XKeysymToKeycode(display
, XK_Num_Lock
);
685 slock
= XKeysymToKeycode(display
, XK_Scroll_Lock
);
688 * Find out the masks for the NumLock and ScrollLock modifiers,
689 * so that we can bind the grabs for when they are enabled too.
691 modmap
= XGetModifierMapping(display
);
693 if (modmap
!=NULL
&& modmap
->max_keypermod
>0) {
694 for (i
=0; i
<8*modmap
->max_keypermod
; i
++) {
695 if (modmap
->modifiermap
[i
]==nlock
&& nlock
!=0)
696 numLockMask
= mask_table
[i
/modmap
->max_keypermod
];
697 else if (modmap
->modifiermap
[i
]==slock
&& slock
!=0)
698 scrollLockMask
= mask_table
[i
/modmap
->max_keypermod
];
703 XFreeModifiermap(modmap
);
706 scrPtr
->ignoredModifierMask
= numLockMask
|scrollLockMask
|LockMask
;
709 /* initially allocate some colors */
710 WMWhiteColor(scrPtr
);
711 WMBlackColor(scrPtr
);
713 WMDarkGrayColor(scrPtr
);
715 gcv
.graphics_exposures
= False
;
717 gcv
.function
= GXxor
;
718 gcv
.foreground
= W_PIXEL(scrPtr
->white
);
719 if (gcv
.foreground
== 0) gcv
.foreground
= 1;
720 scrPtr
->xorGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
721 |GCGraphicsExposures
|GCForeground
, &gcv
);
723 gcv
.function
= GXxor
;
724 gcv
.foreground
= W_PIXEL(scrPtr
->gray
);
725 gcv
.subwindow_mode
= IncludeInferiors
;
726 scrPtr
->ixorGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
727 |GCGraphicsExposures
|GCForeground
728 |GCSubwindowMode
, &gcv
);
730 gcv
.function
= GXcopy
;
731 scrPtr
->copyGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
732 |GCGraphicsExposures
, &gcv
);
734 scrPtr
->clipGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
), GCFunction
735 |GCGraphicsExposures
, &gcv
);
737 stipple
= XCreateBitmapFromData(display
, W_DRAWABLE(scrPtr
),
738 STIPPLE_BITS
, STIPPLE_WIDTH
, STIPPLE_HEIGHT
);
739 gcv
.foreground
= W_PIXEL(scrPtr
->darkGray
);
740 gcv
.background
= W_PIXEL(scrPtr
->gray
);
741 gcv
.fill_style
= FillStippled
;
742 gcv
.stipple
= stipple
;
743 scrPtr
->stippleGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
),
744 GCForeground
|GCBackground
|GCStipple
745 |GCFillStyle
|GCGraphicsExposures
, &gcv
);
747 scrPtr
->drawStringGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
),
748 GCGraphicsExposures
, &gcv
);
749 scrPtr
->drawImStringGC
= XCreateGC(display
, W_DRAWABLE(scrPtr
),
750 GCGraphicsExposures
, &gcv
);
752 /* we need a 1bpp drawable for the monoGC, so borrow this one */
753 scrPtr
->monoGC
= XCreateGC(display
, stipple
, 0, NULL
);
755 scrPtr
->stipple
= stipple
;
757 scrPtr
->antialiasedText
= WINGsConfiguration
.antialiasedText
;
759 scrPtr
->normalFont
= WMSystemFontOfSize(scrPtr
, 0);
761 scrPtr
->boldFont
= WMBoldSystemFontOfSize(scrPtr
, 0);
763 if (!scrPtr
->boldFont
)
764 scrPtr
->boldFont
= scrPtr
->normalFont
;
766 if (!scrPtr
->normalFont
) {
767 wwarning(_("could not load any fonts. Make sure your font installation"
768 " and locale settings are correct."));
773 /* create input method stuff */
776 scrPtr
->checkButtonImageOn
= makePixmap(scrPtr
, CHECK_BUTTON_ON
,
777 CHECK_BUTTON_ON_WIDTH
,
778 CHECK_BUTTON_ON_HEIGHT
, False
);
780 scrPtr
->checkButtonImageOff
= makePixmap(scrPtr
, CHECK_BUTTON_OFF
,
781 CHECK_BUTTON_OFF_WIDTH
,
782 CHECK_BUTTON_OFF_HEIGHT
, False
);
784 scrPtr
->radioButtonImageOn
= makePixmap(scrPtr
, RADIO_BUTTON_ON
,
785 RADIO_BUTTON_ON_WIDTH
,
786 RADIO_BUTTON_ON_HEIGHT
, False
);
788 scrPtr
->radioButtonImageOff
= makePixmap(scrPtr
, RADIO_BUTTON_OFF
,
789 RADIO_BUTTON_OFF_WIDTH
,
790 RADIO_BUTTON_OFF_HEIGHT
, False
);
792 scrPtr
->buttonArrow
= makePixmap(scrPtr
, BUTTON_ARROW
,
793 BUTTON_ARROW_WIDTH
, BUTTON_ARROW_HEIGHT
,
796 scrPtr
->pushedButtonArrow
= makePixmap(scrPtr
, BUTTON_ARROW2
,
797 BUTTON_ARROW2_WIDTH
, BUTTON_ARROW2_HEIGHT
,
801 scrPtr
->scrollerDimple
= makePixmap(scrPtr
, SCROLLER_DIMPLE
,
802 SCROLLER_DIMPLE_WIDTH
,
803 SCROLLER_DIMPLE_HEIGHT
, False
);
806 scrPtr
->upArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_UP
,
807 SCROLLER_ARROW_UP_WIDTH
,
808 SCROLLER_ARROW_UP_HEIGHT
, True
);
810 scrPtr
->downArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_DOWN
,
811 SCROLLER_ARROW_DOWN_WIDTH
,
812 SCROLLER_ARROW_DOWN_HEIGHT
, True
);
814 scrPtr
->leftArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_LEFT
,
815 SCROLLER_ARROW_LEFT_WIDTH
,
816 SCROLLER_ARROW_LEFT_HEIGHT
, True
);
818 scrPtr
->rightArrow
= makePixmap(scrPtr
, SCROLLER_ARROW_RIGHT
,
819 SCROLLER_ARROW_RIGHT_WIDTH
,
820 SCROLLER_ARROW_RIGHT_HEIGHT
, True
);
822 scrPtr
->hiUpArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_UP
,
823 SCROLLER_ARROW_UP_WIDTH
,
824 SCROLLER_ARROW_UP_HEIGHT
, True
);
826 scrPtr
->hiDownArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_DOWN
,
827 SCROLLER_ARROW_DOWN_WIDTH
,
828 SCROLLER_ARROW_DOWN_HEIGHT
, True
);
830 scrPtr
->hiLeftArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_LEFT
,
831 SCROLLER_ARROW_LEFT_WIDTH
,
832 SCROLLER_ARROW_LEFT_HEIGHT
, True
);
834 scrPtr
->hiRightArrow
= makePixmap(scrPtr
, HI_SCROLLER_ARROW_RIGHT
,
835 SCROLLER_ARROW_RIGHT_WIDTH
,
836 SCROLLER_ARROW_RIGHT_HEIGHT
, True
);
838 scrPtr
->popUpIndicator
= makePixmap(scrPtr
, POPUP_INDICATOR
,
839 POPUP_INDICATOR_WIDTH
,
840 POPUP_INDICATOR_HEIGHT
, True
);
842 scrPtr
->pullDownIndicator
= makePixmap(scrPtr
, PULLDOWN_INDICATOR
,
843 PULLDOWN_INDICATOR_WIDTH
,
844 PULLDOWN_INDICATOR_HEIGHT
, True
);
846 scrPtr
->checkMark
= makePixmap(scrPtr
, CHECK_MARK
,
848 CHECK_MARK_HEIGHT
, True
);
852 scrPtr
->defaultCursor
= XCreateFontCursor(display
, XC_left_ptr
);
854 scrPtr
->textCursor
= XCreateFontCursor(display
, XC_xterm
);
860 blank
= XCreatePixmap(display
, scrPtr
->stipple
, 1, 1, 1);
861 XSetForeground(display
, scrPtr
->monoGC
, 0);
862 XFillRectangle(display
, blank
, scrPtr
->monoGC
, 0, 0, 1, 1);
864 scrPtr
->invisibleCursor
= XCreatePixmapCursor(display
, blank
, blank
,
866 XFreePixmap(display
, blank
);
869 #ifdef HAVE_XINTERNATOMS
870 XInternAtoms(display
, atomNames
, sizeof(atomNames
)/sizeof(char*), False
,
873 for (i
= 0; i
< sizeof(atomNames
)/sizeof(char*); i
++) {
874 atoms
[i
] = XInternAtom(display
, atomNames
[i
], False
);
879 scrPtr
->attribsAtom
= atoms
[i
++];
881 scrPtr
->deleteWindowAtom
= atoms
[i
++];
883 scrPtr
->protocolsAtom
= atoms
[i
++];
885 scrPtr
->clipboardAtom
= atoms
[i
++];
887 scrPtr
->xdndAwareAtom
= atoms
[i
++];
888 scrPtr
->xdndSelectionAtom
= atoms
[i
++];
889 scrPtr
->xdndEnterAtom
= atoms
[i
++];
890 scrPtr
->xdndLeaveAtom
= atoms
[i
++];
891 scrPtr
->xdndPositionAtom
= atoms
[i
++];
892 scrPtr
->xdndDropAtom
= atoms
[i
++];
893 scrPtr
->xdndFinishedAtom
= atoms
[i
++];
894 scrPtr
->xdndTypeListAtom
= atoms
[i
++];
895 scrPtr
->xdndActionListAtom
= atoms
[i
++];
896 scrPtr
->xdndActionDescriptionAtom
= atoms
[i
++];
897 scrPtr
->xdndStatusAtom
= atoms
[i
++];
899 scrPtr
->xdndActionCopy
= atoms
[i
++];
900 scrPtr
->xdndActionMove
= atoms
[i
++];
901 scrPtr
->xdndActionLink
= atoms
[i
++];
902 scrPtr
->xdndActionAsk
= atoms
[i
++];
903 scrPtr
->xdndActionPrivate
= atoms
[i
++];
905 scrPtr
->wmIconDragOffsetAtom
= atoms
[i
++];
907 scrPtr
->wmStateAtom
= atoms
[i
++];
909 scrPtr
->utf8String
= atoms
[i
++];
910 scrPtr
->netwmName
= atoms
[i
++];
911 scrPtr
->netwmIconName
= atoms
[i
++];
912 scrPtr
->netwmIcon
= atoms
[i
++];
914 scrPtr
->rootView
= W_CreateRootView(scrPtr
);
916 scrPtr
->balloon
= W_CreateBalloon(scrPtr
);
918 W_InitApplication(scrPtr
);
926 WMSetWidgetDefaultFont(WMScreen
*scr
, WMFont
*font
)
928 WMReleaseFont(scr
->normalFont
);
929 scr
->normalFont
= WMRetainFont(font
);
934 WMSetWidgetDefaultBoldFont(WMScreen
*scr
, WMFont
*font
)
936 WMReleaseFont(scr
->boldFont
);
937 scr
->boldFont
= WMRetainFont(font
);
943 WMHangData(WMWidget
*widget
, void *data
)
945 W_VIEW(widget
)->hangedData
= data
;
950 WMGetHangedData(WMWidget
*widget
)
952 return W_VIEW(widget
)->hangedData
;
958 WMDestroyWidget(WMWidget
*widget
)
960 W_UnmapView(W_VIEW(widget
));
961 W_DestroyView(W_VIEW(widget
));
966 WMSetFocusToWidget(WMWidget
*widget
)
968 W_SetFocusOfTopLevel(W_TopLevelOfView(W_VIEW(widget
)), W_VIEW(widget
));
974 * Realizes the widget and all it's children.
978 WMRealizeWidget(WMWidget
*w
)
980 W_RealizeView(W_VIEW(w
));
984 WMMapWidget(WMWidget
*w
)
986 W_MapView(W_VIEW(w
));
991 WMReparentWidget(WMWidget
*w
, WMWidget
*newParent
, int x
, int y
)
993 W_ReparentView(W_VIEW(w
), W_VIEW(newParent
), x
, y
);
998 makeChildrenAutomap(W_View
*view
, int flag
)
1000 view
= view
->childrenList
;
1003 view
->flags
.mapWhenRealized
= flag
;
1004 makeChildrenAutomap(view
, flag
);
1006 view
= view
->nextSister
;
1012 WMMapSubwidgets(WMWidget
*w
)
1014 /* make sure that subwidgets created after the parent was realized
1016 if (!W_VIEW(w
)->flags
.realized
) {
1017 makeChildrenAutomap(W_VIEW(w
), True
);
1019 W_MapSubviews(W_VIEW(w
));
1025 WMUnmapSubwidgets(WMWidget
*w
)
1027 if (!W_VIEW(w
)->flags
.realized
) {
1028 makeChildrenAutomap(W_VIEW(w
), False
);
1030 W_UnmapSubviews(W_VIEW(w
));
1037 WMUnmapWidget(WMWidget
*w
)
1039 W_UnmapView(W_VIEW(w
));
1044 WMWidgetIsMapped(WMWidget
*w
)
1046 return W_VIEW(w
)->flags
.mapped
;
1051 WMSetWidgetBackgroundColor(WMWidget
*w
, WMColor
*color
)
1053 W_SetViewBackgroundColor(W_VIEW(w
), color
);
1054 if (W_VIEW(w
)->flags
.mapped
)
1055 WMRedisplayWidget(w
);
1060 WMGetWidgetBackgroundColor(WMWidget
*w
)
1062 return W_VIEW(w
)->backColor
;
1067 WMRaiseWidget(WMWidget
*w
)
1069 W_RaiseView(W_VIEW(w
));
1074 WMLowerWidget(WMWidget
*w
)
1076 W_LowerView(W_VIEW(w
));
1081 WMMoveWidget(WMWidget
*w
, int x
, int y
)
1083 W_MoveView(W_VIEW(w
), x
, y
);
1088 WMResizeWidget(WMWidget
*w
, unsigned int width
, unsigned int height
)
1090 W_ResizeView(W_VIEW(w
), width
, height
);
1096 W_RegisterUserWidget(void)
1100 return userWidgetCount
+ WC_UserWidget
- 1;
1106 WMScreenRContext(WMScreen
*scr
)
1108 return scr
->rcontext
;
1114 WMWidgetWidth(WMWidget
*w
)
1116 return W_VIEW(w
)->size
.width
;
1121 WMWidgetHeight(WMWidget
*w
)
1123 return W_VIEW(w
)->size
.height
;
1128 WMWidgetXID(WMWidget
*w
)
1130 return W_VIEW(w
)->window
;
1135 WMWidgetScreen(WMWidget
*w
)
1137 return W_VIEW(w
)->screen
;
1143 WMScreenMainLoop(WMScreen
*scr
)
1148 WMNextEvent(scr
->display
, &event
);
1149 WMHandleEvent(&event
);
1155 WMBreakModalLoop(WMScreen
*scr
)
1162 WMRunModalLoop(WMScreen
*scr
, WMView
*view
)
1164 /* why is scr passed if is determined from the view? */
1165 /*WMScreen *scr = view->screen;*/
1166 int oldModalLoop
= scr
->modalLoop
;
1167 WMView
*oldModalView
= scr
->modalView
;
1169 scr
->modalView
= view
;
1172 while (scr
->modalLoop
) {
1175 WMNextEvent(scr
->display
, &event
);
1176 WMHandleEvent(&event
);
1179 scr
->modalView
= oldModalView
;
1180 scr
->modalLoop
= oldModalLoop
;
1185 WMScreenDisplay(WMScreen
*scr
)
1187 return scr
->display
;
1192 WMScreenDepth(WMScreen
*scr
)
1199 WMScreenWidth(WMScreen
*scr
)
1201 return scr
->rootView
->size
.width
;
1206 WMScreenHeight(WMScreen
*scr
)
1208 return scr
->rootView
->size
.height
;
1213 WMRedisplayWidget(WMWidget
*w
)
1215 W_RedisplayView(W_VIEW(w
));