1 /* dialog.c - dialog windows for internal use
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26 #include <X11/Xutil.h>
27 #include <X11/keysym.h>
33 #include <sys/types.h>
39 #define PATH_MAX DEFAULT_PATH_MAX
42 #include "WindowMaker.h"
54 extern WPreferences wPreferences
;
59 wMessageDialog(WScreen
*scr
, char *title
, char *message
,
60 char *defBtn
, char *altBtn
, char *othBtn
)
67 panel
= WMCreateAlertPanel(scr
->wmscreen
, NULL
, title
, message
,
68 defBtn
, altBtn
, othBtn
);
70 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 400, 180, 0, 0, 0);
72 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
74 wwin
= wManageInternalWindow(scr
, parent
, None
, NULL
,
75 (scr
->scr_width
- 400)/2,
76 (scr
->scr_height
- 180)/2, 400, 180);
77 wwin
->client_leader
= WMWidgetXID(panel
->win
);
79 WMMapWidget(panel
->win
);
83 while (!panel
->done
) {
86 WMNextEvent(dpy
, &event
);
87 WMHandleEvent(&event
);
90 result
= panel
->result
;
92 WMUnmapWidget(panel
->win
);
94 wUnmanageWindow(wwin
, False
, False
);
96 WMDestroyAlertPanel(panel
);
98 XDestroyWindow(dpy
, parent
);
106 wInputDialog(WScreen
*scr
, char *title
, char *message
, char **text
)
114 panel
= WMCreateInputPanel(scr
->wmscreen
, NULL
, title
, message
, *text
,
115 _("OK"), _("Cancel"));
118 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 320, 160, 0, 0, 0);
119 XSelectInput(dpy
, parent
, KeyPressMask
|KeyReleaseMask
);
121 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
123 wwin
= wManageInternalWindow(scr
, parent
, None
, NULL
,
124 (scr
->scr_width
- 320)/2,
125 (scr
->scr_height
- 160)/2, 320, 160);
127 wwin
->client_leader
= WMWidgetXID(panel
->win
);
129 WMMapWidget(panel
->win
);
133 while (!panel
->done
) {
136 WMNextEvent(dpy
, &event
);
137 WMHandleEvent(&event
);
140 if (panel
->result
== WAPRDefault
)
141 result
= WMGetTextFieldText(panel
->text
);
145 wUnmanageWindow(wwin
, False
, False
);
147 WMDestroyInputPanel(panel
);
149 XDestroyWindow(dpy
, parent
);
164 *****************************************************************
165 * Icon Selection Panel
166 *****************************************************************
169 typedef struct IconPanel
{
184 WMTextField
*fileField
;
187 WMButton
*cancelButton
;
189 WMButton
*chooseButton
;
198 listPixmaps(WScreen
*scr
, WMList
*lPtr
, char *path
)
200 struct dirent
*dentry
;
202 char pbuf
[PATH_MAX
+16];
205 apath
= wexpandpath(path
);
206 dir
= opendir(apath
);
211 tmp
= _("Could not open directory ");
212 msg
= wmalloc(strlen(tmp
)+strlen(path
)+6);
216 wMessageDialog(scr
, _("Error"), msg
, _("OK"), NULL
, NULL
);
222 /* list contents in the column */
223 while ((dentry
= readdir(dir
))) {
226 if (strcmp(dentry
->d_name
, ".")==0 ||
227 strcmp(dentry
->d_name
, "..")==0)
232 strcat(pbuf
, dentry
->d_name
);
234 if (stat(pbuf
, &statb
)<0)
237 if (statb
.st_mode
& (S_IRUSR
|S_IRGRP
|S_IROTH
)
238 && statb
.st_mode
& (S_IFREG
|S_IFLNK
)) {
239 WMAddSortedListItem(lPtr
, dentry
->d_name
);
250 setViewedImage(IconPanel
*panel
, char *file
)
259 pixmap
= WMCreateBlendedPixmapFromFile(WMWidgetScreen(panel
->win
),
265 WMSetButtonEnabled(panel
->okButton
, False
);
267 tmp
= _("Could not load image file ");
268 msg
= wmalloc(strlen(tmp
)+strlen(file
)+6);
272 wMessageDialog(panel
->scr
, _("Error"), msg
, _("OK"), NULL
, NULL
);
275 WMSetLabelImage(panel
->iconView
, NULL
);
277 WMSetButtonEnabled(panel
->okButton
, True
);
279 WMSetLabelImage(panel
->iconView
, pixmap
);
280 WMReleasePixmap(pixmap
);
286 listCallback(void *self
, void *data
)
288 WMList
*lPtr
= (WMList
*)self
;
289 IconPanel
*panel
= (IconPanel
*)data
;
292 if (lPtr
==panel
->dirList
) {
293 path
= WMGetListSelectedItem(lPtr
)->text
;
295 WMSetTextFieldText(panel
->fileField
, path
);
297 WMSetLabelImage(panel
->iconView
, NULL
);
299 WMSetButtonEnabled(panel
->okButton
, False
);
301 WMClearList(panel
->iconList
);
302 listPixmaps(panel
->scr
, panel
->iconList
, path
);
304 char *tmp
, *iconFile
;
306 path
= WMGetListSelectedItem(panel
->dirList
)->text
;
307 tmp
= wexpandpath(path
);
309 iconFile
= WMGetListSelectedItem(panel
->iconList
)->text
;
311 path
= wmalloc(strlen(tmp
)+strlen(iconFile
)+4);
314 strcat(path
, iconFile
);
316 WMSetTextFieldText(panel
->fileField
, path
);
317 setViewedImage(panel
, path
);
324 listIconPaths(WMList
*lPtr
)
329 paths
= wstrdup(wPreferences
.icon_path
);
331 path
= strtok(paths
, ":");
336 tmp
= wexpandpath(path
);
337 /* do not sort, because the order implies the order of
338 * directories searched */
339 if (access(tmp
, X_OK
)==0)
340 WMAddListItem(lPtr
, tmp
);
342 } while ((path
=strtok(NULL
, ":"))!=NULL
);
350 buttonCallback(void *self
, void *clientData
)
352 WMButton
*bPtr
= (WMButton
*)self
;
353 IconPanel
*panel
= (IconPanel
*)clientData
;
356 if (bPtr
==panel
->okButton
) {
358 panel
->result
= True
;
359 } else if (bPtr
==panel
->cancelButton
) {
361 panel
->result
= False
;
364 else if (bPtr
==panel
->chooseButton
) {
367 op
= WMCreateOpenPanel(WMWidgetScreen(bPtr
));
369 if (WMRunModalOpenPanelForDirectory(op
, NULL
, "/usr/local", NULL
, NULL
)) {
371 path
= WMGetFilePanelFile(op
);
372 WMSetTextFieldText(panel
->fileField
, path
);
373 setViewedImage(panel
, path
);
376 WMDestroyFilePanel(op
);
383 wIconChooserDialog(WScreen
*scr
, char **file
, char *instance
, char *class)
391 panel
= wmalloc(sizeof(IconPanel
));
392 memset(panel
, 0, sizeof(IconPanel
));
396 panel
->win
= WMCreateWindow(scr
->wmscreen
, "iconChooser");
397 WMResizeWidget(panel
->win
, 450, 280);
399 boldFont
= WMBoldSystemFontOfSize(scr
->wmscreen
, 12);
401 panel
->dirLabel
= WMCreateLabel(panel
->win
);
402 WMResizeWidget(panel
->dirLabel
, 200, 20);
403 WMMoveWidget(panel
->dirLabel
, 10, 7);
404 WMSetLabelText(panel
->dirLabel
, _("Directories"));
405 WMSetLabelFont(panel
->dirLabel
, boldFont
);
406 WMSetLabelTextAlignment(panel
->dirLabel
, WACenter
);
408 WMSetLabelRelief(panel
->dirLabel
, WRSunken
);
410 panel
->iconLabel
= WMCreateLabel(panel
->win
);
411 WMResizeWidget(panel
->iconLabel
, 140, 20);
412 WMMoveWidget(panel
->iconLabel
, 215, 7);
413 WMSetLabelText(panel
->iconLabel
, _("Icons"));
414 WMSetLabelFont(panel
->iconLabel
, boldFont
);
415 WMSetLabelTextAlignment(panel
->iconLabel
, WACenter
);
417 WMReleaseFont(boldFont
);
419 color
= WMWhiteColor(scr
->wmscreen
);
420 WMSetLabelTextColor(panel
->dirLabel
, color
);
421 WMSetLabelTextColor(panel
->iconLabel
, color
);
422 WMReleaseColor(color
);
424 color
= WMDarkGrayColor(scr
->wmscreen
);
425 WMSetWidgetBackgroundColor(panel
->iconLabel
, color
);
426 WMSetWidgetBackgroundColor(panel
->dirLabel
, color
);
427 WMReleaseColor(color
);
429 WMSetLabelRelief(panel
->iconLabel
, WRSunken
);
431 panel
->dirList
= WMCreateList(panel
->win
);
432 WMResizeWidget(panel
->dirList
, 200, 170);
433 WMMoveWidget(panel
->dirList
, 10, 30);
434 WMSetListAction(panel
->dirList
, listCallback
, panel
);
436 panel
->iconList
= WMCreateList(panel
->win
);
437 WMResizeWidget(panel
->iconList
, 140, 170);
438 WMMoveWidget(panel
->iconList
, 215, 30);
439 WMSetListAction(panel
->iconList
, listCallback
, panel
);
441 panel
->iconView
= WMCreateLabel(panel
->win
);
442 WMResizeWidget(panel
->iconView
, 75, 75);
443 WMMoveWidget(panel
->iconView
, 365, 60);
444 WMSetLabelImagePosition(panel
->iconView
, WIPImageOnly
);
445 WMSetLabelRelief(panel
->iconView
, WRSunken
);
447 panel
->fileLabel
= WMCreateLabel(panel
->win
);
448 WMResizeWidget(panel
->fileLabel
, 80, 20);
449 WMMoveWidget(panel
->fileLabel
, 10, 210);
450 WMSetLabelText(panel
->fileLabel
, _("File Name:"));
452 panel
->fileField
= WMCreateTextField(panel
->win
);
453 WMResizeWidget(panel
->fileField
, 345, 20);
454 WMMoveWidget(panel
->fileField
, 95, 210);
455 WMSetTextFieldEnabled(panel
->fileField
, False
);
457 panel
->okButton
= WMCreateCommandButton(panel
->win
);
458 WMResizeWidget(panel
->okButton
, 80, 26);
459 WMMoveWidget(panel
->okButton
, 360, 240);
460 WMSetButtonText(panel
->okButton
, _("OK"));
461 WMSetButtonEnabled(panel
->okButton
, False
);
462 WMSetButtonAction(panel
->okButton
, buttonCallback
, panel
);
464 panel
->cancelButton
= WMCreateCommandButton(panel
->win
);
465 WMResizeWidget(panel
->cancelButton
, 80, 26);
466 WMMoveWidget(panel
->cancelButton
, 270, 240);
467 WMSetButtonText(panel
->cancelButton
, _("Cancel"));
468 WMSetButtonAction(panel
->cancelButton
, buttonCallback
, panel
);
470 panel
->chooseButton
= WMCreateCommandButton(panel
->win
);
471 WMResizeWidget(panel
->chooseButton
, 110, 26);
472 WMMoveWidget(panel
->chooseButton
, 150, 240);
473 WMSetButtonText(panel
->chooseButton
, _("Choose File"));
474 WMSetButtonAction(panel
->chooseButton
, buttonCallback
, panel
);
476 WMRealizeWidget(panel
->win
);
477 WMMapSubwidgets(panel
->win
);
479 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 450, 280, 0, 0, 0);
481 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
486 tmp
= malloc((instance
? strlen(instance
) : 0)
487 + (class ? strlen(class) : 0) + 32);
489 if (tmp
&& (instance
|| class))
490 sprintf(tmp
, "%s [%s.%s]", _("Icon Chooser"), instance
, class);
492 tmp
= _("Icon Chooser");
494 wwin
= wManageInternalWindow(scr
, parent
, None
, tmp
,
495 (scr
->scr_width
- 450)/2,
496 (scr
->scr_height
- 280)/2, 450, 280);
500 /* put icon paths in the list */
501 listIconPaths(panel
->dirList
);
503 WMMapWidget(panel
->win
);
507 while (!panel
->done
) {
510 WMNextEvent(dpy
, &event
);
511 WMHandleEvent(&event
);
515 char *defaultPath
, *wantedPath
;
517 /* check if the file the user selected is not the one that
518 * would be loaded by default with the current search path */
519 *file
= WMGetListSelectedItem(panel
->iconList
)->text
;
524 defaultPath
= FindImage(wPreferences
.icon_path
, *file
);
525 wantedPath
= WMGetTextFieldText(panel
->fileField
);
526 /* if the file is not the default, use full path */
527 if (strcmp(wantedPath
, defaultPath
)!=0) {
530 *file
= wstrdup(*file
);
539 WMUnmapWidget(panel
->win
);
541 WMDestroyWidget(panel
->win
);
543 wUnmanageWindow(wwin
, False
, False
);
547 XDestroyWindow(dpy
, parent
);
549 return panel
->result
;
554 ***********************************************************************
556 ***********************************************************************
590 #define COPYRIGHT_TEXT \
591 "Copyright \xa9 1997~1999 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
592 "Copyright \xa9 1998,1999 Dan Pascu <dan@windowmaker.org>"
596 static InfoPanel
*thePanel
= NULL
;
599 destroyInfoPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
602 if (thePanel
->timer
) {
603 WMDeleteTimerHandler(thePanel
->timer
);
605 if (thePanel
->oldPix
) {
606 WMReleasePixmap(thePanel
->oldPix
);
608 if (thePanel
->icon
) {
609 RDestroyImage(thePanel
->icon
);
612 RDestroyImage(thePanel
->pic
);
614 #endif /* SILLYNESS */
615 WMUnmapWidget(thePanel
);
617 WMDestroyWidget(thePanel
->win
);
619 wUnmanageWindow(thePanel
->wwin
, False
, False
);
628 renderText(WMScreen
*scr
, char *text
, char *font
, RColor
*from
, RColor
*to
)
630 WMPixmap
*wpix
= NULL
;
633 RContext
*rc
= WMScreenRContext(scr
);
634 XFontStruct
*f
= NULL
;
638 f
= XLoadQueryFont(dpy
, font
);
642 w
= XTextWidth(f
, text
, strlen(text
));
643 h
= f
->ascent
+f
->descent
;
645 mask
= XCreatePixmap(dpy
, rc
->drawable
, w
, h
, 1);
646 gc
= XCreateGC(dpy
, mask
, 0, NULL
);
647 XSetForeground(dpy
, gc
, 0);
648 XSetFont(dpy
, gc
, f
->fid
);
649 XFillRectangle(dpy
, mask
, gc
, 0, 0, w
, h
);
651 XSetForeground(dpy
, gc
, 1);
652 XDrawString(dpy
, mask
, gc
, 0, f
->ascent
, text
, strlen(text
));
653 XSetLineAttributes(dpy
, gc
, 3, LineSolid
, CapRound
, JoinMiter
);
654 XDrawLine(dpy
, mask
, gc
, 0, h
-2, w
, h
-2);
656 grad
= XCreatePixmap(dpy
, rc
->drawable
, w
, h
, rc
->depth
);
660 color
= WMBlackColor(scr
);
661 XFillRectangle(dpy
, grad
, WMColorGC(color
), 0, 0, w
, h
);
662 WMReleaseColor(color
);
665 wpix
= WMCreatePixmapFromXPixmaps(scr
, grad
, mask
, w
, h
, rc
->depth
);
676 extern WMPixmap
*DoXThing();
677 extern Bool
InitXThing();
680 logoPushCallback(void *data
)
682 InfoPanel
*panel
= (InfoPanel
*)data
;
688 if (!(panel
->cycle
% 4)) {
691 p
= DoXThing(panel
->wwin
);
692 WMSetLabelImage(panel
->logoL
, p
);
694 } else if (panel
->cycle
< 30) {
698 image
= RCloneImage(panel
->icon
);
699 RCombineImagesWithOpaqueness(image
, panel
->pic
, panel
->cycle
*255/30);
700 pix
= WMCreatePixmapFromRImage(panel
->scr
->wmscreen
, image
, 128);
701 RDestroyImage(image
);
702 WMSetLabelImage(panel
->logoL
, pix
);
703 WMReleasePixmap(pix
);
706 i
= panel
->cycle
%200;
708 len
= strlen(panel
->str
);
710 strncpy(buffer
, panel
->str
, i
<len
? i
: len
);
712 memset(&buffer
[len
], ' ', i
-len
);
714 strncpy(buffer
, panel
->str
, i
<len
? i
: len
);
716 memset(&buffer
[len
], ' ', i
-len
);
718 WMSetLabelText(panel
->versionL
, buffer
);
720 panel
->timer
= WMAddTimerHandler(50, logoPushCallback
, panel
);
726 handleLogoPush(XEvent
*event
, void *data
)
728 InfoPanel
*panel
= (InfoPanel
*)data
;
729 static int broken
= 0;
730 static int clicks
= 0;
731 static char *pic_data
[] = {
791 " ....XoO+@##+O$%.... ",
792 " ...%X&*========-;;:o... ",
793 " ...>.>,<122222222222134@... ",
794 " ..>5678912222222222222220q%.. ",
795 " ..$.&-w2222222222222222222er>.. ",
796 " ..O.t31222222222222222222222y4>.. ",
797 " ...O5u3222222222222222222222222yri... ",
798 " ..>p&a22222222222222222222222222wso.. ",
799 " ..ids91222222222222222222222222222wfi.. ",
800 " ..X.7w222222wgs-w2222222213=g0222222<hi.. ",
801 " ..Xuj2222222<@X5=222222229k@l:022222y4i.. ",
802 " .Xdz22222222*X%.s22222222axo%$-222222<c>.. ",
803 " ..o7y22222222v...r222222223hX.i82222221si.. ",
804 "..io*222222222&...u22222222yt..%*22222220:%. ",
805 "..>k02222222227...f222222222v..X=222222229t. ",
806 "..dz12222222220ui:y2222222223d%qw222222221g. ",
807 ".%vw222222222221y2222222222219*y2222222222wd.",
808 ".X;2222222222222222222222222222222222222222b.",
809 ".i*2222222222222222222222222222222222222222v.",
810 ".i*2222222222222222222222222222222222222222;.",
811 ".i*22222222222222222222222222222222222222228.",
812 ".>*2222222222222222222222222222222222222222=.",
813 ".i*22222222222222222222222222222222222222228.",
814 ".i*2222222222222222222222222222222222222222;.",
815 ".X*222222222222222222222222222222we12222222r.",
816 ".Xs12222222w3aw22222222222222222y8s0222222wk.",
817 ".Xq02222222a,na22222222222222222zm6zwy2222gi.",
818 "..>*22222y<:Xcj22222222222222222-o$k;;02228..",
819 "..i7y2220rhX.:y22222222222222222jtiXd,a220,..",
820 " .X@z222a,do%kj2222222222222222wMX5q;gw228%..",
821 " ..58222wagsh6ry222222222222221;>Of0w222y:...",
822 " ...:e2222218mdz22222222222222a&$vw222220@...",
823 " ...O-122222y:.u02222222222229q$uj222221r... ",
824 " ..%&a1222223&573w2222222219NOxz122221z>... ",
825 " ...t3222221-l$nr8ay1222yzbo,=12222w-5... ",
826 " ..X:022222w-k+>o,7s**s7xOn=12221<f5... ",
827 " ..o:9222221j8:&Bl>>>>ihv<12221=dX... ",
828 " ..Xb9122222109g-****;<y22221zn%... ",
829 " ..X&801222222222222222222w-h.... ",
830 " ...o:=022222222222222221=lX... ",
831 " ..X@:;3w2222222222210fO... ",
832 " ...XX&v8<30000003-N@... ",
833 " .....XmnbN:q&Bo.... ",
835 static char *msgs
[] = {
836 "Sloppy focus is a *?#@",
837 "Repent! Sloppy focus users will burn in hell!!!",
842 if (!panel
->timer
&& !broken
&& clicks
> 2) {
849 file
= wDefaultGetIconFile(panel
->scr
, "Logo", "WMPanel", False
);
855 path
= FindImage(wPreferences
.icon_path
, file
);
861 panel
->icon
= RLoadImage(panel
->scr
->rcontext
, path
, 0);
869 panel
->pic
= RGetImageFromXPMData(panel
->scr
->rcontext
, pic_data
);
870 if (!panel
->pic
|| panel
->icon
->width
!=panel
->pic
->width
871 || panel
->icon
->height
!=panel
->pic
->height
) {
873 RDestroyImage(panel
->icon
);
876 RDestroyImage(panel
->pic
);
888 RCombineImageWithColor(panel
->icon
, &color
);
889 RCombineImageWithColor(panel
->pic
, &color
);
893 panel
->str
= msgs
[rand()%(sizeof(msgs
)/sizeof(char*))];
895 panel
->timer
= WMAddTimerHandler(50, logoPushCallback
, panel
);
897 panel
->oldPix
= WMRetainPixmap(WMGetLabelImage(panel
->logoL
));
898 } else if (panel
->timer
) {
903 WMSetLabelImage(panel
->logoL
, panel
->oldPix
);
904 WMReleasePixmap(panel
->oldPix
);
905 panel
->oldPix
= NULL
;
907 WMDeleteTimerHandler(panel
->timer
);
910 sprintf(version
, "Version %s", VERSION
);
911 WMSetLabelText(panel
->versionL
, version
);
916 while (XCheckTypedWindowEvent(dpy
, WMWidgetXID(panel
->versionL
),
920 #endif /* SILLYNESS */
924 wShowInfoPanel(WScreen
*scr
)
934 RColor color1
, color2
;
948 wRaiseFrame(thePanel
->wwin
->frame
->core
);
949 wSetFocusTo(scr
, thePanel
->wwin
);
953 panel
= wmalloc(sizeof(InfoPanel
));
954 memset(panel
, 0, sizeof(InfoPanel
));
958 panel
->win
= WMCreateWindow(scr
->wmscreen
, "info");
959 WMResizeWidget(panel
->win
, 382, 230);
961 logo
= WMGetApplicationIconImage(scr
->wmscreen
);
963 size
= WMGetPixmapSize(logo
);
964 panel
->logoL
= WMCreateLabel(panel
->win
);
965 WMResizeWidget(panel
->logoL
, 64, 64);
966 WMMoveWidget(panel
->logoL
, 30, 20);
967 WMSetLabelImagePosition(panel
->logoL
, WIPImageOnly
);
968 WMSetLabelImage(panel
->logoL
, logo
);
970 WMCreateEventHandler(WMWidgetView(panel
->logoL
), ButtonPressMask
,
971 handleLogoPush
, panel
);
975 panel
->name1L
= WMCreateLabel(panel
->win
);
976 WMResizeWidget(panel
->name1L
, 200, 30);
977 WMMoveWidget(panel
->name1L
, 120, 30);
984 logo
= renderText(scr
->wmscreen
, " Window Maker ",
985 "-*-times-bold-r-*-*-24-*", &color1
, &color2
);
987 WMSetLabelImagePosition(panel
->name1L
, WIPImageOnly
);
988 WMSetLabelImage(panel
->name1L
, logo
);
989 WMReleasePixmap(logo
);
991 font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 24);
993 WMSetLabelFont(panel
->name1L
, font
);
996 WMSetLabelText(panel
->name1L
, "Window Maker");
999 panel
->name2L
= WMCreateLabel(panel
->win
);
1000 WMResizeWidget(panel
->name2L
, 200, 24);
1001 WMMoveWidget(panel
->name2L
, 120, 60);
1002 font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 18);
1004 WMSetLabelFont(panel
->name2L
, font
);
1005 WMReleaseFont(font
);
1008 WMSetLabelText(panel
->name2L
, "X11 Window Manager");
1011 sprintf(version
, "Version %s", VERSION
);
1012 panel
->versionL
= WMCreateLabel(panel
->win
);
1013 WMResizeWidget(panel
->versionL
, 310, 16);
1014 WMMoveWidget(panel
->versionL
, 30, 95);
1015 WMSetLabelTextAlignment(panel
->versionL
, WARight
);
1016 WMSetLabelText(panel
->versionL
, version
);
1017 WMSetLabelWraps(panel
->versionL
, False
);
1019 panel
->copyrL
= WMCreateLabel(panel
->win
);
1020 WMResizeWidget(panel
->copyrL
, 340, 40);
1021 WMMoveWidget(panel
->copyrL
, 15, 185);
1022 WMSetLabelTextAlignment(panel
->copyrL
, WALeft
);
1023 WMSetLabelText(panel
->copyrL
, COPYRIGHT_TEXT
);
1024 /* we want the (c) character in the helvetica font */
1025 font
= WMCreateFontInDefaultEncoding(scr
->wmscreen
, HELVETICA10_FONT
);
1027 WMSetLabelFont(panel
->copyrL
, font
);
1030 switch (scr
->w_depth
) {
1032 strcpy(version
, "32 thousand");
1035 strcpy(version
, "64 thousand");
1039 strcpy(version
, "16 million");
1042 sprintf(version
, "%d", 1<<scr
->w_depth
);
1046 sprintf(buffer
, "Using visual 0x%x: %s %ibpp (%s colors)\n",
1047 (unsigned)scr
->w_visual
->visualid
,
1048 visuals
[scr
->w_visual
->class], scr
->w_depth
, version
);
1050 strcat(buffer
, "Supported image formats: ");
1051 strl
= RSupportedFileFormats();
1052 for (i
=0; strl
[i
]!=NULL
; i
++) {
1053 strcat(buffer
, strl
[i
]);
1054 strcat(buffer
, " ");
1057 strcat(buffer
, "\nAdditional Support For: ");
1070 list
[j
++] = "GNOME";
1076 list
[j
++] = "Sound";
1080 for (i
= 0; i
< j
; i
++) {
1083 strcat(buf
, " and ");
1087 strcat(buf
, list
[i
]);
1089 strcat(buffer
, buf
);
1093 panel
->infoL
= WMCreateLabel(panel
->win
);
1094 WMResizeWidget(panel
->infoL
, 350, 75);
1095 WMMoveWidget(panel
->infoL
, 15, 115);
1096 WMSetLabelText(panel
->infoL
, buffer
);
1098 WMSetLabelFont(panel
->infoL
, font
);
1099 WMReleaseFont(font
);
1103 WMRealizeWidget(panel
->win
);
1104 WMMapSubwidgets(panel
->win
);
1106 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 382, 230, 0, 0, 0);
1108 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1110 WMMapWidget(panel
->win
);
1112 wwin
= wManageInternalWindow(scr
, parent
, None
, "Info",
1113 (scr
->scr_width
- 382)/2,
1114 (scr
->scr_height
- 230)/2, 382, 230);
1116 WSETUFLAG(wwin
, no_closable
, 0);
1117 WSETUFLAG(wwin
, no_close_button
, 0);
1118 wWindowUpdateButtonImages(wwin
);
1119 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1120 wwin
->frame
->on_click_right
= destroyInfoPanel
;
1128 if (InitXThing(panel
->scr
)) {
1129 panel
->timer
= WMAddTimerHandler(100, logoPushCallback
, panel
);
1132 panel
->str
= "Merry X'mas!";
1133 panel
->oldPix
= WMRetainPixmap(WMGetLabelImage(panel
->logoL
));
1139 ***********************************************************************
1141 ***********************************************************************
1156 #define LICENSE_TEXT \
1157 " Window Maker is free software; you can redistribute it and/or modify "\
1158 "it under the terms of the GNU General Public License as published "\
1159 "by the Free Software Foundation; either version 2 of the License, "\
1160 "or (at your option) any later version.\n\n\n"\
1161 " Window Maker is distributed in the hope that it will be useful, but "\
1162 "WITHOUT ANY WARRANTY; without even the implied warranty of "\
1163 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "\
1164 "General Public License for more details.\n\n\n"\
1165 " You should have received a copy of the GNU General Public License "\
1166 "along with this program; if not, write to the Free Software "\
1167 "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA "\
1171 static LegalPanel
*legalPanel
= NULL
;
1174 destroyLegalPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
1176 WMUnmapWidget(legalPanel
->win
);
1178 WMDestroyWidget(legalPanel
->win
);
1180 wUnmanageWindow(legalPanel
->wwin
, False
, False
);
1189 wShowLegalPanel(WScreen
*scr
)
1196 wRaiseFrame(legalPanel
->wwin
->frame
->core
);
1197 wSetFocusTo(scr
, legalPanel
->wwin
);
1201 panel
= wmalloc(sizeof(LegalPanel
));
1205 panel
->win
= WMCreateWindow(scr
->wmscreen
, "legal");
1206 WMResizeWidget(panel
->win
, 420, 250);
1209 panel
->licenseL
= WMCreateLabel(panel
->win
);
1210 WMResizeWidget(panel
->licenseL
, 400, 230);
1211 WMMoveWidget(panel
->licenseL
, 10, 10);
1212 WMSetLabelTextAlignment(panel
->licenseL
, WALeft
);
1213 WMSetLabelText(panel
->licenseL
, LICENSE_TEXT
);
1214 WMSetLabelRelief(panel
->licenseL
, WRGroove
);
1216 WMRealizeWidget(panel
->win
);
1217 WMMapSubwidgets(panel
->win
);
1219 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 420, 250, 0, 0, 0);
1221 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1223 wwin
= wManageInternalWindow(scr
, parent
, None
, "Legal",
1224 (scr
->scr_width
- 420)/2,
1225 (scr
->scr_height
- 250)/2, 420, 250);
1227 WSETUFLAG(wwin
, no_closable
, 0);
1228 WSETUFLAG(wwin
, no_close_button
, 0);
1229 wWindowUpdateButtonImages(wwin
);
1230 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1231 wwin
->frame
->on_click_right
= destroyLegalPanel
;
1235 WMMapWidget(panel
->win
);