1 /* dialog.c - dialog windows for internal use
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
6 * Copyright (c) 1999 Dan Pascu
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
27 #include <X11/Xutil.h>
28 #include <X11/keysym.h>
34 #include <sys/types.h>
45 #include <sys/signal.h>
50 #define PATH_MAX DEFAULT_PATH_MAX
53 #include "WindowMaker.h"
65 extern WPreferences wPreferences
;
70 wMessageDialog(WScreen
*scr
, char *title
, char *message
,
71 char *defBtn
, char *altBtn
, char *othBtn
)
78 panel
= WMCreateAlertPanel(scr
->wmscreen
, NULL
, title
, message
,
79 defBtn
, altBtn
, othBtn
);
81 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 400, 180, 0, 0, 0);
83 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
85 wwin
= wManageInternalWindow(scr
, parent
, None
, NULL
,
86 (scr
->scr_width
- 400)/2,
87 (scr
->scr_height
- 180)/2, 400, 180);
88 wwin
->client_leader
= WMWidgetXID(panel
->win
);
90 WMMapWidget(panel
->win
);
94 WMRunModalLoop(WMWidgetScreen(panel
->win
), WMWidgetView(panel
->win
));
96 result
= panel
->result
;
98 WMUnmapWidget(panel
->win
);
100 wUnmanageWindow(wwin
, False
, False
);
102 WMDestroyAlertPanel(panel
);
104 XDestroyWindow(dpy
, parent
);
112 wInputDialog(WScreen
*scr
, char *title
, char *message
, char **text
)
120 panel
= WMCreateInputPanel(scr
->wmscreen
, NULL
, title
, message
, *text
,
121 _("OK"), _("Cancel"));
124 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 320, 160, 0, 0, 0);
125 XSelectInput(dpy
, parent
, KeyPressMask
|KeyReleaseMask
);
127 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
129 wwin
= wManageInternalWindow(scr
, parent
, None
, NULL
,
130 (scr
->scr_width
- 320)/2,
131 (scr
->scr_height
- 160)/2, 320, 160);
133 wwin
->client_leader
= WMWidgetXID(panel
->win
);
135 WMMapWidget(panel
->win
);
139 WMRunModalLoop(WMWidgetScreen(panel
->win
), WMWidgetView(panel
->win
));
141 if (panel
->result
== WAPRDefault
)
142 result
= WMGetTextFieldText(panel
->text
);
146 wUnmanageWindow(wwin
, False
, False
);
148 WMDestroyInputPanel(panel
);
150 XDestroyWindow(dpy
, parent
);
165 *****************************************************************
166 * Icon Selection Panel
167 *****************************************************************
170 typedef struct IconPanel
{
183 WMButton
*previewButton
;
188 WMTextField
*fileField
;
191 WMButton
*cancelButton
;
193 WMButton
*chooseButton
;
203 listPixmaps(WScreen
*scr
, WMList
*lPtr
, char *path
)
205 struct dirent
*dentry
;
207 char pbuf
[PATH_MAX
+16];
209 IconPanel
*panel
= WMGetHangedData(lPtr
);
211 panel
->preview
= False
;
213 apath
= wexpandpath(path
);
214 dir
= opendir(apath
);
219 tmp
= _("Could not open directory ");
220 msg
= wmalloc(strlen(tmp
)+strlen(path
)+6);
224 wMessageDialog(scr
, _("Error"), msg
, _("OK"), NULL
, NULL
);
230 /* list contents in the column */
231 while ((dentry
= readdir(dir
))) {
234 if (strcmp(dentry
->d_name
, ".")==0 ||
235 strcmp(dentry
->d_name
, "..")==0)
240 strcat(pbuf
, dentry
->d_name
);
242 if (stat(pbuf
, &statb
)<0)
245 if (statb
.st_mode
& (S_IRUSR
|S_IRGRP
|S_IROTH
)
246 && statb
.st_mode
& (S_IFREG
|S_IFLNK
)) {
247 WMAddListItem(lPtr
, dentry
->d_name
);
250 WMSortListItems(lPtr
);
254 panel
->preview
= True
;
260 setViewedImage(IconPanel
*panel
, char *file
)
269 pixmap
= WMCreateBlendedPixmapFromFile(WMWidgetScreen(panel
->win
),
272 WMSetButtonEnabled(panel
->okButton
, False
);
274 WMSetLabelText(panel
->iconView
, _("Could not load image file "));
276 WMSetLabelImage(panel
->iconView
, NULL
);
278 WMSetButtonEnabled(panel
->okButton
, True
);
280 WMSetLabelText(panel
->iconView
, NULL
);
281 WMSetLabelImage(panel
->iconView
, pixmap
);
282 WMReleasePixmap(pixmap
);
288 listCallback(void *self
, void *data
)
290 WMList
*lPtr
= (WMList
*)self
;
291 IconPanel
*panel
= (IconPanel
*)data
;
294 if (lPtr
==panel
->dirList
) {
295 path
= WMGetListSelectedItem(lPtr
)->text
;
297 WMSetTextFieldText(panel
->fileField
, path
);
299 WMSetLabelImage(panel
->iconView
, NULL
);
301 WMSetButtonEnabled(panel
->okButton
, False
);
303 WMClearList(panel
->iconList
);
304 listPixmaps(panel
->scr
, panel
->iconList
, path
);
306 char *tmp
, *iconFile
;
308 path
= WMGetListSelectedItem(panel
->dirList
)->text
;
309 tmp
= wexpandpath(path
);
311 iconFile
= WMGetListSelectedItem(panel
->iconList
)->text
;
313 path
= wmalloc(strlen(tmp
)+strlen(iconFile
)+4);
316 strcat(path
, iconFile
);
318 WMSetTextFieldText(panel
->fileField
, path
);
319 setViewedImage(panel
, path
);
326 listIconPaths(WMList
*lPtr
)
331 paths
= wstrdup(wPreferences
.icon_path
);
333 path
= strtok(paths
, ":");
338 tmp
= wexpandpath(path
);
339 /* do not sort, because the order implies the order of
340 * directories searched */
341 if (access(tmp
, X_OK
)==0)
342 WMAddListItem(lPtr
, path
);
344 } while ((path
=strtok(NULL
, ":"))!=NULL
);
351 drawIconProc(WMList
*lPtr
, int index
, Drawable d
, char *text
,
352 int state
, WMRect
*rect
)
354 IconPanel
*panel
= WMGetHangedData(lPtr
);
355 GC gc
= panel
->scr
->draw_gc
;
356 GC copygc
= panel
->scr
->copy_gc
;
357 char *buffer
, *dirfile
;
362 WMScreen
*wmscr
=WMWidgetScreen(panel
->win
);
365 if(!panel
->preview
) return;
367 width
= rect
->size
.width
;
369 blackcolor
= WMBlackColor(wmscr
);
370 whitecolor
= WMWhiteColor(wmscr
);
372 dirfile
= wexpandpath(WMGetListSelectedItem(panel
->dirList
)->text
);
373 buffer
= wmalloc(strlen(dirfile
)+strlen(text
)+4);
374 sprintf(buffer
, "%s/%s", dirfile
, text
);
377 pixmap
= WMCreatePixmapFromFile(WMWidgetScreen(panel
->win
), buffer
);
380 WMRemoveListItem(lPtr
, index
);
384 XClearArea(dpy
, d
, rect
->pos
.x
, rect
->pos
.y
, width
, rect
->size
.height
,
386 XSetClipMask(dpy
, gc
, None
);
388 XDrawRectangle(dpy, d, WMColorGC(whitecolor), rect->pos.x + 5,
389 rect->pos.y +5, width - 10, 54);
391 XDrawLine(dpy
, d
, WMColorGC(whitecolor
), rect
->pos
.x
,
392 rect
->pos
.y
+rect
->size
.height
-1, rect
->pos
.x
+width
,
393 rect
->pos
.y
+rect
->size
.height
-1);
396 if (state
&WLDSSelected
) {
397 XFillRectangle(dpy
, d
, WMColorGC(whitecolor
), rect
->pos
.x
,
398 rect
->pos
.y
, width
, rect
->size
.height
);
401 size
= WMGetPixmapSize(pixmap
);
403 XSetClipMask(dpy
, copygc
, WMGetPixmapMaskXID(pixmap
));
404 XSetClipOrigin(dpy
, copygc
, rect
->pos
.x
+ (width
-size
.width
)/2,
406 XCopyArea(dpy
, WMGetPixmapXID(pixmap
), d
, copygc
, 0, 0,
407 size
.width
>100?100:size
.width
, size
.height
>64?64:size
.height
,
408 rect
->pos
.x
+ (width
-size
.width
)/2, rect
->pos
.y
+2);
412 int fheight
= WMFontHeight(panel
->normalfont
);
413 int tlen
= strlen(text
);
414 int twidth
= WMWidthOfString(panel
->normalfont
, text
, tlen
);
417 ofx
= rect
->pos
.x
+ (width
- twidth
)/2;
418 ofy
= rect
->pos
.y
+ 64 - fheight
;
422 WMDrawString(wmscr
, d
, WMColorGC(whitecolor
),
423 panel
->normalfont
, ofx
+i
, ofy
+j
,
426 WMDrawString(wmscr
, d
, WMColorGC(blackcolor
), panel
->normalfont
,
427 ofx
, ofy
, text
, tlen
);
430 WMReleasePixmap(pixmap
);
431 /* I hope it is better to do not use cache / on my box it is fast nuff */
434 WMReleaseColor(blackcolor
);
435 WMReleaseColor(whitecolor
);
440 buttonCallback(void *self
, void *clientData
)
442 WMButton
*bPtr
= (WMButton
*)self
;
443 IconPanel
*panel
= (IconPanel
*)clientData
;
446 if (bPtr
==panel
->okButton
) {
448 panel
->result
= True
;
449 } else if (bPtr
==panel
->cancelButton
) {
451 panel
->result
= False
;
452 } else if (bPtr
==panel
->previewButton
) {
453 /**** Previewer ****/
454 WMSetButtonEnabled(bPtr
, False
);
455 WMSetListUserDrawItemHeight(panel
->iconList
, 68);
456 WMSetListUserDrawProc(panel
->iconList
, drawIconProc
);
457 WMRedisplayWidget(panel
->iconList
);
458 /* for draw proc to access screen/gc */
459 /*** end preview ***/
462 else if (bPtr
==panel
->chooseButton
) {
465 op
= WMCreateOpenPanel(WMWidgetScreen(bPtr
));
467 if (WMRunModalFilePanelForDirectory(op
, NULL
, "/usr/local", NULL
, NULL
)) {
469 path
= WMGetFilePanelFile(op
);
470 WMSetTextFieldText(panel
->fileField
, path
);
471 setViewedImage(panel
, path
);
474 WMDestroyFilePanel(op
);
481 wIconChooserDialog(WScreen
*scr
, char **file
, char *instance
, char *class)
489 panel
= wmalloc(sizeof(IconPanel
));
490 memset(panel
, 0, sizeof(IconPanel
));
494 panel
->win
= WMCreateWindow(scr
->wmscreen
, "iconChooser");
495 WMResizeWidget(panel
->win
, 450, 280);
497 boldFont
= WMBoldSystemFontOfSize(scr
->wmscreen
, 12);
498 panel
->normalfont
= WMSystemFontOfSize(WMWidgetScreen(panel
->win
), 12);
500 panel
->dirLabel
= WMCreateLabel(panel
->win
);
501 WMResizeWidget(panel
->dirLabel
, 200, 20);
502 WMMoveWidget(panel
->dirLabel
, 10, 7);
503 WMSetLabelText(panel
->dirLabel
, _("Directories"));
504 WMSetLabelFont(panel
->dirLabel
, boldFont
);
505 WMSetLabelTextAlignment(panel
->dirLabel
, WACenter
);
507 WMSetLabelRelief(panel
->dirLabel
, WRSunken
);
509 panel
->iconLabel
= WMCreateLabel(panel
->win
);
510 WMResizeWidget(panel
->iconLabel
, 140, 20);
511 WMMoveWidget(panel
->iconLabel
, 215, 7);
512 WMSetLabelText(panel
->iconLabel
, _("Icons"));
513 WMSetLabelFont(panel
->iconLabel
, boldFont
);
514 WMSetLabelTextAlignment(panel
->iconLabel
, WACenter
);
516 WMReleaseFont(boldFont
);
518 color
= WMWhiteColor(scr
->wmscreen
);
519 WMSetLabelTextColor(panel
->dirLabel
, color
);
520 WMSetLabelTextColor(panel
->iconLabel
, color
);
521 WMReleaseColor(color
);
523 color
= WMDarkGrayColor(scr
->wmscreen
);
524 WMSetWidgetBackgroundColor(panel
->iconLabel
, color
);
525 WMSetWidgetBackgroundColor(panel
->dirLabel
, color
);
526 WMReleaseColor(color
);
528 WMSetLabelRelief(panel
->iconLabel
, WRSunken
);
530 panel
->dirList
= WMCreateList(panel
->win
);
531 WMResizeWidget(panel
->dirList
, 200, 170);
532 WMMoveWidget(panel
->dirList
, 10, 30);
533 WMSetListAction(panel
->dirList
, listCallback
, panel
);
535 panel
->iconList
= WMCreateList(panel
->win
);
536 WMResizeWidget(panel
->iconList
, 140, 170);
537 WMMoveWidget(panel
->iconList
, 215, 30);
538 WMSetListAction(panel
->iconList
, listCallback
, panel
);
540 WMHangData(panel
->iconList
,panel
);
542 panel
->previewButton
= WMCreateCommandButton(panel
->win
);
543 WMResizeWidget(panel
->previewButton
, 75, 26);
544 WMMoveWidget(panel
->previewButton
, 365, 130);
545 WMSetButtonText(panel
->previewButton
, _("Preview"));
546 WMSetButtonAction(panel
->previewButton
, buttonCallback
, panel
);
548 panel
->iconView
= WMCreateLabel(panel
->win
);
549 WMResizeWidget(panel
->iconView
, 75, 75);
550 WMMoveWidget(panel
->iconView
, 365, 40);
551 WMSetLabelImagePosition(panel
->iconView
, WIPOverlaps
);
552 WMSetLabelRelief(panel
->iconView
, WRSunken
);
553 WMSetLabelTextAlignment(panel
->iconView
, WACenter
);
555 panel
->fileLabel
= WMCreateLabel(panel
->win
);
556 WMResizeWidget(panel
->fileLabel
, 80, 20);
557 WMMoveWidget(panel
->fileLabel
, 10, 210);
558 WMSetLabelText(panel
->fileLabel
, _("File Name:"));
560 panel
->fileField
= WMCreateTextField(panel
->win
);
561 WMResizeWidget(panel
->fileField
, 345, 20);
562 WMMoveWidget(panel
->fileField
, 95, 210);
563 WMSetTextFieldEditable(panel
->fileField
, False
);
565 panel
->okButton
= WMCreateCommandButton(panel
->win
);
566 WMResizeWidget(panel
->okButton
, 80, 26);
567 WMMoveWidget(panel
->okButton
, 360, 240);
568 WMSetButtonText(panel
->okButton
, _("OK"));
569 WMSetButtonEnabled(panel
->okButton
, False
);
570 WMSetButtonAction(panel
->okButton
, buttonCallback
, panel
);
572 panel
->cancelButton
= WMCreateCommandButton(panel
->win
);
573 WMResizeWidget(panel
->cancelButton
, 80, 26);
574 WMMoveWidget(panel
->cancelButton
, 270, 240);
575 WMSetButtonText(panel
->cancelButton
, _("Cancel"));
576 WMSetButtonAction(panel
->cancelButton
, buttonCallback
, panel
);
578 panel
->chooseButton
= WMCreateCommandButton(panel
->win
);
579 WMResizeWidget(panel
->chooseButton
, 110, 26);
580 WMMoveWidget(panel
->chooseButton
, 150, 240);
581 WMSetButtonText(panel
->chooseButton
, _("Choose File"));
582 WMSetButtonAction(panel
->chooseButton
, buttonCallback
, panel
);
584 WMRealizeWidget(panel
->win
);
585 WMMapSubwidgets(panel
->win
);
587 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 450, 280, 0, 0, 0);
589 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
594 tmp
= wmalloc((instance
? strlen(instance
) : 0)
595 + (class ? strlen(class) : 0) + 32);
597 if (tmp
&& (instance
|| class))
598 sprintf(tmp
, "%s [%s.%s]", _("Icon Chooser"), instance
, class);
600 strcpy(tmp
, _("Icon Chooser"));
602 wwin
= wManageInternalWindow(scr
, parent
, None
, tmp
,
603 (scr
->scr_width
- 450)/2,
604 (scr
->scr_height
- 280)/2, 450, 280);
608 /* put icon paths in the list */
609 listIconPaths(panel
->dirList
);
611 WMMapWidget(panel
->win
);
615 while (!panel
->done
) {
618 WMNextEvent(dpy
, &event
);
619 WMHandleEvent(&event
);
623 char *defaultPath
, *wantedPath
;
625 /* check if the file the user selected is not the one that
626 * would be loaded by default with the current search path */
627 *file
= WMGetListSelectedItem(panel
->iconList
)->text
;
632 defaultPath
= FindImage(wPreferences
.icon_path
, *file
);
633 wantedPath
= WMGetTextFieldText(panel
->fileField
);
634 /* if the file is not the default, use full path */
635 if (strcmp(wantedPath
, defaultPath
)!=0) {
638 *file
= wstrdup(*file
);
647 WMReleaseFont(panel
->normalfont
);
649 WMUnmapWidget(panel
->win
);
651 WMDestroyWidget(panel
->win
);
653 wUnmanageWindow(wwin
, False
, False
);
657 XDestroyWindow(dpy
, parent
);
659 return panel
->result
;
664 ***********************************************************************
666 ***********************************************************************
700 #define COPYRIGHT_TEXT \
701 "Copyright \xa9 1997~2001 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
702 "Copyright \xa9 1998~2001 Dan Pascu <dan@windowmaker.org>"
706 static InfoPanel
*thePanel
= NULL
;
709 destroyInfoPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
712 if (thePanel
->timer
) {
713 WMDeleteTimerHandler(thePanel
->timer
);
715 if (thePanel
->oldPix
) {
716 WMReleasePixmap(thePanel
->oldPix
);
718 if (thePanel
->icon
) {
719 RDestroyImage(thePanel
->icon
);
722 RDestroyImage(thePanel
->pic
);
724 #endif /* SILLYNESS */
725 WMUnmapWidget(thePanel
);
727 wUnmanageWindow(thePanel
->wwin
, False
, False
);
729 WMDestroyWidget(thePanel
->win
);
738 renderText(WMScreen
*scr
, char *text
, char *font
, RColor
*from
, RColor
*to
)
740 WMPixmap
*wpix
= NULL
;
743 RContext
*rc
= WMScreenRContext(scr
);
744 XFontStruct
*f
= NULL
;
748 f
= XLoadQueryFont(dpy
, font
);
752 w
= XTextWidth(f
, text
, strlen(text
));
753 h
= f
->ascent
+f
->descent
;
755 mask
= XCreatePixmap(dpy
, rc
->drawable
, w
, h
, 1);
756 gc
= XCreateGC(dpy
, mask
, 0, NULL
);
757 XSetForeground(dpy
, gc
, 0);
758 XSetFont(dpy
, gc
, f
->fid
);
759 XFillRectangle(dpy
, mask
, gc
, 0, 0, w
, h
);
761 XSetForeground(dpy
, gc
, 1);
762 XDrawString(dpy
, mask
, gc
, 0, f
->ascent
, text
, strlen(text
));
763 XSetLineAttributes(dpy
, gc
, 3, LineSolid
, CapRound
, JoinMiter
);
764 XDrawLine(dpy
, mask
, gc
, 0, h
-2, w
, h
-2);
766 grad
= XCreatePixmap(dpy
, rc
->drawable
, w
, h
, rc
->depth
);
770 color
= WMBlackColor(scr
);
771 XFillRectangle(dpy
, grad
, WMColorGC(color
), 0, 0, w
, h
);
772 WMReleaseColor(color
);
775 wpix
= WMCreatePixmapFromXPixmaps(scr
, grad
, mask
, w
, h
, rc
->depth
);
786 extern WMPixmap
*DoXThing();
787 extern Bool
InitXThing();
790 logoPushCallback(void *data
)
792 InfoPanel
*panel
= (InfoPanel
*)data
;
796 static int jingobeu
[] = {
797 329, 150, -1, 100, 329, 150, -1, 100, 329, 300, -1, 250,
798 329, 150, -1, 100, 329, 150, -1, 100, 329, 300, -1, 250,
799 329, 150, 392, 150, 261, 150, 293, 150, 329, 400, -1, 400, 0
807 if(jingobeu
[panel
->x
-1]==0){panel
->x
=-1;}else if(jingobeu
[panel
->x
808 -1]<0){panel
->x
++;c
=jingobeu
[panel
->x
-1]/50;panel
->x
++;}else if(c
==0){
809 kc
.bell_pitch
=jingobeu
[panel
->x
-1];panel
->x
++;kc
.bell_percent
=50;c
=
810 jingobeu
[panel
->x
-1]/50;kc
.bell_duration
=jingobeu
[panel
->x
-1];panel
->x
++;
811 XChangeKeyboardControl(dpy
,KBBellPitch
|KBBellDuration
|KBBellPercent
,&kc
);
812 XBell(dpy
,50);XFlush(dpy
);}else{c
--;}}
813 if (!(panel
->cycle
% 4)) {
816 p
= DoXThing(panel
->wwin
);
817 WMSetLabelImage(panel
->logoL
, p
);
819 } else if (panel
->cycle
< 30) {
823 image
= RCloneImage(panel
->icon
);
824 RCombineImagesWithOpaqueness(image
, panel
->pic
, panel
->cycle
*255/30);
825 pix
= WMCreatePixmapFromRImage(panel
->scr
->wmscreen
, image
, 128);
826 RDestroyImage(image
);
827 WMSetLabelImage(panel
->logoL
, pix
);
828 WMReleasePixmap(pix
);
831 i
= panel
->cycle
%200;
833 len
= strlen(panel
->str
);
835 strncpy(buffer
, panel
->str
, i
<len
? i
: len
);
837 memset(&buffer
[len
], ' ', i
-len
);
839 strncpy(buffer
, panel
->str
, i
<len
? i
: len
);
841 memset(&buffer
[len
], ' ', i
-len
);
843 WMSetLabelText(panel
->versionL
, buffer
);
845 panel
->timer
= WMAddTimerHandler(50, logoPushCallback
, panel
);
851 handleLogoPush(XEvent
*event
, void *data
)
853 InfoPanel
*panel
= (InfoPanel
*)data
;
854 static int broken
= 0;
855 static int clicks
= 0;
856 static char *pic_data
[] = {
916 " ....XoO+@##+O$%.... ",
917 " ...%X&*========-;;:o... ",
918 " ...>.>,<122222222222134@... ",
919 " ..>5678912222222222222220q%.. ",
920 " ..$.&-w2222222222222222222er>.. ",
921 " ..O.t31222222222222222222222y4>.. ",
922 " ...O5u3222222222222222222222222yri... ",
923 " ..>p&a22222222222222222222222222wso.. ",
924 " ..ids91222222222222222222222222222wfi.. ",
925 " ..X.7w222222wgs-w2222222213=g0222222<hi.. ",
926 " ..Xuj2222222<@X5=222222229k@l:022222y4i.. ",
927 " .Xdz22222222*X%.s22222222axo%$-222222<c>.. ",
928 " ..o7y22222222v...r222222223hX.i82222221si.. ",
929 "..io*222222222&...u22222222yt..%*22222220:%. ",
930 "..>k02222222227...f222222222v..X=222222229t. ",
931 "..dz12222222220ui:y2222222223d%qw222222221g. ",
932 ".%vw222222222221y2222222222219*y2222222222wd.",
933 ".X;2222222222222222222222222222222222222222b.",
934 ".i*2222222222222222222222222222222222222222v.",
935 ".i*2222222222222222222222222222222222222222;.",
936 ".i*22222222222222222222222222222222222222228.",
937 ".>*2222222222222222222222222222222222222222=.",
938 ".i*22222222222222222222222222222222222222228.",
939 ".i*2222222222222222222222222222222222222222;.",
940 ".X*222222222222222222222222222222we12222222r.",
941 ".Xs12222222w3aw22222222222222222y8s0222222wk.",
942 ".Xq02222222a,na22222222222222222zm6zwy2222gi.",
943 "..>*22222y<:Xcj22222222222222222-o$k;;02228..",
944 "..i7y2220rhX.:y22222222222222222jtiXd,a220,..",
945 " .X@z222a,do%kj2222222222222222wMX5q;gw228%..",
946 " ..58222wagsh6ry222222222222221;>Of0w222y:...",
947 " ...:e2222218mdz22222222222222a&$vw222220@...",
948 " ...O-122222y:.u02222222222229q$uj222221r... ",
949 " ..%&a1222223&573w2222222219NOxz122221z>... ",
950 " ...t3222221-l$nr8ay1222yzbo,=12222w-5... ",
951 " ..X:022222w-k+>o,7s**s7xOn=12221<f5... ",
952 " ..o:9222221j8:&Bl>>>>ihv<12221=dX... ",
953 " ..Xb9122222109g-****;<y22221zn%... ",
954 " ..X&801222222222222222222w-h.... ",
955 " ...o:=022222222222222221=lX... ",
956 " ..X@:;3w2222222222210fO... ",
957 " ...XX&v8<30000003-N@... ",
958 " .....XmnbN:q&Bo.... ",
960 static char *msgs
[] = {
962 "Focus follow mouse users will burn in hell!!!",
964 "F'ck Bastard Imperialists!!!",
965 "Hi! My name is bobby...",
966 "AHH! The neurotic monkeys are after me!"
972 if (!panel
->timer
&& !broken
&& clicks
> 0) {
979 file
= wDefaultGetIconFile(panel
->scr
, "Logo", "WMPanel", False
);
985 path
= FindImage(wPreferences
.icon_path
, file
);
991 panel
->icon
= RLoadImage(panel
->scr
->rcontext
, path
, 0);
999 panel
->pic
= RGetImageFromXPMData(panel
->scr
->rcontext
, pic_data
);
1000 if (!panel
->pic
|| panel
->icon
->width
!=panel
->pic
->width
1001 || panel
->icon
->height
!=panel
->pic
->height
) {
1003 RDestroyImage(panel
->icon
);
1006 RDestroyImage(panel
->pic
);
1018 RCombineImageWithColor(panel
->icon
, &color
);
1019 RCombineImageWithColor(panel
->pic
, &color
);
1023 panel
->str
= msgs
[rand()%(sizeof(msgs
)/sizeof(char*))];
1025 panel
->timer
= WMAddTimerHandler(50, logoPushCallback
, panel
);
1027 panel
->oldPix
= WMRetainPixmap(WMGetLabelImage(panel
->logoL
));
1028 } else if (panel
->timer
) {
1033 WMSetLabelImage(panel
->logoL
, panel
->oldPix
);
1034 WMReleasePixmap(panel
->oldPix
);
1035 panel
->oldPix
= NULL
;
1037 WMDeleteTimerHandler(panel
->timer
);
1038 panel
->timer
= NULL
;
1040 sprintf(version
, _("Version %s"), VERSION
);
1041 WMSetLabelText(panel
->versionL
, version
);
1046 while (XCheckTypedWindowEvent(dpy
, WMWidgetXID(panel
->versionL
),
1050 #endif /* SILLYNESS */
1054 wShowInfoPanel(WScreen
*scr
)
1064 RColor color1
, color2
;
1078 if (thePanel
->scr
== scr
) {
1079 wRaiseFrame(thePanel
->wwin
->frame
->core
);
1080 wSetFocusTo(scr
, thePanel
->wwin
);
1085 panel
= wmalloc(sizeof(InfoPanel
));
1086 memset(panel
, 0, sizeof(InfoPanel
));
1090 panel
->win
= WMCreateWindow(scr
->wmscreen
, "info");
1091 WMResizeWidget(panel
->win
, 382, 230);
1093 logo
= WMGetApplicationIconImage(scr
->wmscreen
);
1095 size
= WMGetPixmapSize(logo
);
1096 panel
->logoL
= WMCreateLabel(panel
->win
);
1097 WMResizeWidget(panel
->logoL
, 64, 64);
1098 WMMoveWidget(panel
->logoL
, 30, 20);
1099 WMSetLabelImagePosition(panel
->logoL
, WIPImageOnly
);
1100 WMSetLabelImage(panel
->logoL
, logo
);
1102 WMCreateEventHandler(WMWidgetView(panel
->logoL
), ButtonPressMask
,
1103 handleLogoPush
, panel
);
1107 panel
->name1L
= WMCreateLabel(panel
->win
);
1108 WMResizeWidget(panel
->name1L
, 240, 30);
1109 WMMoveWidget(panel
->name1L
, 100, 30);
1114 color2
.green
= 0x50;
1116 logo
= renderText(scr
->wmscreen
, "GNU Window Maker",
1117 "-*-utopia-*-r-*-*-25-*", &color1
, &color2
);
1119 WMSetLabelImagePosition(panel
->name1L
, WIPImageOnly
);
1120 WMSetLabelImage(panel
->name1L
, logo
);
1121 WMReleasePixmap(logo
);
1123 font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 20);
1125 WMSetLabelFont(panel
->name1L
, font
);
1126 WMReleaseFont(font
);
1128 WMSetLabelTextAlignment(panel
->name1L
, WACenter
);
1129 WMSetLabelText(panel
->name1L
, "GNU Window Maker");
1132 panel
->name2L
= WMCreateLabel(panel
->win
);
1133 WMResizeWidget(panel
->name2L
, 240, 24);
1134 WMMoveWidget(panel
->name2L
, 100, 60);
1135 font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 18);
1137 WMSetLabelFont(panel
->name2L
, font
);
1138 WMReleaseFont(font
);
1141 WMSetLabelTextAlignment(panel
->name2L
, WACenter
);
1142 WMSetLabelText(panel
->name2L
, _("Window Manager for X"));
1145 sprintf(version
, _("Version %s"), VERSION
);
1146 panel
->versionL
= WMCreateLabel(panel
->win
);
1147 WMResizeWidget(panel
->versionL
, 310, 16);
1148 WMMoveWidget(panel
->versionL
, 30, 95);
1149 WMSetLabelTextAlignment(panel
->versionL
, WARight
);
1150 WMSetLabelText(panel
->versionL
, version
);
1151 WMSetLabelWraps(panel
->versionL
, False
);
1153 panel
->copyrL
= WMCreateLabel(panel
->win
);
1154 WMResizeWidget(panel
->copyrL
, 340, 40);
1155 WMMoveWidget(panel
->copyrL
, 15, 185);
1156 WMSetLabelTextAlignment(panel
->copyrL
, WALeft
);
1157 WMSetLabelText(panel
->copyrL
, COPYRIGHT_TEXT
);
1158 /* we want the (c) character in the helvetica font */
1159 font
= WMCreateNormalFont(scr
->wmscreen
, HELVETICA10_FONT
);
1161 WMSetLabelFont(panel
->copyrL
, font
);
1164 switch (scr
->w_depth
) {
1166 strcpy(version
, _("32 thousand"));
1169 strcpy(version
, _("64 thousand"));
1173 strcpy(version
, _("16 million"));
1176 sprintf(version
, "%d", 1<<scr
->w_depth
);
1180 sprintf(buffer
, _("Using visual 0x%x: %s %ibpp (%s colors)\n"),
1181 (unsigned)scr
->w_visual
->visualid
,
1182 visuals
[scr
->w_visual
->class], scr
->w_depth
, version
);
1184 #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
1186 struct mallinfo ma
= mallinfo();
1187 sprintf(buffer
+strlen(buffer
),
1188 _("Total allocated memory: %i kB. Total memory in use: %i kB.\n"),
1189 (ma
.arena
+ma
.hblkhd
)/1024, (ma
.uordblks
+ma
.hblkhd
)/1024);
1194 strcat(buffer
, _("Supported image formats: "));
1195 strl
= RSupportedFileFormats();
1196 for (i
=0; strl
[i
]!=NULL
; i
++) {
1197 strcat(buffer
, strl
[i
]);
1198 strcat(buffer
, " ");
1201 strcat(buffer
, _("\nAdditional Support For: "));
1214 list
[j
++] = "GNOME";
1220 list
[j
++] = _("Sound");
1224 for (i
= 0; i
< j
; i
++) {
1227 strcat(buf
, _(" and "));
1231 strcat(buf
, list
[i
]);
1233 strcat(buffer
, buf
);
1237 panel
->infoL
= WMCreateLabel(panel
->win
);
1238 WMResizeWidget(panel
->infoL
, 350, 75);
1239 WMMoveWidget(panel
->infoL
, 15, 115);
1240 WMSetLabelText(panel
->infoL
, buffer
);
1242 WMSetLabelFont(panel
->infoL
, font
);
1243 WMReleaseFont(font
);
1247 WMRealizeWidget(panel
->win
);
1248 WMMapSubwidgets(panel
->win
);
1250 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 382, 230, 0, 0, 0);
1252 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1254 WMMapWidget(panel
->win
);
1256 wwin
= wManageInternalWindow(scr
, parent
, None
, _("Info"),
1257 (scr
->scr_width
- 382)/2,
1258 (scr
->scr_height
- 230)/2, 382, 230);
1260 WSETUFLAG(wwin
, no_closable
, 0);
1261 WSETUFLAG(wwin
, no_close_button
, 0);
1262 #ifdef XKB_BUTTON_HINT
1263 wFrameWindowHideButton(wwin
->frame
, WFF_LANGUAGE_BUTTON
);
1265 wWindowUpdateButtonImages(wwin
);
1266 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1267 wwin
->frame
->on_click_right
= destroyInfoPanel
;
1275 if (InitXThing(panel
->scr
)) {
1276 panel
->timer
= WMAddTimerHandler(100, logoPushCallback
, panel
);
1279 panel
->str
= _("Merry X'mas!");
1280 panel
->oldPix
= WMRetainPixmap(WMGetLabelImage(panel
->logoL
));
1287 ***********************************************************************
1289 ***********************************************************************
1303 static LegalPanel
*legalPanel
= NULL
;
1306 destroyLegalPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
1308 WMUnmapWidget(legalPanel
->win
);
1310 WMDestroyWidget(legalPanel
->win
);
1312 wUnmanageWindow(legalPanel
->wwin
, False
, False
);
1321 wShowLegalPanel(WScreen
*scr
)
1328 if (legalPanel
->scr
== scr
) {
1329 wRaiseFrame(legalPanel
->wwin
->frame
->core
);
1330 wSetFocusTo(scr
, legalPanel
->wwin
);
1335 panel
= wmalloc(sizeof(LegalPanel
));
1339 panel
->win
= WMCreateWindow(scr
->wmscreen
, "legal");
1340 WMResizeWidget(panel
->win
, 420, 250);
1343 panel
->licenseL
= WMCreateLabel(panel
->win
);
1344 WMSetLabelWraps(panel
->licenseL
, True
);
1345 WMResizeWidget(panel
->licenseL
, 400, 230);
1346 WMMoveWidget(panel
->licenseL
, 10, 10);
1347 WMSetLabelTextAlignment(panel
->licenseL
, WALeft
);
1348 WMSetLabelText(panel
->licenseL
,
1349 _(" Window Maker is free software; you can redistribute it and/or\n"
1350 "modify it under the terms of the GNU General Public License as\n"
1351 "published by the Free Software Foundation; either version 2 of the\n"
1352 "License, or (at your option) any later version.\n\n\n"
1353 " Window Maker is distributed in the hope that it will be useful,\n"
1354 "but WITHOUT ANY WARRANTY; without even the implied warranty\n"
1355 "of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
1356 "See the GNU General Public License for more details.\n\n\n"
1357 " You should have received a copy of the GNU General Public\n"
1358 "License along with this program; if not, write to the Free Software\n"
1359 "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n"
1360 "02111-1307, USA."));
1361 WMSetLabelRelief(panel
->licenseL
, WRGroove
);
1363 WMRealizeWidget(panel
->win
);
1364 WMMapSubwidgets(panel
->win
);
1366 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 420, 250, 0, 0, 0);
1368 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1370 wwin
= wManageInternalWindow(scr
, parent
, None
, _("Legal"),
1371 (scr
->scr_width
- 420)/2,
1372 (scr
->scr_height
- 250)/2, 420, 250);
1374 WSETUFLAG(wwin
, no_closable
, 0);
1375 WSETUFLAG(wwin
, no_close_button
, 0);
1376 wWindowUpdateButtonImages(wwin
);
1377 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1378 #ifdef XKB_BUTTON_HINT
1379 wFrameWindowHideButton(wwin
->frame
, WFF_LANGUAGE_BUTTON
);
1381 wwin
->frame
->on_click_right
= destroyLegalPanel
;
1385 WMMapWidget(panel
->win
);
1394 ***********************************************************************
1395 * Crashing Dialog Panel
1396 ***********************************************************************
1399 extern WDDomain
*WDWindowAttributes
;
1402 typedef struct _CrashPanel
{
1403 WMWindow
*win
; /* main window */
1405 WMLabel
*iconL
; /* application icon */
1406 WMLabel
*nameL
; /* title of panel */
1408 WMFrame
*sepF
; /* separator frame */
1410 WMLabel
*noteL
; /* Title of note */
1411 WMLabel
*note2L
; /* body of note with what happened */
1413 WMFrame
*whatF
; /* "what to do next" frame */
1414 WMPopUpButton
*whatP
; /* action selection popup button */
1416 WMButton
*okB
; /* ok button */
1418 Bool done
; /* if finished with this dialog */
1419 int action
; /* what to do after */
1427 handleKeyPress(XEvent
*event
, void *clientData
)
1429 CrashPanel
*panel
= (CrashPanel
*)clientData
;
1431 if (event
->xkey
.keycode
== panel
->retKey
) {
1432 WMPerformButtonClick(panel
->okB
);
1438 okButtonCallback(void *self
, void *clientData
)
1440 CrashPanel
*panel
= (CrashPanel
*)clientData
;
1447 setCrashAction(void *self
, void *clientData
)
1449 WMPopUpButton
*pop
= (WMPopUpButton
*)self
;
1450 CrashPanel
*panel
= (CrashPanel
*)clientData
;
1452 panel
->action
= WMGetPopUpButtonSelectedItem(pop
);
1457 getWindowMakerIconImage(WMScreen
*scr
)
1459 proplist_t dict
, key
, option
, value
=NULL
;
1463 PLSetStringCmpHook(NULL
);
1465 key
= PLMakeString("Logo.WMPanel");
1466 option
= PLMakeString("Icon");
1468 dict
= PLGetDictionaryEntry(WDWindowAttributes
->dictionary
, key
);
1471 value
= PLGetDictionaryEntry(dict
, option
);
1477 PLSetStringCmpHook(StringCompareHook
);
1479 if (value
&& PLIsString(value
)) {
1480 path
= FindImage(wPreferences
.icon_path
, PLGetString(value
));
1485 image
= RLoadImage(WMScreenRContext(scr
), path
, 0);
1487 pix
= WMCreatePixmapFromRImage(scr
, image
, 0);
1488 RDestroyImage(image
);
1503 wShowCrashingDialogPanel(int whatSig
)
1509 int screen_no
, scr_width
, scr_height
;
1513 panel
= wmalloc(sizeof(CrashPanel
));
1514 memset(panel
, 0, sizeof(CrashPanel
));
1516 screen_no
= DefaultScreen(dpy
);
1517 scr_width
= WidthOfScreen(ScreenOfDisplay(dpy
, screen_no
));
1518 scr_height
= HeightOfScreen(ScreenOfDisplay(dpy
, screen_no
));
1520 scr
= WMCreateScreen(dpy
, screen_no
);
1522 wsyserror(_("cannot open connection for crashing dialog panel. Aborting."));
1526 panel
->retKey
= XKeysymToKeycode(dpy
, XK_Return
);
1528 panel
->win
= WMCreateWindow(scr
, "crashingDialog");
1529 WMResizeWidget(panel
->win
, PWIDTH
, PHEIGHT
);
1530 WMMoveWidget(panel
->win
, (scr_width
- PWIDTH
)/2, (scr_height
- PHEIGHT
)/2);
1532 logo
= getWindowMakerIconImage(scr
);
1534 panel
->iconL
= WMCreateLabel(panel
->win
);
1535 WMResizeWidget(panel
->iconL
, 64, 64);
1536 WMMoveWidget(panel
->iconL
, 10, 10);
1537 WMSetLabelImagePosition(panel
->iconL
, WIPImageOnly
);
1538 WMSetLabelImage(panel
->iconL
, logo
);
1541 panel
->nameL
= WMCreateLabel(panel
->win
);
1542 WMResizeWidget(panel
->nameL
, 190, 18);
1543 WMMoveWidget(panel
->nameL
, 80, 35);
1544 WMSetLabelTextAlignment(panel
->nameL
, WALeft
);
1545 font
= WMBoldSystemFontOfSize(scr
, 18);
1546 WMSetLabelFont(panel
->nameL
, font
);
1547 WMReleaseFont(font
);
1548 WMSetLabelText(panel
->nameL
, _("Fatal error"));
1550 panel
->sepF
= WMCreateFrame(panel
->win
);
1551 WMResizeWidget(panel
->sepF
, PWIDTH
+4, 2);
1552 WMMoveWidget(panel
->sepF
, -2, 80);
1554 panel
->noteL
= WMCreateLabel(panel
->win
);
1555 WMResizeWidget(panel
->noteL
, PWIDTH
-20, 40);
1556 WMMoveWidget(panel
->noteL
, 10, 90);
1557 WMSetLabelTextAlignment(panel
->noteL
, WAJustified
);
1558 #ifdef SYS_SIGLIST_DECLARED
1559 sprintf(buf
, _("Window Maker received signal %i\n(%s)."),
1560 whatSig
, sys_siglist
[whatSig
]);
1562 sprintf(buf
, _("Window Maker received signal %i."), whatSig
);
1564 WMSetLabelText(panel
->noteL
, buf
);
1566 panel
->note2L
= WMCreateLabel(panel
->win
);
1567 WMResizeWidget(panel
->note2L
, PWIDTH
-20, 100);
1568 WMMoveWidget(panel
->note2L
, 10, 130);
1569 WMSetLabelTextAlignment(panel
->note2L
, WALeft
);
1570 WMSetLabelText(panel
->note2L
,
1571 _(" This fatal error occured probably due to a bug."
1572 " Please fill the included BUGFORM and "
1573 "report it to bugs@windowmaker.org."));
1576 panel
->whatF
= WMCreateFrame(panel
->win
);
1577 WMResizeWidget(panel
->whatF
, PWIDTH
-20, 50);
1578 WMMoveWidget(panel
->whatF
, 10, 240);
1579 WMSetFrameTitle(panel
->whatF
, _("What do you want to do now?"));
1581 panel
->whatP
= WMCreatePopUpButton(panel
->whatF
);
1582 WMResizeWidget(panel
->whatP
, PWIDTH
-20-70, 20);
1583 WMMoveWidget(panel
->whatP
, 35, 20);
1584 WMSetPopUpButtonPullsDown(panel
->whatP
, False
);
1585 WMSetPopUpButtonText(panel
->whatP
, _("Select action"));
1586 WMAddPopUpButtonItem(panel
->whatP
, _("Abort and leave a core file"));
1587 WMAddPopUpButtonItem(panel
->whatP
, _("Restart Window Maker"));
1588 WMAddPopUpButtonItem(panel
->whatP
, _("Start alternate window manager"));
1589 WMSetPopUpButtonAction(panel
->whatP
, setCrashAction
, panel
);
1590 WMSetPopUpButtonSelectedItem(panel
->whatP
, WMRestart
);
1591 panel
->action
= WMRestart
;
1593 WMMapSubwidgets(panel
->whatF
);
1595 panel
->okB
= WMCreateCommandButton(panel
->win
);
1596 WMResizeWidget(panel
->okB
, 80, 26);
1597 WMMoveWidget(panel
->okB
, 205, 309);
1598 WMSetButtonText(panel
->okB
, _("OK"));
1599 WMSetButtonImage(panel
->okB
, WMGetSystemPixmap(scr
, WSIReturnArrow
));
1600 WMSetButtonAltImage(panel
->okB
, WMGetSystemPixmap(scr
, WSIHighlightedReturnArrow
));
1601 WMSetButtonImagePosition(panel
->okB
, WIPRight
);
1602 WMSetButtonAction(panel
->okB
, okButtonCallback
, panel
);
1606 WMCreateEventHandler(WMWidgetView(panel
->win
), KeyPressMask
,
1607 handleKeyPress
, panel
);
1609 WMRealizeWidget(panel
->win
);
1610 WMMapSubwidgets(panel
->win
);
1612 WMMapWidget(panel
->win
);
1614 XSetInputFocus(dpy
, WMWidgetXID(panel
->win
), RevertToParent
, CurrentTime
);
1616 while (!panel
->done
) {
1619 WMNextEvent(dpy
, &event
);
1620 WMHandleEvent(&event
);
1623 action
= panel
->action
;
1625 WMUnmapWidget(panel
->win
);
1626 WMDestroyWidget(panel
->win
);
1635 /*****************************************************************************
1636 * About GNUstep Panel
1637 *****************************************************************************/
1641 drawGNUstepLogo(Display
*dpy
, Drawable d
, int width
, int height
,
1642 unsigned long blackPixel
, unsigned long whitePixel
)
1646 XRectangle rects
[3];
1648 gcv
.foreground
= blackPixel
;
1649 gc
= XCreateGC(dpy
, d
, GCForeground
, &gcv
);
1651 XFillArc(dpy
, d
, gc
, width
/45, height
/45,
1652 width
- 2*width
/45, height
- 2*height
/45, 0, 360*64);
1655 rects
[0].y
= 37*height
/45;
1656 rects
[0].width
= width
/3;
1657 rects
[0].height
= height
- rects
[0].y
;
1659 rects
[1].x
= rects
[0].width
;
1660 rects
[1].y
= height
/2;
1661 rects
[1].width
= width
- 2*width
/3;
1662 rects
[1].height
= height
- rects
[1].y
;
1664 rects
[2].x
= 2*width
/3;
1665 rects
[2].y
= height
- 37*height
/45;
1666 rects
[2].width
= width
/3;
1667 rects
[2].height
= height
- rects
[2].y
;
1669 XSetClipRectangles(dpy
, gc
, 0, 0, rects
, 3, Unsorted
);
1670 XFillRectangle(dpy
, d
, gc
, 0, 0, width
, height
);
1672 XSetForeground(dpy
, gc
, whitePixel
);
1673 XFillArc(dpy
, d
, gc
, width
/45, height
/45,
1674 width
- 2*width
/45, height
- 2*height
/45, 0, 360*64);
1692 static GNUstepPanel
*gnustepPanel
= NULL
;
1695 destroyGNUstepPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
1697 WMUnmapWidget(gnustepPanel
->win
);
1699 WMDestroyWidget(gnustepPanel
->win
);
1701 wUnmanageWindow(gnustepPanel
->wwin
, False
, False
);
1703 wfree(gnustepPanel
);
1705 gnustepPanel
= NULL
;
1710 wShowGNUstepPanel(WScreen
*scr
)
1712 GNUstepPanel
*panel
;
1719 if (gnustepPanel
->scr
== scr
) {
1720 wRaiseFrame(gnustepPanel
->wwin
->frame
->core
);
1721 wSetFocusTo(scr
, gnustepPanel
->wwin
);
1726 panel
= wmalloc(sizeof(GNUstepPanel
));
1730 panel
->win
= WMCreateWindow(scr
->wmscreen
, "About GNUstep");
1731 WMResizeWidget(panel
->win
, 325, 200);
1733 pixmap
= WMCreatePixmap(scr
->wmscreen
, 130, 130,
1734 WMScreenDepth(scr
->wmscreen
), True
);
1736 color
= WMCreateNamedColor(scr
->wmscreen
, "gray50", True
);
1738 drawGNUstepLogo(dpy
, WMGetPixmapXID(pixmap
), 130, 130,
1739 WMColorPixel(color
), scr
->white_pixel
);
1741 WMReleaseColor(color
);
1743 XSetForeground(dpy
, scr
->mono_gc
, 0);
1744 XFillRectangle(dpy
, WMGetPixmapMaskXID(pixmap
), scr
->mono_gc
, 0, 0,
1746 drawGNUstepLogo(dpy
, WMGetPixmapMaskXID(pixmap
), 130, 130, 1, 1);
1748 panel
->gstepL
= WMCreateLabel(panel
->win
);
1749 WMResizeWidget(panel
->gstepL
, 285, 64);
1750 WMMoveWidget(panel
->gstepL
, 20, 0);
1751 WMSetLabelTextAlignment(panel
->gstepL
, WARight
);
1752 WMSetLabelText(panel
->gstepL
, "GNUstep");
1754 WMFont
*font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 24);
1756 WMSetLabelFont(panel
->gstepL
, font
);
1757 WMReleaseFont(font
);
1760 panel
->textL
= WMCreateLabel(panel
->win
);
1761 WMResizeWidget(panel
->textL
, 275, 130);
1762 WMMoveWidget(panel
->textL
, 30, 50);
1763 WMSetLabelTextAlignment(panel
->textL
, WARight
);
1764 WMSetLabelImagePosition(panel
->textL
, WIPOverlaps
);
1765 WMSetLabelText(panel
->textL
,
1766 _("Window Maker is part of the GNUstep project.\n"\
1767 "The GNUstep project aims to create a free\n"\
1768 "implementation of the OpenStep(tm) specification\n"\
1769 "which is a object-oriented framework for\n"\
1770 "creating advanced graphical, multi-platform\n"\
1771 "applications. Additionally, a development and\n"\
1772 "user desktop enviroment will be created on top\n"\
1773 "of the framework. For more information about\n"\
1774 "GNUstep, please visit: www.gnustep.org"));
1775 WMSetLabelImage(panel
->textL
, pixmap
);
1777 WMReleasePixmap(pixmap
);
1779 WMRealizeWidget(panel
->win
);
1780 WMMapSubwidgets(panel
->win
);
1782 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 325, 200, 0, 0, 0);
1784 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1786 wwin
= wManageInternalWindow(scr
, parent
, None
, _("About GNUstep"),
1787 (scr
->scr_width
- 325)/2,
1788 (scr
->scr_height
- 200)/2, 325, 200);
1790 WSETUFLAG(wwin
, no_closable
, 0);
1791 WSETUFLAG(wwin
, no_close_button
, 0);
1792 wWindowUpdateButtonImages(wwin
);
1793 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1794 #ifdef XKB_BUTTON_HINT
1795 wFrameWindowHideButton(wwin
->frame
, WFF_LANGUAGE_BUTTON
);
1797 wwin
->frame
->on_click_right
= destroyGNUstepPanel
;
1801 WMMapWidget(panel
->win
);
1805 gnustepPanel
= panel
;