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~2000 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
702 "Copyright \xa9 1998~2000 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
[] = {
966 if (!panel
->timer
&& !broken
&& clicks
> 0) {
973 file
= wDefaultGetIconFile(panel
->scr
, "Logo", "WMPanel", False
);
979 path
= FindImage(wPreferences
.icon_path
, file
);
985 panel
->icon
= RLoadImage(panel
->scr
->rcontext
, path
, 0);
993 panel
->pic
= RGetImageFromXPMData(panel
->scr
->rcontext
, pic_data
);
994 if (!panel
->pic
|| panel
->icon
->width
!=panel
->pic
->width
995 || panel
->icon
->height
!=panel
->pic
->height
) {
997 RDestroyImage(panel
->icon
);
1000 RDestroyImage(panel
->pic
);
1012 RCombineImageWithColor(panel
->icon
, &color
);
1013 RCombineImageWithColor(panel
->pic
, &color
);
1017 panel
->str
= msgs
[rand()%(sizeof(msgs
)/sizeof(char*))];
1019 panel
->timer
= WMAddTimerHandler(50, logoPushCallback
, panel
);
1021 panel
->oldPix
= WMRetainPixmap(WMGetLabelImage(panel
->logoL
));
1022 } else if (panel
->timer
) {
1027 WMSetLabelImage(panel
->logoL
, panel
->oldPix
);
1028 WMReleasePixmap(panel
->oldPix
);
1029 panel
->oldPix
= NULL
;
1031 WMDeleteTimerHandler(panel
->timer
);
1032 panel
->timer
= NULL
;
1034 sprintf(version
, "Version %s", VERSION
);
1035 WMSetLabelText(panel
->versionL
, version
);
1040 while (XCheckTypedWindowEvent(dpy
, WMWidgetXID(panel
->versionL
),
1044 #endif /* SILLYNESS */
1048 wShowInfoPanel(WScreen
*scr
)
1058 RColor color1
, color2
;
1072 if (thePanel
->scr
== scr
) {
1073 wRaiseFrame(thePanel
->wwin
->frame
->core
);
1074 wSetFocusTo(scr
, thePanel
->wwin
);
1079 panel
= wmalloc(sizeof(InfoPanel
));
1080 memset(panel
, 0, sizeof(InfoPanel
));
1084 panel
->win
= WMCreateWindow(scr
->wmscreen
, "info");
1085 WMResizeWidget(panel
->win
, 382, 230);
1087 logo
= WMGetApplicationIconImage(scr
->wmscreen
);
1089 size
= WMGetPixmapSize(logo
);
1090 panel
->logoL
= WMCreateLabel(panel
->win
);
1091 WMResizeWidget(panel
->logoL
, 64, 64);
1092 WMMoveWidget(panel
->logoL
, 30, 20);
1093 WMSetLabelImagePosition(panel
->logoL
, WIPImageOnly
);
1094 WMSetLabelImage(panel
->logoL
, logo
);
1096 WMCreateEventHandler(WMWidgetView(panel
->logoL
), ButtonPressMask
,
1097 handleLogoPush
, panel
);
1101 panel
->name1L
= WMCreateLabel(panel
->win
);
1102 WMResizeWidget(panel
->name1L
, 240, 30);
1103 WMMoveWidget(panel
->name1L
, 100, 30);
1108 color2
.green
= 0x50;
1110 logo
= renderText(scr
->wmscreen
, "GNU Window Maker",
1111 "-*-utopia-*-r-*-*-25-*", &color1
, &color2
);
1113 WMSetLabelImagePosition(panel
->name1L
, WIPImageOnly
);
1114 WMSetLabelImage(panel
->name1L
, logo
);
1115 WMReleasePixmap(logo
);
1117 font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 20);
1119 WMSetLabelFont(panel
->name1L
, font
);
1120 WMReleaseFont(font
);
1122 WMSetLabelTextAlignment(panel
->name1L
, WACenter
);
1123 WMSetLabelText(panel
->name1L
, "GNU Window Maker");
1126 panel
->name2L
= WMCreateLabel(panel
->win
);
1127 WMResizeWidget(panel
->name2L
, 240, 24);
1128 WMMoveWidget(panel
->name2L
, 100, 60);
1129 font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 18);
1131 WMSetLabelFont(panel
->name2L
, font
);
1132 WMReleaseFont(font
);
1135 WMSetLabelTextAlignment(panel
->name2L
, WACenter
);
1136 WMSetLabelText(panel
->name2L
, "Window Manager for X");
1139 sprintf(version
, "Version %s", VERSION
);
1140 panel
->versionL
= WMCreateLabel(panel
->win
);
1141 WMResizeWidget(panel
->versionL
, 310, 16);
1142 WMMoveWidget(panel
->versionL
, 30, 95);
1143 WMSetLabelTextAlignment(panel
->versionL
, WARight
);
1144 WMSetLabelText(panel
->versionL
, version
);
1145 WMSetLabelWraps(panel
->versionL
, False
);
1147 panel
->copyrL
= WMCreateLabel(panel
->win
);
1148 WMResizeWidget(panel
->copyrL
, 340, 40);
1149 WMMoveWidget(panel
->copyrL
, 15, 185);
1150 WMSetLabelTextAlignment(panel
->copyrL
, WALeft
);
1151 WMSetLabelText(panel
->copyrL
, COPYRIGHT_TEXT
);
1152 /* we want the (c) character in the helvetica font */
1153 font
= WMCreateNormalFont(scr
->wmscreen
, HELVETICA10_FONT
);
1155 WMSetLabelFont(panel
->copyrL
, font
);
1158 switch (scr
->w_depth
) {
1160 strcpy(version
, "32 thousand");
1163 strcpy(version
, "64 thousand");
1167 strcpy(version
, "16 million");
1170 sprintf(version
, "%d", 1<<scr
->w_depth
);
1174 sprintf(buffer
, "Using visual 0x%x: %s %ibpp (%s colors)\n",
1175 (unsigned)scr
->w_visual
->visualid
,
1176 visuals
[scr
->w_visual
->class], scr
->w_depth
, version
);
1178 #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
1180 struct mallinfo ma
= mallinfo();
1181 sprintf(buffer
+strlen(buffer
),
1182 "Total allocated memory: %i kB. Total memory in use: %i kB.\n",
1183 (ma
.arena
+ma
.hblkhd
)/1024, (ma
.uordblks
+ma
.hblkhd
)/1024);
1188 strcat(buffer
, "Supported image formats: ");
1189 strl
= RSupportedFileFormats();
1190 for (i
=0; strl
[i
]!=NULL
; i
++) {
1191 strcat(buffer
, strl
[i
]);
1192 strcat(buffer
, " ");
1195 strcat(buffer
, "\nAdditional Support For: ");
1208 list
[j
++] = "GNOME";
1214 list
[j
++] = "Sound";
1218 for (i
= 0; i
< j
; i
++) {
1221 strcat(buf
, " and ");
1225 strcat(buf
, list
[i
]);
1227 strcat(buffer
, buf
);
1231 panel
->infoL
= WMCreateLabel(panel
->win
);
1232 WMResizeWidget(panel
->infoL
, 350, 75);
1233 WMMoveWidget(panel
->infoL
, 15, 115);
1234 WMSetLabelText(panel
->infoL
, buffer
);
1236 WMSetLabelFont(panel
->infoL
, font
);
1237 WMReleaseFont(font
);
1241 WMRealizeWidget(panel
->win
);
1242 WMMapSubwidgets(panel
->win
);
1244 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 382, 230, 0, 0, 0);
1246 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1248 WMMapWidget(panel
->win
);
1250 wwin
= wManageInternalWindow(scr
, parent
, None
, "Info",
1251 (scr
->scr_width
- 382)/2,
1252 (scr
->scr_height
- 230)/2, 382, 230);
1254 WSETUFLAG(wwin
, no_closable
, 0);
1255 WSETUFLAG(wwin
, no_close_button
, 0);
1256 #ifdef XKB_BUTTON_HINT
1257 wFrameWindowHideButton(wwin
->frame
, WFF_LANGUAGE_BUTTON
);
1259 wWindowUpdateButtonImages(wwin
);
1260 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1261 wwin
->frame
->on_click_right
= destroyInfoPanel
;
1269 if (InitXThing(panel
->scr
)) {
1270 panel
->timer
= WMAddTimerHandler(100, logoPushCallback
, panel
);
1273 panel
->str
= "Merry Christmas!";
1274 panel
->oldPix
= WMRetainPixmap(WMGetLabelImage(panel
->logoL
));
1281 ***********************************************************************
1283 ***********************************************************************
1298 #define LICENSE_TEXT \
1299 " Window Maker is free software; you can redistribute it and/or modify "\
1300 "it under the terms of the GNU General Public License as published "\
1301 "by the Free Software Foundation; either version 2 of the License, "\
1302 "or (at your option) any later version.\n\n\n"\
1303 " Window Maker is distributed in the hope that it will be useful, but "\
1304 "WITHOUT ANY WARRANTY; without even the implied warranty of "\
1305 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "\
1306 "General Public License for more details.\n\n\n"\
1307 " You should have received a copy of the GNU General Public License "\
1308 "along with this program; if not, write to the Free Software "\
1309 "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA "\
1313 static LegalPanel
*legalPanel
= NULL
;
1316 destroyLegalPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
1318 WMUnmapWidget(legalPanel
->win
);
1320 WMDestroyWidget(legalPanel
->win
);
1322 wUnmanageWindow(legalPanel
->wwin
, False
, False
);
1331 wShowLegalPanel(WScreen
*scr
)
1338 if (legalPanel
->scr
== scr
) {
1339 wRaiseFrame(legalPanel
->wwin
->frame
->core
);
1340 wSetFocusTo(scr
, legalPanel
->wwin
);
1345 panel
= wmalloc(sizeof(LegalPanel
));
1349 panel
->win
= WMCreateWindow(scr
->wmscreen
, "legal");
1350 WMResizeWidget(panel
->win
, 420, 250);
1353 panel
->licenseL
= WMCreateLabel(panel
->win
);
1354 WMSetLabelWraps(panel
->licenseL
, True
);
1355 WMResizeWidget(panel
->licenseL
, 400, 230);
1356 WMMoveWidget(panel
->licenseL
, 10, 10);
1357 WMSetLabelTextAlignment(panel
->licenseL
, WALeft
);
1358 WMSetLabelText(panel
->licenseL
, LICENSE_TEXT
);
1359 WMSetLabelRelief(panel
->licenseL
, WRGroove
);
1361 WMRealizeWidget(panel
->win
);
1362 WMMapSubwidgets(panel
->win
);
1364 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 420, 250, 0, 0, 0);
1366 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1368 wwin
= wManageInternalWindow(scr
, parent
, None
, "Legal",
1369 (scr
->scr_width
- 420)/2,
1370 (scr
->scr_height
- 250)/2, 420, 250);
1372 WSETUFLAG(wwin
, no_closable
, 0);
1373 WSETUFLAG(wwin
, no_close_button
, 0);
1374 wWindowUpdateButtonImages(wwin
);
1375 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1376 #ifdef XKB_BUTTON_HINT
1377 wFrameWindowHideButton(wwin
->frame
, WFF_LANGUAGE_BUTTON
);
1379 wwin
->frame
->on_click_right
= destroyLegalPanel
;
1383 WMMapWidget(panel
->win
);
1392 ***********************************************************************
1393 * Crashing Dialog Panel
1394 ***********************************************************************
1397 extern WDDomain
*WDWindowAttributes
;
1400 typedef struct _CrashPanel
{
1401 WMWindow
*win
; /* main window */
1403 WMLabel
*iconL
; /* application icon */
1404 WMLabel
*nameL
; /* title of panel */
1406 WMFrame
*sepF
; /* separator frame */
1408 WMLabel
*noteL
; /* Title of note */
1409 WMLabel
*note2L
; /* body of note with what happened */
1411 WMFrame
*whatF
; /* "what to do next" frame */
1412 WMPopUpButton
*whatP
; /* action selection popup button */
1414 WMButton
*okB
; /* ok button */
1416 Bool done
; /* if finished with this dialog */
1417 int action
; /* what to do after */
1425 handleKeyPress(XEvent
*event
, void *clientData
)
1427 CrashPanel
*panel
= (CrashPanel
*)clientData
;
1429 if (event
->xkey
.keycode
== panel
->retKey
) {
1430 WMPerformButtonClick(panel
->okB
);
1436 okButtonCallback(void *self
, void *clientData
)
1438 CrashPanel
*panel
= (CrashPanel
*)clientData
;
1445 setCrashAction(void *self
, void *clientData
)
1447 WMPopUpButton
*pop
= (WMPopUpButton
*)self
;
1448 CrashPanel
*panel
= (CrashPanel
*)clientData
;
1450 panel
->action
= WMGetPopUpButtonSelectedItem(pop
);
1455 getWindowMakerIconImage(WMScreen
*scr
)
1457 proplist_t dict
, key
, option
, value
=NULL
;
1461 PLSetStringCmpHook(NULL
);
1463 key
= PLMakeString("Logo.WMPanel");
1464 option
= PLMakeString("Icon");
1466 dict
= PLGetDictionaryEntry(WDWindowAttributes
->dictionary
, key
);
1469 value
= PLGetDictionaryEntry(dict
, option
);
1475 PLSetStringCmpHook(StringCompareHook
);
1477 if (value
&& PLIsString(value
)) {
1478 path
= FindImage(wPreferences
.icon_path
, PLGetString(value
));
1483 image
= RLoadImage(WMScreenRContext(scr
), path
, 0);
1485 pix
= WMCreatePixmapFromRImage(scr
, image
, 0);
1486 RDestroyImage(image
);
1501 wShowCrashingDialogPanel(int whatSig
)
1507 int screen_no
, scr_width
, scr_height
;
1511 panel
= wmalloc(sizeof(CrashPanel
));
1512 memset(panel
, 0, sizeof(CrashPanel
));
1514 screen_no
= DefaultScreen(dpy
);
1515 scr_width
= WidthOfScreen(ScreenOfDisplay(dpy
, screen_no
));
1516 scr_height
= HeightOfScreen(ScreenOfDisplay(dpy
, screen_no
));
1518 scr
= WMCreateScreen(dpy
, screen_no
);
1520 wsyserror(_("cannot open connection for crashing dialog panel. Aborting."));
1524 panel
->retKey
= XKeysymToKeycode(dpy
, XK_Return
);
1526 panel
->win
= WMCreateWindow(scr
, "crashingDialog");
1527 WMResizeWidget(panel
->win
, PWIDTH
, PHEIGHT
);
1528 WMMoveWidget(panel
->win
, (scr_width
- PWIDTH
)/2, (scr_height
- PHEIGHT
)/2);
1530 logo
= getWindowMakerIconImage(scr
);
1532 panel
->iconL
= WMCreateLabel(panel
->win
);
1533 WMResizeWidget(panel
->iconL
, 64, 64);
1534 WMMoveWidget(panel
->iconL
, 10, 10);
1535 WMSetLabelImagePosition(panel
->iconL
, WIPImageOnly
);
1536 WMSetLabelImage(panel
->iconL
, logo
);
1539 panel
->nameL
= WMCreateLabel(panel
->win
);
1540 WMResizeWidget(panel
->nameL
, 190, 18);
1541 WMMoveWidget(panel
->nameL
, 80, 35);
1542 WMSetLabelTextAlignment(panel
->nameL
, WALeft
);
1543 font
= WMBoldSystemFontOfSize(scr
, 18);
1544 WMSetLabelFont(panel
->nameL
, font
);
1545 WMReleaseFont(font
);
1546 WMSetLabelText(panel
->nameL
, _("Fatal error"));
1548 panel
->sepF
= WMCreateFrame(panel
->win
);
1549 WMResizeWidget(panel
->sepF
, PWIDTH
+4, 2);
1550 WMMoveWidget(panel
->sepF
, -2, 80);
1552 panel
->noteL
= WMCreateLabel(panel
->win
);
1553 WMResizeWidget(panel
->noteL
, PWIDTH
-20, 40);
1554 WMMoveWidget(panel
->noteL
, 10, 90);
1555 WMSetLabelTextAlignment(panel
->noteL
, WAJustified
);
1556 #ifdef SYS_SIGLIST_DECLARED
1557 sprintf(buf
, _("Window Maker received signal %i\n(%s)."),
1558 whatSig
, sys_siglist
[whatSig
]);
1560 sprintf(buf
, _("Window Maker received signal %i."), whatSig
);
1562 WMSetLabelText(panel
->noteL
, buf
);
1564 panel
->note2L
= WMCreateLabel(panel
->win
);
1565 WMResizeWidget(panel
->note2L
, PWIDTH
-20, 100);
1566 WMMoveWidget(panel
->note2L
, 10, 130);
1567 WMSetLabelTextAlignment(panel
->note2L
, WALeft
);
1568 WMSetLabelText(panel
->note2L
,
1569 _(" This fatal error occured probably due to a bug."
1570 " Please fill the included BUGFORM and "
1571 "report it to bugs@windowmaker.org."));
1574 panel
->whatF
= WMCreateFrame(panel
->win
);
1575 WMResizeWidget(panel
->whatF
, PWIDTH
-20, 50);
1576 WMMoveWidget(panel
->whatF
, 10, 240);
1577 WMSetFrameTitle(panel
->whatF
, _("What do you want to do now?"));
1579 panel
->whatP
= WMCreatePopUpButton(panel
->whatF
);
1580 WMResizeWidget(panel
->whatP
, PWIDTH
-20-70, 20);
1581 WMMoveWidget(panel
->whatP
, 35, 20);
1582 WMSetPopUpButtonPullsDown(panel
->whatP
, False
);
1583 WMSetPopUpButtonText(panel
->whatP
, _("Select action"));
1584 WMAddPopUpButtonItem(panel
->whatP
, _("Abort and leave a core file"));
1585 WMAddPopUpButtonItem(panel
->whatP
, _("Restart Window Maker"));
1586 WMAddPopUpButtonItem(panel
->whatP
, _("Start alternate window manager"));
1587 WMSetPopUpButtonAction(panel
->whatP
, setCrashAction
, panel
);
1588 WMSetPopUpButtonSelectedItem(panel
->whatP
, WMRestart
);
1589 panel
->action
= WMRestart
;
1591 WMMapSubwidgets(panel
->whatF
);
1593 panel
->okB
= WMCreateCommandButton(panel
->win
);
1594 WMResizeWidget(panel
->okB
, 80, 26);
1595 WMMoveWidget(panel
->okB
, 205, 309);
1596 WMSetButtonText(panel
->okB
, _("OK"));
1597 WMSetButtonImage(panel
->okB
, WMGetSystemPixmap(scr
, WSIReturnArrow
));
1598 WMSetButtonAltImage(panel
->okB
, WMGetSystemPixmap(scr
, WSIHighlightedReturnArrow
));
1599 WMSetButtonImagePosition(panel
->okB
, WIPRight
);
1600 WMSetButtonAction(panel
->okB
, okButtonCallback
, panel
);
1604 WMCreateEventHandler(WMWidgetView(panel
->win
), KeyPressMask
,
1605 handleKeyPress
, panel
);
1607 WMRealizeWidget(panel
->win
);
1608 WMMapSubwidgets(panel
->win
);
1610 WMMapWidget(panel
->win
);
1612 XSetInputFocus(dpy
, WMWidgetXID(panel
->win
), RevertToParent
, CurrentTime
);
1614 while (!panel
->done
) {
1617 WMNextEvent(dpy
, &event
);
1618 WMHandleEvent(&event
);
1621 action
= panel
->action
;
1623 WMUnmapWidget(panel
->win
);
1624 WMDestroyWidget(panel
->win
);
1633 /*****************************************************************************
1634 * About GNUstep Panel
1635 *****************************************************************************/
1639 drawGNUstepLogo(Display
*dpy
, Drawable d
, int width
, int height
,
1640 unsigned long blackPixel
, unsigned long whitePixel
)
1644 XRectangle rects
[3];
1646 gcv
.foreground
= blackPixel
;
1647 gc
= XCreateGC(dpy
, d
, GCForeground
, &gcv
);
1649 XFillArc(dpy
, d
, gc
, width
/45, height
/45,
1650 width
- 2*width
/45, height
- 2*height
/45, 0, 360*64);
1653 rects
[0].y
= 37*height
/45;
1654 rects
[0].width
= width
/3;
1655 rects
[0].height
= height
- rects
[0].y
;
1657 rects
[1].x
= rects
[0].width
;
1658 rects
[1].y
= height
/2;
1659 rects
[1].width
= width
- 2*width
/3;
1660 rects
[1].height
= height
- rects
[1].y
;
1662 rects
[2].x
= 2*width
/3;
1663 rects
[2].y
= height
- 37*height
/45;
1664 rects
[2].width
= width
/3;
1665 rects
[2].height
= height
- rects
[2].y
;
1667 XSetClipRectangles(dpy
, gc
, 0, 0, rects
, 3, Unsorted
);
1668 XFillRectangle(dpy
, d
, gc
, 0, 0, width
, height
);
1670 XSetForeground(dpy
, gc
, whitePixel
);
1671 XFillArc(dpy
, d
, gc
, width
/45, height
/45,
1672 width
- 2*width
/45, height
- 2*height
/45, 0, 360*64);
1679 #define GNUSTEP_TEXT \
1680 "Window Maker is part of the GNUstep project.\n"\
1681 "The GNUstep project aims to create a free\n"\
1682 "implementation of the OpenStep(tm) specification\n"\
1683 "which is a object-oriented framework for\n"\
1684 "creating advanced graphical, multi-platform\n"\
1685 "applications. Additionally, a development and\n"\
1686 "user desktop enviroment will be created on top\n"\
1687 "of the framework. For more information about\n"\
1688 "GNUstep, please visit: www.gnustep.org"
1703 static GNUstepPanel
*gnustepPanel
= NULL
;
1706 destroyGNUstepPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
1708 WMUnmapWidget(gnustepPanel
->win
);
1710 WMDestroyWidget(gnustepPanel
->win
);
1712 wUnmanageWindow(gnustepPanel
->wwin
, False
, False
);
1714 wfree(gnustepPanel
);
1716 gnustepPanel
= NULL
;
1721 wShowGNUstepPanel(WScreen
*scr
)
1723 GNUstepPanel
*panel
;
1730 if (gnustepPanel
->scr
== scr
) {
1731 wRaiseFrame(gnustepPanel
->wwin
->frame
->core
);
1732 wSetFocusTo(scr
, gnustepPanel
->wwin
);
1737 panel
= wmalloc(sizeof(GNUstepPanel
));
1741 panel
->win
= WMCreateWindow(scr
->wmscreen
, "About GNUstep");
1742 WMResizeWidget(panel
->win
, 325, 200);
1744 pixmap
= WMCreatePixmap(scr
->wmscreen
, 130, 130,
1745 WMScreenDepth(scr
->wmscreen
), True
);
1747 color
= WMCreateNamedColor(scr
->wmscreen
, "gray50", True
);
1749 drawGNUstepLogo(dpy
, WMGetPixmapXID(pixmap
), 130, 130,
1750 WMColorPixel(color
), scr
->white_pixel
);
1752 WMReleaseColor(color
);
1754 XSetForeground(dpy
, scr
->mono_gc
, 0);
1755 XFillRectangle(dpy
, WMGetPixmapMaskXID(pixmap
), scr
->mono_gc
, 0, 0,
1757 drawGNUstepLogo(dpy
, WMGetPixmapMaskXID(pixmap
), 130, 130, 1, 1);
1759 panel
->gstepL
= WMCreateLabel(panel
->win
);
1760 WMResizeWidget(panel
->gstepL
, 285, 64);
1761 WMMoveWidget(panel
->gstepL
, 20, 0);
1762 WMSetLabelTextAlignment(panel
->gstepL
, WARight
);
1763 WMSetLabelText(panel
->gstepL
, "GNUstep");
1765 WMFont
*font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 24);
1767 WMSetLabelFont(panel
->gstepL
, font
);
1768 WMReleaseFont(font
);
1771 panel
->textL
= WMCreateLabel(panel
->win
);
1772 WMResizeWidget(panel
->textL
, 275, 130);
1773 WMMoveWidget(panel
->textL
, 30, 50);
1774 WMSetLabelTextAlignment(panel
->textL
, WARight
);
1775 WMSetLabelImagePosition(panel
->textL
, WIPOverlaps
);
1776 WMSetLabelText(panel
->textL
, GNUSTEP_TEXT
);
1777 WMSetLabelImage(panel
->textL
, pixmap
);
1779 WMReleasePixmap(pixmap
);
1781 WMRealizeWidget(panel
->win
);
1782 WMMapSubwidgets(panel
->win
);
1784 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 325, 200, 0, 0, 0);
1786 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1788 wwin
= wManageInternalWindow(scr
, parent
, None
, "About GNUstep",
1789 (scr
->scr_width
- 325)/2,
1790 (scr
->scr_height
- 200)/2, 325, 200);
1792 WSETUFLAG(wwin
, no_closable
, 0);
1793 WSETUFLAG(wwin
, no_close_button
, 0);
1794 wWindowUpdateButtonImages(wwin
);
1795 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1796 #ifdef XKB_BUTTON_HINT
1797 wFrameWindowHideButton(wwin
->frame
, WFF_LANGUAGE_BUTTON
);
1799 wwin
->frame
->on_click_right
= destroyGNUstepPanel
;
1803 WMMapWidget(panel
->win
);
1807 gnustepPanel
= panel
;