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 while (!panel
->done
) {
97 WMNextEvent(dpy
, &event
);
98 WMHandleEvent(&event
);
101 result
= panel
->result
;
103 WMUnmapWidget(panel
->win
);
105 wUnmanageWindow(wwin
, False
, False
);
107 WMDestroyAlertPanel(panel
);
109 XDestroyWindow(dpy
, parent
);
117 wInputDialog(WScreen
*scr
, char *title
, char *message
, char **text
)
125 panel
= WMCreateInputPanel(scr
->wmscreen
, NULL
, title
, message
, *text
,
126 _("OK"), _("Cancel"));
129 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 320, 160, 0, 0, 0);
130 XSelectInput(dpy
, parent
, KeyPressMask
|KeyReleaseMask
);
132 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
134 wwin
= wManageInternalWindow(scr
, parent
, None
, NULL
,
135 (scr
->scr_width
- 320)/2,
136 (scr
->scr_height
- 160)/2, 320, 160);
138 wwin
->client_leader
= WMWidgetXID(panel
->win
);
140 WMMapWidget(panel
->win
);
144 while (!panel
->done
) {
147 WMNextEvent(dpy
, &event
);
148 WMHandleEvent(&event
);
151 if (panel
->result
== WAPRDefault
)
152 result
= WMGetTextFieldText(panel
->text
);
156 wUnmanageWindow(wwin
, False
, False
);
158 WMDestroyInputPanel(panel
);
160 XDestroyWindow(dpy
, parent
);
175 *****************************************************************
176 * Icon Selection Panel
177 *****************************************************************
180 typedef struct IconPanel
{
193 WMButton
*previewButton
;
198 WMTextField
*fileField
;
201 WMButton
*cancelButton
;
203 WMButton
*chooseButton
;
213 listPixmaps(WScreen
*scr
, WMList
*lPtr
, char *path
)
215 struct dirent
*dentry
;
217 char pbuf
[PATH_MAX
+16];
219 IconPanel
*panel
= WMGetHangedData(lPtr
);
221 panel
->preview
= False
;
223 apath
= wexpandpath(path
);
224 dir
= opendir(apath
);
229 tmp
= _("Could not open directory ");
230 msg
= wmalloc(strlen(tmp
)+strlen(path
)+6);
234 wMessageDialog(scr
, _("Error"), msg
, _("OK"), NULL
, NULL
);
240 /* list contents in the column */
241 while ((dentry
= readdir(dir
))) {
244 if (strcmp(dentry
->d_name
, ".")==0 ||
245 strcmp(dentry
->d_name
, "..")==0)
250 strcat(pbuf
, dentry
->d_name
);
252 if (stat(pbuf
, &statb
)<0)
255 if (statb
.st_mode
& (S_IRUSR
|S_IRGRP
|S_IROTH
)
256 && statb
.st_mode
& (S_IFREG
|S_IFLNK
)) {
257 WMAddListItem(lPtr
, dentry
->d_name
);
260 WMSortListItems(lPtr
);
264 panel
->preview
= True
;
270 setViewedImage(IconPanel
*panel
, char *file
)
279 pixmap
= WMCreateBlendedPixmapFromFile(WMWidgetScreen(panel
->win
),
282 WMSetButtonEnabled(panel
->okButton
, False
);
284 WMSetLabelText(panel
->iconView
, _("Could not load image file "));
286 WMSetLabelImage(panel
->iconView
, NULL
);
288 WMSetButtonEnabled(panel
->okButton
, True
);
290 WMSetLabelText(panel
->iconView
, NULL
);
291 WMSetLabelImage(panel
->iconView
, pixmap
);
292 WMReleasePixmap(pixmap
);
298 listCallback(void *self
, void *data
)
300 WMList
*lPtr
= (WMList
*)self
;
301 IconPanel
*panel
= (IconPanel
*)data
;
304 if (lPtr
==panel
->dirList
) {
305 path
= WMGetListSelectedItem(lPtr
)->text
;
307 WMSetTextFieldText(panel
->fileField
, path
);
309 WMSetLabelImage(panel
->iconView
, NULL
);
311 WMSetButtonEnabled(panel
->okButton
, False
);
313 WMClearList(panel
->iconList
);
314 listPixmaps(panel
->scr
, panel
->iconList
, path
);
316 char *tmp
, *iconFile
;
318 path
= WMGetListSelectedItem(panel
->dirList
)->text
;
319 tmp
= wexpandpath(path
);
321 iconFile
= WMGetListSelectedItem(panel
->iconList
)->text
;
323 path
= wmalloc(strlen(tmp
)+strlen(iconFile
)+4);
326 strcat(path
, iconFile
);
328 WMSetTextFieldText(panel
->fileField
, path
);
329 setViewedImage(panel
, path
);
336 listIconPaths(WMList
*lPtr
)
341 paths
= wstrdup(wPreferences
.icon_path
);
343 path
= strtok(paths
, ":");
348 tmp
= wexpandpath(path
);
349 /* do not sort, because the order implies the order of
350 * directories searched */
351 if (access(tmp
, X_OK
)==0)
352 WMAddListItem(lPtr
, path
);
354 } while ((path
=strtok(NULL
, ":"))!=NULL
);
361 drawIconProc(WMList
*lPtr
, int index
, Drawable d
, char *text
,
362 int state
, WMRect
*rect
)
364 IconPanel
*panel
= WMGetHangedData(lPtr
);
365 GC gc
= panel
->scr
->draw_gc
;
366 GC copygc
= panel
->scr
->copy_gc
;
367 char *buffer
, *dirfile
;
372 WMScreen
*wmscr
=WMWidgetScreen(panel
->win
);
375 if(!panel
->preview
) return;
377 width
= rect
->size
.width
;
379 blackcolor
= WMBlackColor(wmscr
);
380 whitecolor
= WMWhiteColor(wmscr
);
382 dirfile
= wexpandpath(WMGetListSelectedItem(panel
->dirList
)->text
);
383 buffer
= wmalloc(strlen(dirfile
)+strlen(text
)+4);
384 sprintf(buffer
, "%s/%s", dirfile
, text
);
387 pixmap
= WMCreatePixmapFromFile(WMWidgetScreen(panel
->win
), buffer
);
390 WMRemoveListItem(lPtr
, index
);
394 XClearArea(dpy
, d
, rect
->pos
.x
, rect
->pos
.y
, width
, rect
->size
.height
,
396 XSetClipMask(dpy
, gc
, None
);
398 XDrawRectangle(dpy, d, WMColorGC(whitecolor), rect->pos.x + 5,
399 rect->pos.y +5, width - 10, 54);
401 XDrawLine(dpy
, d
, WMColorGC(whitecolor
), rect
->pos
.x
,
402 rect
->pos
.y
+rect
->size
.height
-1, rect
->pos
.x
+width
,
403 rect
->pos
.y
+rect
->size
.height
-1);
406 if (state
&WLDSSelected
) {
407 XFillRectangle(dpy
, d
, WMColorGC(whitecolor
), rect
->pos
.x
,
408 rect
->pos
.y
, width
, rect
->size
.height
);
411 size
= WMGetPixmapSize(pixmap
);
413 XSetClipMask(dpy
, copygc
, WMGetPixmapMaskXID(pixmap
));
414 XSetClipOrigin(dpy
, copygc
, rect
->pos
.x
+ (width
-size
.width
)/2,
416 XCopyArea(dpy
, WMGetPixmapXID(pixmap
), d
, copygc
, 0, 0,
417 size
.width
>100?100:size
.width
, size
.height
>64?64:size
.height
,
418 rect
->pos
.x
+ (width
-size
.width
)/2, rect
->pos
.y
+2);
422 int fheight
= WMFontHeight(panel
->normalfont
);
423 int tlen
= strlen(text
);
424 int twidth
= WMWidthOfString(panel
->normalfont
, text
, tlen
);
427 ofx
= rect
->pos
.x
+ (width
- twidth
)/2;
428 ofy
= rect
->pos
.y
+ 64 - fheight
;
432 WMDrawString(wmscr
, d
, WMColorGC(whitecolor
),
433 panel
->normalfont
, ofx
+i
, ofy
+j
,
436 WMDrawString(wmscr
, d
, WMColorGC(blackcolor
), panel
->normalfont
,
437 ofx
, ofy
, text
, tlen
);
440 WMReleasePixmap(pixmap
);
441 /* I hope it is better to do not use cache / on my box it is fast nuff */
444 WMReleaseColor(blackcolor
);
445 WMReleaseColor(whitecolor
);
450 buttonCallback(void *self
, void *clientData
)
452 WMButton
*bPtr
= (WMButton
*)self
;
453 IconPanel
*panel
= (IconPanel
*)clientData
;
456 if (bPtr
==panel
->okButton
) {
458 panel
->result
= True
;
459 } else if (bPtr
==panel
->cancelButton
) {
461 panel
->result
= False
;
462 } else if (bPtr
==panel
->previewButton
) {
463 /**** Previewer ****/
464 WMSetButtonEnabled(bPtr
, False
);
465 WMSetListUserDrawItemHeight(panel
->iconList
, 68);
466 WMSetListUserDrawProc(panel
->iconList
, drawIconProc
);
467 WMRedisplayWidget(panel
->iconList
);
468 /* for draw proc to access screen/gc */
469 /*** end preview ***/
472 else if (bPtr
==panel
->chooseButton
) {
475 op
= WMCreateOpenPanel(WMWidgetScreen(bPtr
));
477 if (WMRunModalFilePanelForDirectory(op
, NULL
, "/usr/local", NULL
, NULL
)) {
479 path
= WMGetFilePanelFile(op
);
480 WMSetTextFieldText(panel
->fileField
, path
);
481 setViewedImage(panel
, path
);
484 WMDestroyFilePanel(op
);
491 wIconChooserDialog(WScreen
*scr
, char **file
, char *instance
, char *class)
499 panel
= wmalloc(sizeof(IconPanel
));
500 memset(panel
, 0, sizeof(IconPanel
));
504 panel
->win
= WMCreateWindow(scr
->wmscreen
, "iconChooser");
505 WMResizeWidget(panel
->win
, 450, 280);
507 boldFont
= WMBoldSystemFontOfSize(scr
->wmscreen
, 12);
508 panel
->normalfont
= WMSystemFontOfSize(WMWidgetScreen(panel
->win
), 12);
510 panel
->dirLabel
= WMCreateLabel(panel
->win
);
511 WMResizeWidget(panel
->dirLabel
, 200, 20);
512 WMMoveWidget(panel
->dirLabel
, 10, 7);
513 WMSetLabelText(panel
->dirLabel
, _("Directories"));
514 WMSetLabelFont(panel
->dirLabel
, boldFont
);
515 WMSetLabelTextAlignment(panel
->dirLabel
, WACenter
);
517 WMSetLabelRelief(panel
->dirLabel
, WRSunken
);
519 panel
->iconLabel
= WMCreateLabel(panel
->win
);
520 WMResizeWidget(panel
->iconLabel
, 140, 20);
521 WMMoveWidget(panel
->iconLabel
, 215, 7);
522 WMSetLabelText(panel
->iconLabel
, _("Icons"));
523 WMSetLabelFont(panel
->iconLabel
, boldFont
);
524 WMSetLabelTextAlignment(panel
->iconLabel
, WACenter
);
526 WMReleaseFont(boldFont
);
528 color
= WMWhiteColor(scr
->wmscreen
);
529 WMSetLabelTextColor(panel
->dirLabel
, color
);
530 WMSetLabelTextColor(panel
->iconLabel
, color
);
531 WMReleaseColor(color
);
533 color
= WMDarkGrayColor(scr
->wmscreen
);
534 WMSetWidgetBackgroundColor(panel
->iconLabel
, color
);
535 WMSetWidgetBackgroundColor(panel
->dirLabel
, color
);
536 WMReleaseColor(color
);
538 WMSetLabelRelief(panel
->iconLabel
, WRSunken
);
540 panel
->dirList
= WMCreateList(panel
->win
);
541 WMResizeWidget(panel
->dirList
, 200, 170);
542 WMMoveWidget(panel
->dirList
, 10, 30);
543 WMSetListAction(panel
->dirList
, listCallback
, panel
);
545 panel
->iconList
= WMCreateList(panel
->win
);
546 WMResizeWidget(panel
->iconList
, 140, 170);
547 WMMoveWidget(panel
->iconList
, 215, 30);
548 WMSetListAction(panel
->iconList
, listCallback
, panel
);
550 WMHangData(panel
->iconList
,panel
);
552 panel
->previewButton
= WMCreateCommandButton(panel
->win
);
553 WMResizeWidget(panel
->previewButton
, 75, 26);
554 WMMoveWidget(panel
->previewButton
, 365, 130);
555 WMSetButtonText(panel
->previewButton
, _("Preview"));
556 WMSetButtonAction(panel
->previewButton
, buttonCallback
, panel
);
558 panel
->iconView
= WMCreateLabel(panel
->win
);
559 WMResizeWidget(panel
->iconView
, 75, 75);
560 WMMoveWidget(panel
->iconView
, 365, 40);
561 WMSetLabelImagePosition(panel
->iconView
, WIPOverlaps
);
562 WMSetLabelRelief(panel
->iconView
, WRSunken
);
563 WMSetLabelTextAlignment(panel
->iconView
, WACenter
);
565 panel
->fileLabel
= WMCreateLabel(panel
->win
);
566 WMResizeWidget(panel
->fileLabel
, 80, 20);
567 WMMoveWidget(panel
->fileLabel
, 10, 210);
568 WMSetLabelText(panel
->fileLabel
, _("File Name:"));
570 panel
->fileField
= WMCreateTextField(panel
->win
);
571 WMResizeWidget(panel
->fileField
, 345, 20);
572 WMMoveWidget(panel
->fileField
, 95, 210);
573 WMSetTextFieldEditable(panel
->fileField
, False
);
575 panel
->okButton
= WMCreateCommandButton(panel
->win
);
576 WMResizeWidget(panel
->okButton
, 80, 26);
577 WMMoveWidget(panel
->okButton
, 360, 240);
578 WMSetButtonText(panel
->okButton
, _("OK"));
579 WMSetButtonEnabled(panel
->okButton
, False
);
580 WMSetButtonAction(panel
->okButton
, buttonCallback
, panel
);
582 panel
->cancelButton
= WMCreateCommandButton(panel
->win
);
583 WMResizeWidget(panel
->cancelButton
, 80, 26);
584 WMMoveWidget(panel
->cancelButton
, 270, 240);
585 WMSetButtonText(panel
->cancelButton
, _("Cancel"));
586 WMSetButtonAction(panel
->cancelButton
, buttonCallback
, panel
);
588 panel
->chooseButton
= WMCreateCommandButton(panel
->win
);
589 WMResizeWidget(panel
->chooseButton
, 110, 26);
590 WMMoveWidget(panel
->chooseButton
, 150, 240);
591 WMSetButtonText(panel
->chooseButton
, _("Choose File"));
592 WMSetButtonAction(panel
->chooseButton
, buttonCallback
, panel
);
594 WMRealizeWidget(panel
->win
);
595 WMMapSubwidgets(panel
->win
);
597 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 450, 280, 0, 0, 0);
599 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
604 tmp
= wmalloc((instance
? strlen(instance
) : 0)
605 + (class ? strlen(class) : 0) + 32);
607 if (tmp
&& (instance
|| class))
608 sprintf(tmp
, "%s [%s.%s]", _("Icon Chooser"), instance
, class);
610 strcpy(tmp
, _("Icon Chooser"));
612 wwin
= wManageInternalWindow(scr
, parent
, None
, tmp
,
613 (scr
->scr_width
- 450)/2,
614 (scr
->scr_height
- 280)/2, 450, 280);
618 /* put icon paths in the list */
619 listIconPaths(panel
->dirList
);
621 WMMapWidget(panel
->win
);
625 while (!panel
->done
) {
628 WMNextEvent(dpy
, &event
);
629 WMHandleEvent(&event
);
633 char *defaultPath
, *wantedPath
;
635 /* check if the file the user selected is not the one that
636 * would be loaded by default with the current search path */
637 *file
= WMGetListSelectedItem(panel
->iconList
)->text
;
642 defaultPath
= FindImage(wPreferences
.icon_path
, *file
);
643 wantedPath
= WMGetTextFieldText(panel
->fileField
);
644 /* if the file is not the default, use full path */
645 if (strcmp(wantedPath
, defaultPath
)!=0) {
648 *file
= wstrdup(*file
);
657 WMReleaseFont(panel
->normalfont
);
659 WMUnmapWidget(panel
->win
);
661 WMDestroyWidget(panel
->win
);
663 wUnmanageWindow(wwin
, False
, False
);
667 XDestroyWindow(dpy
, parent
);
669 return panel
->result
;
674 ***********************************************************************
676 ***********************************************************************
710 #define COPYRIGHT_TEXT \
711 "Copyright \xa9 1997~2000 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
712 "Copyright \xa9 1998~2000 Dan Pascu <dan@windowmaker.org>"
716 static InfoPanel
*thePanel
= NULL
;
719 destroyInfoPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
722 if (thePanel
->timer
) {
723 WMDeleteTimerHandler(thePanel
->timer
);
725 if (thePanel
->oldPix
) {
726 WMReleasePixmap(thePanel
->oldPix
);
728 if (thePanel
->icon
) {
729 RDestroyImage(thePanel
->icon
);
732 RDestroyImage(thePanel
->pic
);
734 #endif /* SILLYNESS */
735 WMUnmapWidget(thePanel
);
737 wUnmanageWindow(thePanel
->wwin
, False
, False
);
739 WMDestroyWidget(thePanel
->win
);
748 renderText(WMScreen
*scr
, char *text
, char *font
, RColor
*from
, RColor
*to
)
750 WMPixmap
*wpix
= NULL
;
753 RContext
*rc
= WMScreenRContext(scr
);
754 XFontStruct
*f
= NULL
;
758 f
= XLoadQueryFont(dpy
, font
);
762 w
= XTextWidth(f
, text
, strlen(text
));
763 h
= f
->ascent
+f
->descent
;
765 mask
= XCreatePixmap(dpy
, rc
->drawable
, w
, h
, 1);
766 gc
= XCreateGC(dpy
, mask
, 0, NULL
);
767 XSetForeground(dpy
, gc
, 0);
768 XSetFont(dpy
, gc
, f
->fid
);
769 XFillRectangle(dpy
, mask
, gc
, 0, 0, w
, h
);
771 XSetForeground(dpy
, gc
, 1);
772 XDrawString(dpy
, mask
, gc
, 0, f
->ascent
, text
, strlen(text
));
773 XSetLineAttributes(dpy
, gc
, 3, LineSolid
, CapRound
, JoinMiter
);
774 XDrawLine(dpy
, mask
, gc
, 0, h
-2, w
, h
-2);
776 grad
= XCreatePixmap(dpy
, rc
->drawable
, w
, h
, rc
->depth
);
780 color
= WMBlackColor(scr
);
781 XFillRectangle(dpy
, grad
, WMColorGC(color
), 0, 0, w
, h
);
782 WMReleaseColor(color
);
785 wpix
= WMCreatePixmapFromXPixmaps(scr
, grad
, mask
, w
, h
, rc
->depth
);
796 extern WMPixmap
*DoXThing();
797 extern Bool
InitXThing();
800 logoPushCallback(void *data
)
802 InfoPanel
*panel
= (InfoPanel
*)data
;
806 static int jingobeu
[] = {
807 329, 150, -1, 100, 329, 150, -1, 100, 329, 300, -1, 250,
808 329, 150, -1, 100, 329, 150, -1, 100, 329, 300, -1, 250,
809 329, 150, 392, 150, 261, 150, 293, 150, 329, 400, -1, 400, 0
817 if(jingobeu
[panel
->x
-1]==0){panel
->x
=-1;}else if(jingobeu
[panel
->x
818 -1]<0){panel
->x
++;c
=jingobeu
[panel
->x
-1]/50;panel
->x
++;}else if(c
==0){
819 kc
.bell_pitch
=jingobeu
[panel
->x
-1];panel
->x
++;kc
.bell_percent
=50;c
=
820 jingobeu
[panel
->x
-1]/50;kc
.bell_duration
=jingobeu
[panel
->x
-1];panel
->x
++;
821 XChangeKeyboardControl(dpy
,KBBellPitch
|KBBellDuration
|KBBellPercent
,&kc
);
822 XBell(dpy
,50);XFlush(dpy
);}else{c
--;}}
823 if (!(panel
->cycle
% 4)) {
826 p
= DoXThing(panel
->wwin
);
827 WMSetLabelImage(panel
->logoL
, p
);
829 } else if (panel
->cycle
< 30) {
833 image
= RCloneImage(panel
->icon
);
834 RCombineImagesWithOpaqueness(image
, panel
->pic
, panel
->cycle
*255/30);
835 pix
= WMCreatePixmapFromRImage(panel
->scr
->wmscreen
, image
, 128);
836 RDestroyImage(image
);
837 WMSetLabelImage(panel
->logoL
, pix
);
838 WMReleasePixmap(pix
);
841 i
= panel
->cycle
%200;
843 len
= strlen(panel
->str
);
845 strncpy(buffer
, panel
->str
, i
<len
? i
: len
);
847 memset(&buffer
[len
], ' ', i
-len
);
849 strncpy(buffer
, panel
->str
, i
<len
? i
: len
);
851 memset(&buffer
[len
], ' ', i
-len
);
853 WMSetLabelText(panel
->versionL
, buffer
);
855 panel
->timer
= WMAddTimerHandler(50, logoPushCallback
, panel
);
861 handleLogoPush(XEvent
*event
, void *data
)
863 InfoPanel
*panel
= (InfoPanel
*)data
;
864 static int broken
= 0;
865 static int clicks
= 0;
866 static char *pic_data
[] = {
926 " ....XoO+@##+O$%.... ",
927 " ...%X&*========-;;:o... ",
928 " ...>.>,<122222222222134@... ",
929 " ..>5678912222222222222220q%.. ",
930 " ..$.&-w2222222222222222222er>.. ",
931 " ..O.t31222222222222222222222y4>.. ",
932 " ...O5u3222222222222222222222222yri... ",
933 " ..>p&a22222222222222222222222222wso.. ",
934 " ..ids91222222222222222222222222222wfi.. ",
935 " ..X.7w222222wgs-w2222222213=g0222222<hi.. ",
936 " ..Xuj2222222<@X5=222222229k@l:022222y4i.. ",
937 " .Xdz22222222*X%.s22222222axo%$-222222<c>.. ",
938 " ..o7y22222222v...r222222223hX.i82222221si.. ",
939 "..io*222222222&...u22222222yt..%*22222220:%. ",
940 "..>k02222222227...f222222222v..X=222222229t. ",
941 "..dz12222222220ui:y2222222223d%qw222222221g. ",
942 ".%vw222222222221y2222222222219*y2222222222wd.",
943 ".X;2222222222222222222222222222222222222222b.",
944 ".i*2222222222222222222222222222222222222222v.",
945 ".i*2222222222222222222222222222222222222222;.",
946 ".i*22222222222222222222222222222222222222228.",
947 ".>*2222222222222222222222222222222222222222=.",
948 ".i*22222222222222222222222222222222222222228.",
949 ".i*2222222222222222222222222222222222222222;.",
950 ".X*222222222222222222222222222222we12222222r.",
951 ".Xs12222222w3aw22222222222222222y8s0222222wk.",
952 ".Xq02222222a,na22222222222222222zm6zwy2222gi.",
953 "..>*22222y<:Xcj22222222222222222-o$k;;02228..",
954 "..i7y2220rhX.:y22222222222222222jtiXd,a220,..",
955 " .X@z222a,do%kj2222222222222222wMX5q;gw228%..",
956 " ..58222wagsh6ry222222222222221;>Of0w222y:...",
957 " ...:e2222218mdz22222222222222a&$vw222220@...",
958 " ...O-122222y:.u02222222222229q$uj222221r... ",
959 " ..%&a1222223&573w2222222219NOxz122221z>... ",
960 " ...t3222221-l$nr8ay1222yzbo,=12222w-5... ",
961 " ..X:022222w-k+>o,7s**s7xOn=12221<f5... ",
962 " ..o:9222221j8:&Bl>>>>ihv<12221=dX... ",
963 " ..Xb9122222109g-****;<y22221zn%... ",
964 " ..X&801222222222222222222w-h.... ",
965 " ...o:=022222222222222221=lX... ",
966 " ..X@:;3w2222222222210fO... ",
967 " ...XX&v8<30000003-N@... ",
968 " .....XmnbN:q&Bo.... ",
970 static char *msgs
[] = {
976 if (!panel
->timer
&& !broken
&& clicks
> 0) {
983 file
= wDefaultGetIconFile(panel
->scr
, "Logo", "WMPanel", False
);
989 path
= FindImage(wPreferences
.icon_path
, file
);
995 panel
->icon
= RLoadImage(panel
->scr
->rcontext
, path
, 0);
1003 panel
->pic
= RGetImageFromXPMData(panel
->scr
->rcontext
, pic_data
);
1004 if (!panel
->pic
|| panel
->icon
->width
!=panel
->pic
->width
1005 || panel
->icon
->height
!=panel
->pic
->height
) {
1007 RDestroyImage(panel
->icon
);
1010 RDestroyImage(panel
->pic
);
1022 RCombineImageWithColor(panel
->icon
, &color
);
1023 RCombineImageWithColor(panel
->pic
, &color
);
1027 panel
->str
= msgs
[rand()%(sizeof(msgs
)/sizeof(char*))];
1029 panel
->timer
= WMAddTimerHandler(50, logoPushCallback
, panel
);
1031 panel
->oldPix
= WMRetainPixmap(WMGetLabelImage(panel
->logoL
));
1032 } else if (panel
->timer
) {
1037 WMSetLabelImage(panel
->logoL
, panel
->oldPix
);
1038 WMReleasePixmap(panel
->oldPix
);
1039 panel
->oldPix
= NULL
;
1041 WMDeleteTimerHandler(panel
->timer
);
1042 panel
->timer
= NULL
;
1044 sprintf(version
, "Version %s", VERSION
);
1045 WMSetLabelText(panel
->versionL
, version
);
1050 while (XCheckTypedWindowEvent(dpy
, WMWidgetXID(panel
->versionL
),
1054 #endif /* SILLYNESS */
1058 wShowInfoPanel(WScreen
*scr
)
1068 RColor color1
, color2
;
1082 if (thePanel
->scr
== scr
) {
1083 wRaiseFrame(thePanel
->wwin
->frame
->core
);
1084 wSetFocusTo(scr
, thePanel
->wwin
);
1089 panel
= wmalloc(sizeof(InfoPanel
));
1090 memset(panel
, 0, sizeof(InfoPanel
));
1094 panel
->win
= WMCreateWindow(scr
->wmscreen
, "info");
1095 WMResizeWidget(panel
->win
, 382, 230);
1097 logo
= WMGetApplicationIconImage(scr
->wmscreen
);
1099 size
= WMGetPixmapSize(logo
);
1100 panel
->logoL
= WMCreateLabel(panel
->win
);
1101 WMResizeWidget(panel
->logoL
, 64, 64);
1102 WMMoveWidget(panel
->logoL
, 30, 20);
1103 WMSetLabelImagePosition(panel
->logoL
, WIPImageOnly
);
1104 WMSetLabelImage(panel
->logoL
, logo
);
1106 WMCreateEventHandler(WMWidgetView(panel
->logoL
), ButtonPressMask
,
1107 handleLogoPush
, panel
);
1111 panel
->name1L
= WMCreateLabel(panel
->win
);
1112 WMResizeWidget(panel
->name1L
, 240, 30);
1113 WMMoveWidget(panel
->name1L
, 100, 30);
1118 color2
.green
= 0x50;
1120 logo
= renderText(scr
->wmscreen
, "GNU Window Maker",
1121 "-*-utopia-*-r-*-*-25-*", &color1
, &color2
);
1123 WMSetLabelImagePosition(panel
->name1L
, WIPImageOnly
);
1124 WMSetLabelImage(panel
->name1L
, logo
);
1125 WMReleasePixmap(logo
);
1127 font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 20);
1129 WMSetLabelFont(panel
->name1L
, font
);
1130 WMReleaseFont(font
);
1132 WMSetLabelTextAlignment(panel
->name1L
, WACenter
);
1133 WMSetLabelText(panel
->name1L
, "GNU Window Maker");
1136 panel
->name2L
= WMCreateLabel(panel
->win
);
1137 WMResizeWidget(panel
->name2L
, 240, 24);
1138 WMMoveWidget(panel
->name2L
, 100, 60);
1139 font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 18);
1141 WMSetLabelFont(panel
->name2L
, font
);
1142 WMReleaseFont(font
);
1145 WMSetLabelTextAlignment(panel
->name2L
, WACenter
);
1146 WMSetLabelText(panel
->name2L
, "Window Manager for X");
1149 sprintf(version
, "Version %s", VERSION
);
1150 panel
->versionL
= WMCreateLabel(panel
->win
);
1151 WMResizeWidget(panel
->versionL
, 310, 16);
1152 WMMoveWidget(panel
->versionL
, 30, 95);
1153 WMSetLabelTextAlignment(panel
->versionL
, WARight
);
1154 WMSetLabelText(panel
->versionL
, version
);
1155 WMSetLabelWraps(panel
->versionL
, False
);
1157 panel
->copyrL
= WMCreateLabel(panel
->win
);
1158 WMResizeWidget(panel
->copyrL
, 340, 40);
1159 WMMoveWidget(panel
->copyrL
, 15, 185);
1160 WMSetLabelTextAlignment(panel
->copyrL
, WALeft
);
1161 WMSetLabelText(panel
->copyrL
, COPYRIGHT_TEXT
);
1162 /* we want the (c) character in the helvetica font */
1163 font
= WMCreateNormalFont(scr
->wmscreen
, HELVETICA10_FONT
);
1165 WMSetLabelFont(panel
->copyrL
, font
);
1168 switch (scr
->w_depth
) {
1170 strcpy(version
, "32 thousand");
1173 strcpy(version
, "64 thousand");
1177 strcpy(version
, "16 million");
1180 sprintf(version
, "%d", 1<<scr
->w_depth
);
1184 sprintf(buffer
, "Using visual 0x%x: %s %ibpp (%s colors)\n",
1185 (unsigned)scr
->w_visual
->visualid
,
1186 visuals
[scr
->w_visual
->class], scr
->w_depth
, version
);
1188 #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
1190 struct mallinfo ma
= mallinfo();
1191 sprintf(buffer
+strlen(buffer
),
1192 "Total allocated memory: %i kB. Total memory in use: %i kB.\n",
1193 (ma
.arena
+ma
.hblkhd
)/1024, (ma
.uordblks
+ma
.hblkhd
)/1024);
1198 strcat(buffer
, "Supported image formats: ");
1199 strl
= RSupportedFileFormats();
1200 for (i
=0; strl
[i
]!=NULL
; i
++) {
1201 strcat(buffer
, strl
[i
]);
1202 strcat(buffer
, " ");
1205 strcat(buffer
, "\nAdditional Support For: ");
1218 list
[j
++] = "GNOME";
1224 list
[j
++] = "Sound";
1228 for (i
= 0; i
< j
; i
++) {
1231 strcat(buf
, " and ");
1235 strcat(buf
, list
[i
]);
1237 strcat(buffer
, buf
);
1241 panel
->infoL
= WMCreateLabel(panel
->win
);
1242 WMResizeWidget(panel
->infoL
, 350, 75);
1243 WMMoveWidget(panel
->infoL
, 15, 115);
1244 WMSetLabelText(panel
->infoL
, buffer
);
1246 WMSetLabelFont(panel
->infoL
, font
);
1247 WMReleaseFont(font
);
1251 WMRealizeWidget(panel
->win
);
1252 WMMapSubwidgets(panel
->win
);
1254 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 382, 230, 0, 0, 0);
1256 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1258 WMMapWidget(panel
->win
);
1260 wwin
= wManageInternalWindow(scr
, parent
, None
, "Info",
1261 (scr
->scr_width
- 382)/2,
1262 (scr
->scr_height
- 230)/2, 382, 230);
1264 WSETUFLAG(wwin
, no_closable
, 0);
1265 WSETUFLAG(wwin
, no_close_button
, 0);
1266 #ifdef XKB_BUTTON_HINT
1267 wFrameWindowHideButton(wwin
->frame
, WFF_LANGUAGE_BUTTON
);
1269 wWindowUpdateButtonImages(wwin
);
1270 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1271 wwin
->frame
->on_click_right
= destroyInfoPanel
;
1279 if (InitXThing(panel
->scr
)) {
1280 panel
->timer
= WMAddTimerHandler(100, logoPushCallback
, panel
);
1283 panel
->str
= "Merry Christmas!";
1284 panel
->oldPix
= WMRetainPixmap(WMGetLabelImage(panel
->logoL
));
1291 ***********************************************************************
1293 ***********************************************************************
1308 #define LICENSE_TEXT \
1309 " Window Maker is free software; you can redistribute it and/or modify "\
1310 "it under the terms of the GNU General Public License as published "\
1311 "by the Free Software Foundation; either version 2 of the License, "\
1312 "or (at your option) any later version.\n\n\n"\
1313 " Window Maker is distributed in the hope that it will be useful, but "\
1314 "WITHOUT ANY WARRANTY; without even the implied warranty of "\
1315 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "\
1316 "General Public License for more details.\n\n\n"\
1317 " You should have received a copy of the GNU General Public License "\
1318 "along with this program; if not, write to the Free Software "\
1319 "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA "\
1323 static LegalPanel
*legalPanel
= NULL
;
1326 destroyLegalPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
1328 WMUnmapWidget(legalPanel
->win
);
1330 WMDestroyWidget(legalPanel
->win
);
1332 wUnmanageWindow(legalPanel
->wwin
, False
, False
);
1341 wShowLegalPanel(WScreen
*scr
)
1348 if (legalPanel
->scr
== scr
) {
1349 wRaiseFrame(legalPanel
->wwin
->frame
->core
);
1350 wSetFocusTo(scr
, legalPanel
->wwin
);
1355 panel
= wmalloc(sizeof(LegalPanel
));
1359 panel
->win
= WMCreateWindow(scr
->wmscreen
, "legal");
1360 WMResizeWidget(panel
->win
, 420, 250);
1363 panel
->licenseL
= WMCreateLabel(panel
->win
);
1364 WMResizeWidget(panel
->licenseL
, 400, 230);
1365 WMMoveWidget(panel
->licenseL
, 10, 10);
1366 WMSetLabelTextAlignment(panel
->licenseL
, WALeft
);
1367 WMSetLabelText(panel
->licenseL
, LICENSE_TEXT
);
1368 WMSetLabelRelief(panel
->licenseL
, WRGroove
);
1370 WMRealizeWidget(panel
->win
);
1371 WMMapSubwidgets(panel
->win
);
1373 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 420, 250, 0, 0, 0);
1375 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1377 wwin
= wManageInternalWindow(scr
, parent
, None
, "Legal",
1378 (scr
->scr_width
- 420)/2,
1379 (scr
->scr_height
- 250)/2, 420, 250);
1381 WSETUFLAG(wwin
, no_closable
, 0);
1382 WSETUFLAG(wwin
, no_close_button
, 0);
1383 wWindowUpdateButtonImages(wwin
);
1384 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1385 #ifdef XKB_BUTTON_HINT
1386 wFrameWindowHideButton(wwin
->frame
, WFF_LANGUAGE_BUTTON
);
1388 wwin
->frame
->on_click_right
= destroyLegalPanel
;
1392 WMMapWidget(panel
->win
);
1401 ***********************************************************************
1402 * Crashing Dialog Panel
1403 ***********************************************************************
1406 extern WDDomain
*WDWindowAttributes
;
1409 typedef struct _CrashPanel
{
1410 WMWindow
*win
; /* main window */
1412 WMLabel
*iconL
; /* application icon */
1413 WMLabel
*nameL
; /* title of panel */
1415 WMFrame
*sepF
; /* separator frame */
1417 WMLabel
*noteL
; /* Title of note */
1418 WMLabel
*note2L
; /* body of note with what happened */
1420 WMFrame
*whatF
; /* "what to do next" frame */
1421 WMPopUpButton
*whatP
; /* action selection popup button */
1423 WMButton
*okB
; /* ok button */
1425 Bool done
; /* if finished with this dialog */
1426 int action
; /* what to do after */
1434 handleKeyPress(XEvent
*event
, void *clientData
)
1436 CrashPanel
*panel
= (CrashPanel
*)clientData
;
1438 if (event
->xkey
.keycode
== panel
->retKey
) {
1439 WMPerformButtonClick(panel
->okB
);
1445 okButtonCallback(void *self
, void *clientData
)
1447 CrashPanel
*panel
= (CrashPanel
*)clientData
;
1454 setCrashAction(void *self
, void *clientData
)
1456 WMPopUpButton
*pop
= (WMPopUpButton
*)self
;
1457 CrashPanel
*panel
= (CrashPanel
*)clientData
;
1459 panel
->action
= WMGetPopUpButtonSelectedItem(pop
);
1464 getWindowMakerIconImage(WMScreen
*scr
)
1466 proplist_t dict
, key
, option
, value
=NULL
;
1470 PLSetStringCmpHook(NULL
);
1472 key
= PLMakeString("Logo.WMPanel");
1473 option
= PLMakeString("Icon");
1475 dict
= PLGetDictionaryEntry(WDWindowAttributes
->dictionary
, key
);
1478 value
= PLGetDictionaryEntry(dict
, option
);
1484 PLSetStringCmpHook(StringCompareHook
);
1486 if (value
&& PLIsString(value
)) {
1487 path
= FindImage(wPreferences
.icon_path
, PLGetString(value
));
1492 image
= RLoadImage(WMScreenRContext(scr
), path
, 0);
1494 pix
= WMCreatePixmapFromRImage(scr
, image
, 0);
1495 RDestroyImage(image
);
1510 wShowCrashingDialogPanel(int whatSig
)
1516 int screen_no
, scr_width
, scr_height
;
1520 panel
= wmalloc(sizeof(CrashPanel
));
1521 memset(panel
, 0, sizeof(CrashPanel
));
1523 screen_no
= DefaultScreen(dpy
);
1524 scr_width
= WidthOfScreen(ScreenOfDisplay(dpy
, screen_no
));
1525 scr_height
= HeightOfScreen(ScreenOfDisplay(dpy
, screen_no
));
1527 scr
= WMCreateScreen(dpy
, screen_no
);
1529 wsyserror(_("cannot open connection for crashing dialog panel. Aborting."));
1533 panel
->retKey
= XKeysymToKeycode(dpy
, XK_Return
);
1535 panel
->win
= WMCreateWindow(scr
, "crashingDialog");
1536 WMResizeWidget(panel
->win
, PWIDTH
, PHEIGHT
);
1537 WMMoveWidget(panel
->win
, (scr_width
- PWIDTH
)/2, (scr_height
- PHEIGHT
)/2);
1539 logo
= getWindowMakerIconImage(scr
);
1541 panel
->iconL
= WMCreateLabel(panel
->win
);
1542 WMResizeWidget(panel
->iconL
, 64, 64);
1543 WMMoveWidget(panel
->iconL
, 10, 10);
1544 WMSetLabelImagePosition(panel
->iconL
, WIPImageOnly
);
1545 WMSetLabelImage(panel
->iconL
, logo
);
1548 panel
->nameL
= WMCreateLabel(panel
->win
);
1549 WMResizeWidget(panel
->nameL
, 190, 18);
1550 WMMoveWidget(panel
->nameL
, 80, 35);
1551 WMSetLabelTextAlignment(panel
->nameL
, WALeft
);
1552 font
= WMBoldSystemFontOfSize(scr
, 18);
1553 WMSetLabelFont(panel
->nameL
, font
);
1554 WMReleaseFont(font
);
1555 WMSetLabelText(panel
->nameL
, _("Fatal error"));
1557 panel
->sepF
= WMCreateFrame(panel
->win
);
1558 WMResizeWidget(panel
->sepF
, PWIDTH
+4, 2);
1559 WMMoveWidget(panel
->sepF
, -2, 80);
1561 panel
->noteL
= WMCreateLabel(panel
->win
);
1562 WMResizeWidget(panel
->noteL
, PWIDTH
-20, 40);
1563 WMMoveWidget(panel
->noteL
, 10, 90);
1564 WMSetLabelTextAlignment(panel
->noteL
, WAJustified
);
1565 #ifdef SYS_SIGLIST_DECLARED
1566 sprintf(buf
, _("Window Maker received signal %i\n(%s)."),
1567 whatSig
, sys_siglist
[whatSig
]);
1569 sprintf(buf
, _("Window Maker received signal %i."), whatSig
);
1571 WMSetLabelText(panel
->noteL
, buf
);
1573 panel
->note2L
= WMCreateLabel(panel
->win
);
1574 WMResizeWidget(panel
->note2L
, PWIDTH
-20, 100);
1575 WMMoveWidget(panel
->note2L
, 10, 130);
1576 WMSetLabelTextAlignment(panel
->note2L
, WALeft
);
1577 WMSetLabelText(panel
->note2L
,
1578 _(" This fatal error occured probably due to a bug."
1579 " Please fill the included BUGFORM and "
1580 "report it to bugs@windowmaker.org."));
1583 panel
->whatF
= WMCreateFrame(panel
->win
);
1584 WMResizeWidget(panel
->whatF
, PWIDTH
-20, 50);
1585 WMMoveWidget(panel
->whatF
, 10, 240);
1586 WMSetFrameTitle(panel
->whatF
, _("What do you want to do now?"));
1588 panel
->whatP
= WMCreatePopUpButton(panel
->whatF
);
1589 WMResizeWidget(panel
->whatP
, PWIDTH
-20-70, 20);
1590 WMMoveWidget(panel
->whatP
, 35, 20);
1591 WMSetPopUpButtonPullsDown(panel
->whatP
, False
);
1592 WMSetPopUpButtonText(panel
->whatP
, _("Select action"));
1593 WMAddPopUpButtonItem(panel
->whatP
, _("Abort and leave a core file"));
1594 WMAddPopUpButtonItem(panel
->whatP
, _("Restart Window Maker"));
1595 WMAddPopUpButtonItem(panel
->whatP
, _("Start alternate window manager"));
1596 WMSetPopUpButtonAction(panel
->whatP
, setCrashAction
, panel
);
1597 WMSetPopUpButtonSelectedItem(panel
->whatP
, WMRestart
);
1598 panel
->action
= WMRestart
;
1600 WMMapSubwidgets(panel
->whatF
);
1602 panel
->okB
= WMCreateCommandButton(panel
->win
);
1603 WMResizeWidget(panel
->okB
, 80, 26);
1604 WMMoveWidget(panel
->okB
, 205, 309);
1605 WMSetButtonText(panel
->okB
, _("OK"));
1606 WMSetButtonImage(panel
->okB
, WMGetSystemPixmap(scr
, WSIReturnArrow
));
1607 WMSetButtonAltImage(panel
->okB
, WMGetSystemPixmap(scr
, WSIHighlightedReturnArrow
));
1608 WMSetButtonImagePosition(panel
->okB
, WIPRight
);
1609 WMSetButtonAction(panel
->okB
, okButtonCallback
, panel
);
1613 WMCreateEventHandler(WMWidgetView(panel
->win
), KeyPressMask
,
1614 handleKeyPress
, panel
);
1616 WMRealizeWidget(panel
->win
);
1617 WMMapSubwidgets(panel
->win
);
1619 WMMapWidget(panel
->win
);
1621 XSetInputFocus(dpy
, WMWidgetXID(panel
->win
), RevertToParent
, CurrentTime
);
1623 while (!panel
->done
) {
1626 WMNextEvent(dpy
, &event
);
1627 WMHandleEvent(&event
);
1630 action
= panel
->action
;
1632 WMUnmapWidget(panel
->win
);
1633 WMDestroyWidget(panel
->win
);
1642 /*****************************************************************************
1643 * About GNUstep Panel
1644 *****************************************************************************/
1648 drawGNUstepLogo(Display
*dpy
, Drawable d
, int width
, int height
,
1649 unsigned long blackPixel
, unsigned long whitePixel
)
1653 XRectangle rects
[3];
1655 gcv
.foreground
= blackPixel
;
1656 gc
= XCreateGC(dpy
, d
, GCForeground
, &gcv
);
1658 XFillArc(dpy
, d
, gc
, width
/45, height
/45,
1659 width
- 2*width
/45, height
- 2*height
/45, 0, 360*64);
1662 rects
[0].y
= 37*height
/45;
1663 rects
[0].width
= width
/3;
1664 rects
[0].height
= height
- rects
[0].y
;
1666 rects
[1].x
= rects
[0].width
;
1667 rects
[1].y
= height
/2;
1668 rects
[1].width
= width
- 2*width
/3;
1669 rects
[1].height
= height
- rects
[1].y
;
1671 rects
[2].x
= 2*width
/3;
1672 rects
[2].y
= height
- 37*height
/45;
1673 rects
[2].width
= width
/3;
1674 rects
[2].height
= height
- rects
[2].y
;
1676 XSetClipRectangles(dpy
, gc
, 0, 0, rects
, 3, Unsorted
);
1677 XFillRectangle(dpy
, d
, gc
, 0, 0, width
, height
);
1679 XSetForeground(dpy
, gc
, whitePixel
);
1680 XFillArc(dpy
, d
, gc
, width
/45, height
/45,
1681 width
- 2*width
/45, height
- 2*height
/45, 0, 360*64);
1688 #define GNUSTEP_TEXT \
1689 "Window Maker is part of the GNUstep project.\n"\
1690 "The GNUstep project aims to create a free\n"\
1691 "implementation of the OpenStep(tm) specification\n"\
1692 "which is a object-oriented framework for\n"\
1693 "creating advanced graphical, multi-platform\n"\
1694 "applications. Additionally, a development and\n"\
1695 "user desktop enviroment will be created on top\n"\
1696 "of the framework. For more information about\n"\
1697 "GNUstep, please visit: www.gnustep.org"
1712 static GNUstepPanel
*gnustepPanel
= NULL
;
1715 destroyGNUstepPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
1717 WMUnmapWidget(gnustepPanel
->win
);
1719 WMDestroyWidget(gnustepPanel
->win
);
1721 wUnmanageWindow(gnustepPanel
->wwin
, False
, False
);
1725 gnustepPanel
= NULL
;
1730 wShowGNUstepPanel(WScreen
*scr
)
1732 GNUstepPanel
*panel
;
1739 if (gnustepPanel
->scr
== scr
) {
1740 wRaiseFrame(gnustepPanel
->wwin
->frame
->core
);
1741 wSetFocusTo(scr
, gnustepPanel
->wwin
);
1746 panel
= wmalloc(sizeof(GNUstepPanel
));
1750 panel
->win
= WMCreateWindow(scr
->wmscreen
, "About GNUstep");
1751 WMResizeWidget(panel
->win
, 325, 200);
1753 pixmap
= WMCreatePixmap(scr
->wmscreen
, 130, 130,
1754 WMScreenDepth(scr
->wmscreen
), True
);
1756 color
= WMCreateNamedColor(scr
->wmscreen
, "gray50", True
);
1758 drawGNUstepLogo(dpy
, WMGetPixmapXID(pixmap
), 130, 130,
1759 WMColorPixel(color
), scr
->white_pixel
);
1761 WMReleaseColor(color
);
1763 XSetForeground(dpy
, scr
->mono_gc
, 0);
1764 XFillRectangle(dpy
, WMGetPixmapMaskXID(pixmap
), scr
->mono_gc
, 0, 0,
1766 drawGNUstepLogo(dpy
, WMGetPixmapMaskXID(pixmap
), 130, 130, 1, 1);
1768 panel
->gstepL
= WMCreateLabel(panel
->win
);
1769 WMResizeWidget(panel
->gstepL
, 285, 64);
1770 WMMoveWidget(panel
->gstepL
, 20, 0);
1771 WMSetLabelTextAlignment(panel
->gstepL
, WARight
);
1772 WMSetLabelText(panel
->gstepL
, "GNUstep");
1774 WMFont
*font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 24);
1776 WMSetLabelFont(panel
->gstepL
, font
);
1777 WMReleaseFont(font
);
1780 panel
->textL
= WMCreateLabel(panel
->win
);
1781 WMResizeWidget(panel
->textL
, 275, 130);
1782 WMMoveWidget(panel
->textL
, 30, 50);
1783 WMSetLabelTextAlignment(panel
->textL
, WARight
);
1784 WMSetLabelImagePosition(panel
->textL
, WIPOverlaps
);
1785 WMSetLabelText(panel
->textL
, GNUSTEP_TEXT
);
1786 WMSetLabelImage(panel
->textL
, pixmap
);
1788 WMReleasePixmap(pixmap
);
1790 WMRealizeWidget(panel
->win
);
1791 WMMapSubwidgets(panel
->win
);
1793 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 325, 200, 0, 0, 0);
1795 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1797 wwin
= wManageInternalWindow(scr
, parent
, None
, "About GNUstep",
1798 (scr
->scr_width
- 325)/2,
1799 (scr
->scr_height
- 200)/2, 325, 200);
1801 WSETUFLAG(wwin
, no_closable
, 0);
1802 WSETUFLAG(wwin
, no_close_button
, 0);
1803 wWindowUpdateButtonImages(wwin
);
1804 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1805 #ifdef XKB_BUTTON_HINT
1806 wFrameWindowHideButton(wwin
->frame
, WFF_LANGUAGE_BUTTON
);
1808 wwin
->frame
->on_click_right
= destroyGNUstepPanel
;
1812 WMMapWidget(panel
->win
);
1816 gnustepPanel
= panel
;