diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 1358ecef..efd3eb3c 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -225,6 +225,8 @@ typedef struct WPreferences { char *icon_path; /* : separated list of */ /* paths to find icons */ + RImage *button_images; /* titlebar button images */ + char size_display; /* display type for resize geometry */ char move_display; /* display type for move geometry */ char window_placement; /* window placement mode */ diff --git a/src/client.c b/src/client.c index fde87d7a..f36e1517 100644 --- a/src/client.c +++ b/src/client.c @@ -714,13 +714,10 @@ wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry, wwin->normal_hints->min_width = wwin->normal_hints->max_width; } - if (pre_icccm && !wwin->screen_ptr->flags.startup && geometry) { -#ifdef DEBUG - printf("PRE ICCCM\n"); -#endif #ifdef IGNORE_PPOSITION - wwin->normal_hints->flags &= ~PPosition; + wwin->normal_hints->flags &= ~PPosition; #endif + if (pre_icccm && !wwin->screen_ptr->flags.startup && geometry) { if (wwin->normal_hints->flags & (USPosition|PPosition)) { *x = wwin->normal_hints->x; *y = wwin->normal_hints->y; diff --git a/src/defaults.c b/src/defaults.c index cd9bf7e6..c6f51763 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -130,7 +130,9 @@ static int getFont(); static int getColor(); static int getKeybind(); static int getModMask(); - +#ifdef NEWSTUFF +static int getRImage(); +#endif /* value setting functions */ static int setJustify(); @@ -168,6 +170,10 @@ static int setIconPosition(); static int setClipTitleFont(); static int setClipTitleColor(); +#ifdef NEWSTUFF +static int setButtonImages(); +#endif + static int updateUsableArea(); @@ -448,9 +454,15 @@ WDefaultEntry optionList[] = { }, #endif /* WEENDOZE_CYCLE */ /* style options */ +#ifdef NEWSTUFF + {"WindowButtonImages", DEF_BUTTON_IMAGES, NULL, + &wPreferences.button_images, getRImage, setButtonImages + }, +#else {"WidgetColor", "(solid, gray)", NULL, NULL, getTexture, setWidgetColor, }, +#endif {"WorkspaceSpecificBack","()", NULL, NULL, getWSSpecificBackground, setWorkspaceSpecificBack }, @@ -535,7 +547,6 @@ WDefaultEntry optionList[] = { {"IconTitleBack", "black", NULL, NULL, getColor, setIconTitleBack }, - /* keybindings */ #ifndef LITE {"RootMenuKey", "None", (void*)WKBD_ROOTMENU, @@ -1036,6 +1047,8 @@ wDefaultsCheckDomains(void *foo) #define REFRESH_ICON_FONT (1<<7) #define REFRESH_WORKSPACE_BACK (1<<8) +#define REFRESH_BUTTON_IMAGES (1<<9) + static void refreshMenus(WScreen *scr, int flags) { @@ -1202,6 +1215,37 @@ wReadDefaults(WScreen *scr, proplist_t new_dict) if (needs_refresh & REFRESH_ICON_TILE) refreshAppIcons(scr, needs_refresh); +#ifdef NEWSTUFF + if ((needs_refresh & REFRESH_BUTTON_IMAGES) + && wPreferences.button_images) { + + int w, h; + RImage *image = wPreferences.button_images; + RImage *tmp; + int theight; + + w = wPreferences.button_images->width / 2; + h = wPreferences.button_images->height / PRED_BPIXMAPS; + + theight = scr->title_font->height + TITLEBAR_EXTRA_HEIGHT - 3; + + for (i = 0; i < PRED_BPIXMAPS; i++) { + tmp = RGetSubImage(image, 0, i * h, w, h); + if (scr->button_images[0][i]) + RDestroyImage(scr->button_images[0][i]); + + scr->button_images[0][i] = RScaleImage(tmp, theight, theight); + RDestroyImage(tmp); + + tmp = RGetSubImage(image, w, i * h, image->width - w, h); + if (scr->button_images[1][i]) + RDestroyImage(scr->button_images[1][i]); + + scr->button_images[1][i] = RScaleImage(tmp, theight, theight); + RDestroyImage(tmp); + } + } +#endif /* NEWSTUFF */ wRefreshDesktop(scr); } } @@ -2100,11 +2144,11 @@ getFont(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr, { static WFont *font; char *val; - + STRINGP("Font"); - + val = PLGetString(value); - + font = wLoadFont(val); if (!font) { wfatal(_("could not load any usable font!!!")); @@ -2113,10 +2157,9 @@ getFont(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr, if (ret) *ret = font; - - if (addr) { - wwarning("BUG:can't assign font value outside update function"); - } + + /* can't assign font value outside update function */ + wassertrv(addr == NULL, True); return True; } @@ -2238,7 +2281,7 @@ getModMask(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr, str = PLGetString(value); if (!str) return False; - + mask = wXModifierFromKey(str); if (mask < 0) { wwarning(_("%s: modifier key %s is not valid"), entry->key, str); @@ -2248,14 +2291,54 @@ getModMask(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr, if (addr) *(unsigned int*)addr = mask; - + if (ret) *ret = &mask; - + return True; } +#ifdef NEWSTUFF +static int +getRImages(WScreen *scr, WDefaultEntry *entry, proplist_t value, + void *addr, void **ret) +{ + unsigned int mask; + char *str; + RImage *image; + int i, n; + int w, h; + + STRINGP("Image File Path"); + + str = PLGetString(value); + if (!str) + return False; + + image = RLoadImage(scr->rcontext, str, 0); + if (!image) { + wwarning(_("could not load image in option %s: %s"), entry->key, + RMessageForError(RErrorCode)); + return False; + } + + if (*(RImage**)addr) { + RDestroyImage(*(RImage**)addr); + } + if (addr) + *(RImage**)addr = image; + + assert(ret == NULL); + /* + if (ret) + *(RImage**)ret = image; + */ + + return True; +} +#endif + /* ---------------- value setting functions --------------- */ static int @@ -2383,7 +2466,7 @@ setWinTitleFont(WScreen *scr, WDefaultEntry *entry, WFont *font, void *foo) XSetFont(dpy, scr->window_title_gc, font->font->fid); #endif - return REFRESH_WINDOW_FONT; + return REFRESH_WINDOW_FONT|REFRESH_BUTTON_IMAGES; } @@ -2916,6 +2999,13 @@ updateUsableArea(WScreen *scr, WDefaultEntry *entry, void *bar, void *foo) +static int +setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo) +{ + return REFRESH_BUTTON_IMAGES; +} + + /* * Very ugly kluge. * Need access to the double click variables, so that all widgets in @@ -2937,5 +3027,3 @@ setDoubleClick(WScreen *scr, WDefaultEntry *entry, int *value, void *foo) return 0; } - - diff --git a/src/kwm.c b/src/kwm.c index 88f08330..c2f36749 100644 --- a/src/kwm.c +++ b/src/kwm.c @@ -212,9 +212,12 @@ static KWMModuleList *KWMDockWindows = NULL; /* window decoration types */ enum { KWMnoDecoration = 0, - KWMnormalDecoration = 1, - KWMtinyDecoration = 2, - KWMnoFocus = 256 + KWMnormalDecoration = 1, + KWMtinyDecoration = 2, + KWMnoFocus = 256, + KWMstandaloneMenuBar = 512, + KWMdesktopIcon = 1024, + KWMstaysOnTop = 2048 }; @@ -716,7 +719,7 @@ wKWMShutdown(WScreen *scr, Bool closeModules) void -wKWMCheckClientHints(WWindow *wwin, int *workspace) +wKWMCheckClientHints(WWindow *wwin, int *layer, int *workspace) { long val; @@ -737,6 +740,21 @@ wKWMCheckClientHints(WWindow *wwin, int *workspace) case KWMtinyDecoration: wwin->client_flags.no_resizebar = 1; break; + case KWMstandaloneMenuBar: + wwin->client_flags.no_titlebar = 1; + wwin->client_flags.no_resizebar = 1; + wwin->client_flags.no_resizable = 1; + wwin->client_flags.skip_window_list = 1; + wwin->client_flags.no_hide_others = 1; + wwin->flags.kwm_menubar = 1; + *layer = WMMainMenuLevel; + break; + case KWMdesktopIcon: + *layer = WMDesktopLevel; + break; + case KWMstaysOnTop: + *layer = WMFloatingLevel; + break; case KWMnormalDecoration: default: break; @@ -757,13 +775,11 @@ wKWMCheckClientInitialState(WWindow *wwin) wwin->client_flags.omnipresent = 1; } - if (getSimpleHint(wwin->client_win, _XA_KWM_WIN_ICONIFIED, &val) - && val) { + if (getSimpleHint(wwin->client_win, _XA_KWM_WIN_ICONIFIED, &val) && val) { wwin->flags.miniaturized = 1; } - if (getSimpleHint(wwin->client_win, _XA_KWM_WIN_MAXIMIZED, &val) - && val) { + if (getSimpleHint(wwin->client_win, _XA_KWM_WIN_MAXIMIZED, &val) && val) { wwin->flags.maximized = MAX_VERTICAL|MAX_HORIZONTAL; } @@ -801,7 +817,7 @@ wKWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event) printf("got KDE sticky change\n"); #endif flag = !getSimpleHint(wwin->client_win, _XA_KWM_WIN_STICKY, - &value) || value; + &value) || value; if (flag != wwin->client_flags.omnipresent) { @@ -1393,12 +1409,26 @@ void wKWMUpdateActiveWindowHint(WScreen *scr) { long val; + WWindow *wwin, *tmp; if (!scr->focused_window || !scr->focused_window->flags.focused) val = None; - else + else { val = (long)(scr->focused_window->client_win); + /* raise the menubar thing */ + wwin = scr->focused_window; + tmp = wwin->prev; + while (tmp) { + if (tmp->flags.kwm_menubar + && tmp->transient_for == wwin->client_win) { + wRaiseFrame(tmp->frame->core); + break; + } + tmp = tmp->prev; + } + } + XChangeProperty(dpy, scr->root_win, _XA_KWM_ACTIVE_WINDOW, _XA_KWM_ACTIVE_WINDOW, 32, PropModeReplace, (unsigned char*)&val, 1); diff --git a/src/kwm.h b/src/kwm.h index 7ae4176b..1ffce187 100644 --- a/src/kwm.h +++ b/src/kwm.h @@ -45,7 +45,7 @@ void wKWMInitStuff(WScreen *scr); Bool wKWMGetUsableArea(WScreen *scr, WArea *area); -void wKWMCheckClientHints(WWindow *wwin, int *workspace); +void wKWMCheckClientHints(WWindow *wwin, int *layer, int *workspace); Bool wKWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event); diff --git a/src/menu.c b/src/menu.c index 6c81022b..786769d8 100644 --- a/src/menu.c +++ b/src/menu.c @@ -139,8 +139,11 @@ wMenuCreate(WScreen *screen, char *title, int main_menu) } menu->frame->flags.justification = WTJ_LEFT; - + +#ifndef NEWSTUFF + /* XXX */ menu->frame->rbutton_image = screen->b_pixmaps[WBUT_CLOSE]; +#endif menu->entry_no = 0; menu->alloced_entries = 0; diff --git a/src/screen.c b/src/screen.c index 5264ae83..f1b01a3c 100644 --- a/src/screen.c +++ b/src/screen.c @@ -155,6 +155,7 @@ alreadyRunningError(Display *dpy, XErrorEvent *error) * not be freed by anybody. *---------------------------------------------------------------------- */ +#ifndef NEWSTUFF static void allocButtonPixmaps(WScreen *scr) { @@ -181,6 +182,7 @@ allocButtonPixmaps(WScreen *scr) pix->shared = 1; scr->b_pixmaps[WBUT_KILL] = pix; } +#endif @@ -447,8 +449,10 @@ createPixmaps(WScreen *scr) scr->dock_dots = make3Dots(scr); } +#ifndef NEWSTUFF /* titlebar button pixmaps */ allocButtonPixmaps(scr); +#endif } diff --git a/src/screen.h b/src/screen.h index 7a227f40..a5d01006 100644 --- a/src/screen.h +++ b/src/screen.h @@ -200,7 +200,9 @@ typedef struct _WScreen { GC icon_select_gc; GC draw_gc; /* gc for drawing misc things */ +#ifndef NEWSTUFF struct WPixmap *b_pixmaps[PRED_BPIXMAPS]; /* internal pixmaps for buttons*/ +#endif struct WPixmap *menu_radio_indicator;/* left menu indicator */ struct WPixmap *menu_check_indicator;/* left menu indicator for checkmark */ struct WPixmap *menu_mini_indicator; /* for miniwindow */ @@ -245,9 +247,13 @@ typedef struct _WScreen { Pixmap def_icon_pixmap; /* default icons */ Pixmap def_ticon_pixmap; - + struct WDialogData *dialog_data; +#ifdef NEWSTUFF + struct RImage *button_images[2][PRED_BPIXMAPS];/* scaled tbar btn images */ +#endif + /* state and other informations */ short cascade_index; /* for cascade window placement */ diff --git a/src/superfluous.c b/src/superfluous.c index c2ef844e..40c0b8f6 100644 --- a/src/superfluous.c +++ b/src/superfluous.c @@ -80,7 +80,7 @@ DoKaboom(WScreen *scr, Window win, int x, int y) return; icon = RCreateImageFromDrawable(scr->rcontext, win, None); - if (!icon) + if (!icon) return; XUnmapWindow(dpy, win); @@ -94,6 +94,8 @@ DoKaboom(WScreen *scr, Window win, int x, int y) return; } + XSetClipMask(dpy, scr->copy_gc, None); + for (i=0; i