1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-05 21:34:17 +01:00

added contrib/ directory, updated WPrefs and wmsetbg for smoothed

backgrounds, added GNUstep info panel, added patch for
saving menu position state
This commit is contained in:
kojima
1999-05-01 17:44:43 +00:00
parent cfef89e920
commit c2434e8925
45 changed files with 2945 additions and 1640 deletions

View File

@@ -1221,8 +1221,10 @@ wShowLegalPanel(WScreen *scr)
WWindow *wwin;
if (legalPanel) {
wRaiseFrame(legalPanel->wwin->frame->core);
wSetFocusTo(scr, legalPanel->wwin);
if (legalPanel->scr == scr) {
wRaiseFrame(legalPanel->wwin->frame->core);
wSetFocusTo(scr, legalPanel->wwin);
}
return;
}
@@ -1508,3 +1510,175 @@ wShowCrashingDialogPanel(int whatSig)
}
/*****************************************************************************
* About GNUstep Panel
*****************************************************************************/
static void
drawGNUstepLogo(Display *dpy, Drawable d, int width, int height,
unsigned long blackPixel, unsigned long whitePixel)
{
GC gc;
XGCValues gcv;
XRectangle rects[3];
gcv.foreground = blackPixel;
gc = XCreateGC(dpy, d, GCForeground, &gcv);
XFillArc(dpy, d, gc, width/45, height/45,
width - 2*width/45, height - 2*height/45, 0, 360*64);
rects[0].x = 0;
rects[0].y = 37*height/45;
rects[0].width = width/3;
rects[0].height = height - rects[0].y;
rects[1].x = rects[0].width;
rects[1].y = height/2;
rects[1].width = width - 2*width/3;
rects[1].height = height - rects[1].y;
rects[2].x = 2*width/3;
rects[2].y = height - 37*height/45;
rects[2].width = width/3;
rects[2].height = height - rects[2].y;
XSetClipRectangles(dpy, gc, 0, 0, rects, 3, Unsorted);
XFillRectangle(dpy, d, gc, 0, 0, width, height);
XSetForeground(dpy, gc, whitePixel);
XFillArc(dpy, d, gc, width/45, height/45,
width - 2*width/45, height - 2*height/45, 0, 360*64);
XFreeGC(dpy, gc);
}
#define GNUSTEP_TEXT \
"Window Maker is part of the GNUstep project.\n"\
"The GNUstep project aims to create a free\n"\
"implementation of the OpenStep(tm) specification\n"\
"which is a object-oriented framework for\n"\
"creating advanced graphical, multi-platform\n"\
"applications. Aditionally, a development and\n"\
"user desktop enviroment will be created on top\n"\
"of the framework. For more information about\n"\
"GNUstep, please visit: www.gnustep.org"
typedef struct {
WScreen *scr;
WWindow *wwin;
WMWindow *win;
WMLabel *gstepL;
WMLabel *textL;
} GNUstepPanel;
static GNUstepPanel *gnustepPanel = NULL;
static void
destroyGNUstepPanel(WCoreWindow *foo, void *data, XEvent *event)
{
WMUnmapWidget(gnustepPanel->win);
WMDestroyWidget(gnustepPanel->win);
wUnmanageWindow(gnustepPanel->wwin, False, False);
free(gnustepPanel);
gnustepPanel = NULL;
}
void
wShowGNUstepPanel(WScreen *scr)
{
GNUstepPanel *panel;
Window parent;
WWindow *wwin;
WMPixmap *pixmap;
WMColor *color;
if (gnustepPanel) {
if (gnustepPanel->scr == scr) {
wRaiseFrame(gnustepPanel->wwin->frame->core);
wSetFocusTo(scr, gnustepPanel->wwin);
}
return;
}
panel = wmalloc(sizeof(GNUstepPanel));
panel->scr = scr;
panel->win = WMCreateWindow(scr->wmscreen, "About GNUstep");
WMResizeWidget(panel->win, 325, 200);
pixmap = WMCreatePixmap(scr->wmscreen, 130, 130,
WMScreenDepth(scr->wmscreen), True);
color = WMCreateNamedColor(scr->wmscreen, "gray50", True);
drawGNUstepLogo(dpy, WMGetPixmapXID(pixmap), 130, 130,
WMColorPixel(color), scr->white_pixel);
WMReleaseColor(color);
drawGNUstepLogo(dpy, WMGetPixmapMaskXID(pixmap), 130, 130, 1, 1);
panel->gstepL = WMCreateLabel(panel->win);
WMResizeWidget(panel->gstepL, 285, 64);
WMMoveWidget(panel->gstepL, 20, 0);
WMSetLabelTextAlignment(panel->gstepL, WARight);
WMSetLabelText(panel->gstepL, "GNUstep");
{
WMFont *font = WMBoldSystemFontOfSize(scr->wmscreen, 24);
WMSetLabelFont(panel->gstepL, font);
WMReleaseFont(font);
}
panel->textL = WMCreateLabel(panel->win);
WMResizeWidget(panel->textL, 275, 130);
WMMoveWidget(panel->textL, 30, 50);
WMSetLabelTextAlignment(panel->textL, WARight);
WMSetLabelImagePosition(panel->textL, WIPOverlaps);
WMSetLabelText(panel->textL, GNUSTEP_TEXT);
WMSetLabelImage(panel->textL, pixmap);
WMReleasePixmap(pixmap);
WMRealizeWidget(panel->win);
WMMapSubwidgets(panel->win);
parent = XCreateSimpleWindow(dpy, scr->root_win, 0, 0, 325, 200, 0, 0, 0);
XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0);
wwin = wManageInternalWindow(scr, parent, None, "About GNUstep",
(scr->scr_width - 325)/2,
(scr->scr_height - 200)/2, 325, 200);
WSETUFLAG(wwin, no_closable, 0);
WSETUFLAG(wwin, no_close_button, 0);
wWindowUpdateButtonImages(wwin);
wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON);
wwin->frame->on_click_right = destroyGNUstepPanel;
panel->wwin = wwin;
WMMapWidget(panel->win);
wWindowMap(wwin);
gnustepPanel = panel;
}

View File

@@ -41,6 +41,9 @@ void wShowInfoPanel(WScreen *scr);
void wShowLegalPanel(WScreen *scr);
void wShowGNUstepPanel(WScreen *scr);
int wShowCrashingDialogPanel(int whatSig);
#endif

View File

@@ -1730,8 +1730,7 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
}
}
}
/* restore attract icons state */
dock->attract_icons = 0;
@@ -3299,9 +3298,7 @@ iconDblClick(WObjDescriptor *desc, XEvent *event)
((btn->icon->owner == NULL) && (btn->applist != NULL))) {
if (btn->icon->owner == NULL)
btn->icon->owner = btn->applist->wapp->main_window_desc;
#ifdef I_HATE_THIS
}
#endif
#else
if (btn->icon->owner && !(event->xbutton.state & ControlMask)) {
#endif
@@ -3339,7 +3336,11 @@ iconDblClick(WObjDescriptor *desc, XEvent *event)
(!btn->running || (event->xbutton.state & ControlMask))) {
launchDockedApplication(btn);
}
}
} else if (btn->xindex == 0 && btn->yindex == 0
&& btn->dock->type == WM_DOCK) {
wShowGNUstepPanel(dock->screen_ptr);
}
}
}
}
@@ -3550,7 +3551,8 @@ handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
#endif
}
/* wRaiseFrame(icon->core);*/
if (event->xbutton.state & MOD_MASK)
wRaiseFrame(icon->core);
if (!wPreferences.flags.noclip)
clip = scr->workspaces[scr->current_workspace]->clip;

View File

@@ -84,6 +84,10 @@ static void menuCloseClick(WCoreWindow *sender, void *data, XEvent *event);
static void updateTexture(WMenu *menu);
#ifndef LITE
static int saveMenuRecurs(proplist_t menus, WScreen *scr, WMenu *menu);
static int restoreMenuRecurs(WScreen *scr, proplist_t menus, WMenu *menu, char *path);
#endif /* !LITE */
static void selectEntry(WMenu *menu, int entry_no);
static void closeCascade(WMenu *menu);
@@ -2437,22 +2441,12 @@ wMenuSaveState(WScreen *scr)
{
proplist_t menus, key, value;
int save_menus = 0;
char buffer[256];
menus = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
#ifndef LITE
if (scr->root_menu && scr->root_menu->flags.buttoned) {
sprintf(buffer, "%i,%i", scr->root_menu->frame_x,
scr->root_menu->frame_y);
key = PLMakeString("RootMenu");
value = PLMakeString(buffer);
PLInsertDictionaryEntry(menus, key, value);
PLRelease(key);
PLRelease(value);
save_menus = 1;
}
if (scr->switch_menu && scr->switch_menu->flags.buttoned) {
sprintf(buffer, "%i,%i", scr->switch_menu->frame_x,
scr->switch_menu->frame_y);
@@ -2463,6 +2457,10 @@ wMenuSaveState(WScreen *scr)
PLRelease(value);
save_menus = 1;
}
if (saveMenuRecurs(menus, scr, scr->root_menu))
save_menus = 1;
#endif /* !LITE */
if (scr->workspace_menu && scr->workspace_menu->flags.buttoned) {
sprintf(buffer, "%i,%i", scr->workspace_menu->frame_x,
@@ -2484,13 +2482,80 @@ wMenuSaveState(WScreen *scr)
}
#ifndef LITE
static Bool
getMenuPath(WMenu *menu, char *buffer, int bufSize)
{
Bool ok = True;
int len = 0;
if (!menu->flags.titled || !menu->frame->title[0])
return False;
len = strlen(menu->frame->title);
if (len >= bufSize)
return False;
if (menu->parent) {
ok = getMenuPath(menu->parent, buffer, bufSize - len - 1);
if (!ok)
return False;
}
strcat(buffer, "\\");
strcat(buffer, menu->frame->title);
return True;
}
static Bool
saveMenuRecurs(proplist_t menus, WScreen *scr, WMenu *menu)
{
proplist_t key, value;
int save_menus = 0, i;
char buffer[512];
Bool ok = True;
if (menu->flags.brother)
menu = menu->brother;
if (menu->flags.buttoned && menu != scr->switch_menu) {
sprintf(buffer, "%i,%i", menu->frame_x, menu->frame_y);
value = PLMakeString(buffer);
buffer[0] = '\0';
ok = getMenuPath(menu, buffer, 510);
if (ok) {
key = PLMakeString(buffer);
PLInsertDictionaryEntry(menus, key, value);
PLRelease(key);
PLRelease(value);
save_menus = 1;
}
}
if (ok) {
for (i = 0; i < menu->cascade_no; i++) {
if (saveMenuRecurs(menus, scr, menu->cascades[i]))
save_menus = 1;
}
}
return save_menus;
}
#endif /* !LITE */
#define COMPLAIN(key) wwarning(_("bad value in menus state info:%s"), key)
static int
restoreMenu(WScreen *scr, proplist_t menu, int which)
{
int i, x, y;
int x, y;
WMenu *pmenu = NULL;
if (!menu)
@@ -2505,27 +2570,11 @@ restoreMenu(WScreen *scr, proplist_t menu, int which)
COMPLAIN("Position");
#ifndef LITE
if (which & WSS_ROOTMENU) {
OpenRootMenu(scr, x, y, False);
pmenu = scr->root_menu;
} else if (which & WSS_SWITCHMENU) {
if (which & WSS_SWITCHMENU) {
OpenSwitchMenu(scr, x, y, False);
pmenu = scr->switch_menu;
} else
#endif /* !LITE */
if (which & WSS_WSMENU) {
OpenWorkspaceMenu(scr, x, y);
pmenu = scr->workspace_menu;
if (pmenu->parent) {
/* make parent map the copy in place of the original */
for (i=0; i<pmenu->parent->cascade_no; i++) {
if (pmenu->parent->cascades[i] == pmenu) {
pmenu->parent->cascades[i] = pmenu->brother;
break;
}
}
}
}
#endif /* !LITE */
if (pmenu) {
int width = MENUW(pmenu);
@@ -2544,10 +2593,69 @@ restoreMenu(WScreen *scr, proplist_t menu, int which)
}
#ifndef LITE
static int
restoreMenuRecurs(WScreen *scr, proplist_t menus, WMenu *menu, char *path)
{
proplist_t key, entry;
char buffer[512];
int i, x, y, res;
if (strlen(path) + strlen(menu->frame->title) > 510)
return False;
sprintf(buffer, "%s\\%s", path, menu->frame->title);
key = PLMakeString(buffer);
entry = PLGetDictionaryEntry(menus, key);
res = False;
if (entry && PLIsString(entry)) {
if (sscanf(PLGetString(entry), "%i,%i", &x, &y) != 2)
COMPLAIN("Position");
if (!menu->flags.mapped) {
int width = MENUW(menu);
int height = MENUH(menu);
wMenuMapAt(menu, x, y, False);
if (menu->parent) {
/* make parent map the copy in place of the original */
for (i=0; i<menu->parent->cascade_no; i++) {
if (menu->parent->cascades[i] == menu) {
menu->parent->cascades[i] = menu->brother;
break;
}
}
}
x = (x < -width) ? 0 : x;
x = (x > scr->scr_width) ? scr->scr_width - width : x;
y = (y < 0) ? 0 : y;
y = (y > scr->scr_height) ? scr->scr_height - height : y;
wMenuMove(menu, x, y, True);
menu->flags.buttoned = 1;
wFrameWindowShowButton(menu->frame, WFF_RIGHT_BUTTON);
res = True;
}
}
PLRelease(key);
for (i=0; i<menu->cascade_no; i++) {
if (restoreMenuRecurs(scr, menus, menu->cascades[i], buffer) != False)
res = True;
}
return res;
}
#endif /* !LITE */
void
wMenuRestoreState(WScreen *scr)
{
proplist_t menus, menu, key, rkey, skey, wkey;
proplist_t menus, menu, key, skey;
key = PLMakeString("Menus");
menus = PLGetDictionaryEntry(scr->session_state, key);
@@ -2558,19 +2666,19 @@ wMenuRestoreState(WScreen *scr)
/* restore menus */
rkey = PLMakeString("RootMenu");
skey = PLMakeString("SwitchMenu");
wkey = PLMakeString("WorkspaceMenu");
menu = PLGetDictionaryEntry(menus, rkey);
restoreMenu(scr, menu, WSS_ROOTMENU);
menu = PLGetDictionaryEntry(menus, skey);
restoreMenu(scr, menu, WSS_SWITCHMENU);
menu = PLGetDictionaryEntry(menus, wkey);
restoreMenu(scr, menu, WSS_WSMENU);
PLRelease(rkey);
#ifndef LITE
if (!scr->root_menu) {
OpenRootMenu(scr, scr->scr_width*2, 0, False);
wMenuUnmap(scr->root_menu);
}
restoreMenuRecurs(scr, menus, scr->root_menu, "");
#endif /* !LITE */
PLRelease(skey);
PLRelease(wkey);
}
@@ -2603,8 +2711,7 @@ OpenWorkspaceMenu(WScreen *scr, int x, int y)
wRaiseFrame(menu->frame->core);
wMenuMapCopyAt(menu, x, y);
}
}
else {
} else {
wMenuMapAt(menu, x, y, False);
}
}

View File

@@ -409,8 +409,8 @@ showWorkspaceName(WScreen *scr, int workspace)
data->count = 10;
/* set a 2 second timeout for the effect */
data->timeout = time(NULL) + 1 +
/* set a timeout for the effect */
data->timeout = time(NULL) + 2 +
(WORKSPACE_NAME_DELAY + WORKSPACE_NAME_FADE_DELAY*data->count)/1000;
scr->workspace_name_data = data;