1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

ResizebarBack option

This commit is contained in:
kojima
1999-04-12 02:03:58 +00:00
parent 3bf0fa92c9
commit da91828129
16 changed files with 251 additions and 106 deletions

View File

@@ -16,6 +16,8 @@ Changes since version 0.52.0:
- applied WMSound patch from "Quinn, Anthony" <Anthony.Quinn@usa.xerox.com>
- fixed focus bug with unfocusable window (I swear I had fixed that before...)
- applied windoze cycle patch from Paul Warren <pdw@ferret.lmh.ox.ac.uk>
- changed initscript and exitscript execution from fork()/exec() to system()
- added ResizebarBack and added appropriate backwards compat. hacks in setstyle
Changes since version 0.51.2:
.............................

20
NEWS
View File

@@ -2,10 +2,12 @@
NEWS for veteran Window Maker users
-----------------------------------
--- 0.53.0
--- 0.52.1
New Option
----------
New Options
-----------
** MenuStyle
MenuStyle=<style>; will change the menu texture style.
@@ -19,6 +21,18 @@ in each item
flat: singleTexture without the bevels
** ResizebarBack
ResizebarBack=<texture>;
where <texture> is any of the textures you normally use in titlebars and
other places.
If the style file/theme does not contain a ResizebarBack option, setstyle
will automatically hack it so that wmaker will make the theme work like
before.
--- 0.52.0

4
TODO
View File

@@ -1,12 +1,12 @@
selection to get icon background
Do ASAP:
========
- exitscript
- fix bestvisual selection code. Broken.
- fix RemakeStackList() to account for transient windows
- blink border of clients with UrgencyHint set between red and black
- finish session stuff
- fix scroller to not jump while dragging knob
- add multiline support for balloons
- move/add balloon to WINGs
- finish XStandardColormap stuff in wrlib

View File

@@ -10,7 +10,7 @@ AC_INIT(src/WindowMaker.h)
AM_INIT_AUTOMAKE(WindowMaker, 0.53.0)
AM_INIT_AUTOMAKE(WindowMaker, 0.52.1)
AM_PROG_LIBTOOL

View File

@@ -154,6 +154,7 @@ static int setWTitleColor();
static int setFTitleBack();
static int setPTitleBack();
static int setUTitleBack();
static int setResizebarBack();
static int setWorkspaceBack();
static int setWorkspaceSpecificBack();
static int setMenuTitleColor();
@@ -550,6 +551,9 @@ WDefaultEntry optionList[] = {
{"UTitleBack", "(solid, gray)", NULL,
NULL, getTexture, setUTitleBack
},
{"ResizebarBack", "(solid, gray)", NULL,
NULL, getTexture, setResizebarBack
},
{"MenuTitleColor", "white", NULL,
NULL, getColor, setMenuTitleColor
},
@@ -2815,6 +2819,10 @@ setWidgetColor(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo
}
scr->widget_texture = *(WTexSolid**)texture;
if (scr->geometry_display != None)
XSetWindowBackground(dpy, scr->geometry_display,
scr->widget_texture->normal.pixel);
return 0;
}
@@ -2851,15 +2859,17 @@ setUTitleBack(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
}
scr->window_title_texture[WS_UNFOCUSED] = *texture;
if (scr->resizebar_texture[0]) {
wTextureDestroy(scr, (WTexture*)scr->resizebar_texture[0]);
}
scr->resizebar_texture[0]
= wTextureMakeSolid(scr, &scr->window_title_texture[WS_UNFOCUSED]->any.color);
return REFRESH_WINDOW_TEXTURES;
}
if (scr->geometry_display != None)
XSetWindowBackground(dpy, scr->geometry_display,
scr->resizebar_texture[0]->normal.pixel);
static int
setResizebarBack(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
{
if (scr->resizebar_texture[0]) {
wTextureDestroy(scr, scr->resizebar_texture[0]);
}
scr->resizebar_texture[0] = *texture;
return REFRESH_WINDOW_TEXTURES;
}

View File

@@ -1359,8 +1359,8 @@ doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
wRaiseFrame(newFocused->frame->core);
if (wPreferences.popup_switchmenu &&
(!scr->switch_menu || !scr->switch_menu->flags.mapped))
{
(!scr->switch_menu || !scr->switch_menu->flags.mapped)) {
OpenSwitchMenu(scr, scr->scr_width/2, scr->scr_height/2, False);
openedSwitchMenu = True;
}

View File

@@ -486,7 +486,7 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
img = wTextureRenderImage(texture, width, height, WREL_FLAT);
if (!img) {
wwarning(_("could not render gradient: %s"), RMessageForError(RErrorCode));
wwarning(_("could not render texture: %s"), RMessageForError(RErrorCode));
return;
}
@@ -550,6 +550,49 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
}
static void
renderResizebarTexture(WScreen *scr, WTexture *texture, int width, int height,
int cwidth, Pixmap *pmap)
{
RImage *img;
RColor light;
RColor dark;
*pmap = None;
img = wTextureRenderImage(texture, width, height, WREL_FLAT);
if (!img) {
wwarning(_("could not render texture: %s"),
RMessageForError(RErrorCode));
return;
}
light.alpha = 0;
light.red = light.green = light.blue = 80;
dark.alpha = 0;
dark.red = dark.green = dark.blue = 40;
ROperateLine(img, RSubtractOperation, 0, 0, width-1, 0, &dark);
ROperateLine(img, RAddOperation, 0, 1, width-1, 1, &light);
ROperateLine(img, RSubtractOperation, cwidth, 2, cwidth, height, &dark);
ROperateLine(img, RAddOperation, cwidth+1, 2, cwidth+1, height, &light);
ROperateLine(img, RSubtractOperation, width-cwidth-2, 2, width-cwidth-2,
height, &dark);
ROperateLine(img, RAddOperation, width-cwidth-1, 2, width-cwidth-1,
height, &light);
if (!RConvertImage(scr->rcontext, img, pmap)) {
wwarning(_("error rendering image: %s"), RMessageForError(RErrorCode));
}
RDestroyImage(img);
}
static void
updateTexture(WFrameWindow *fwin)
{
@@ -593,12 +636,6 @@ updateTexture(WFrameWindow *fwin)
handleButtonExpose(&fwin->right_button->descriptor, NULL);
}
}
if (fwin->resizebar) {
XSetWindowBackground(dpy, fwin->resizebar->window,
fwin->resizebar_texture[0]->solid.normal.pixel);
XClearWindow(dpy, fwin->resizebar->window);
}
}
@@ -639,13 +676,39 @@ remakeTexture(WFrameWindow *fwin, int state)
}
}
}
if (fwin->resizebar_texture && fwin->resizebar_texture[0]
&& fwin->resizebar && state == 0) {
FREE_PIXMAP(fwin->resizebar_back[0]);
if (fwin->resizebar_texture[0]->any.type!=WTEX_SOLID) {
renderResizebarTexture(fwin->screen_ptr,
fwin->resizebar_texture[0],
fwin->resizebar->width,
fwin->resizebar->height,
fwin->resizebar_corner_width,
&pmap);
fwin->resizebar_back[0] = pmap;
}
/* this part should be in updateTexture() */
if (fwin->resizebar_texture[0]->any.type!=WTEX_SOLID) {
XSetWindowBackgroundPixmap(dpy, fwin->resizebar->window,
fwin->resizebar_back[0]);
} else {
XSetWindowBackground(dpy, fwin->resizebar->window,
fwin->resizebar_texture[0]->solid.normal.pixel);
}
XClearWindow(dpy, fwin->resizebar->window);
}
}
void
wFrameWindowPaint(WFrameWindow *fwin)
{
if (fwin->flags.is_client_window_frame)
fwin->flags.justification = wPreferences.title_justification;
@@ -685,7 +748,8 @@ wFrameWindowPaint(WFrameWindow *fwin)
WREL_RAISED);
}
if (fwin->resizebar && !fwin->flags.repaint_only_titlebar) {
if (fwin->resizebar && !fwin->flags.repaint_only_titlebar
&& fwin->resizebar_texture[0]->any.type == WTEX_SOLID) {
Window win;
int w, h;
int cw;

View File

@@ -58,6 +58,7 @@ typedef struct WFrameWindow {
WCoreWindow *resizebar; /* bottom resizebar */
Pixmap title_back[3]; /* focused, unfocused, pfocused */
Pixmap resizebar_back[3]; /* any, None, None */
Pixmap lbutton_back[3];
Pixmap rbutton_back[3];

View File

@@ -297,11 +297,16 @@ execInitScript()
file = wfindfile(DEF_CONFIG_PATHS, DEF_INIT_SCRIPT);
if (file) {
if (system(file) != 0) {
wsyserror(_("%s:could not execute initialization script"), file);
}
#if 0
if (fork()==0) {
execl("/bin/sh", "/bin/sh", "-c",file, NULL);
wsyserror(_("%s:could not execute initialization script"), file);
exit(1);
}
#endif
free(file);
}
}
@@ -314,11 +319,16 @@ ExecExitScript()
file = wfindfile(DEF_CONFIG_PATHS, DEF_EXIT_SCRIPT);
if (file) {
if (system(file) != 0) {
wsyserror(_("%s:could not execute exit script"), file);
}
#if 0
if (fork()==0) {
execl("/bin/sh", "/bin/sh", "-c", file, NULL);
wsyserror(_("%s:could not execute exit script"), file);
exit(1);
}
#endif
free(file);
}
}

View File

@@ -141,7 +141,7 @@ showPosition(WWindow *wwin, int x, int y)
sprintf(num, "%+i %-+i", x, y);
fw = wTextWidth(scr->info_text_font->font, num, strlen(num));
XSetForeground(dpy, gc, scr->window_title_pixel[WS_UNFOCUSED]);
XSetForeground(dpy, gc, scr->black_pixel);
fh = scr->info_text_font->height;
wDrawString(scr->geometry_display, scr->info_text_font, gc,
@@ -149,8 +149,8 @@ showPosition(WWindow *wwin, int x, int y)
(scr->geometry_display_height-fh)/2 + scr->info_text_font->y,
num, strlen(num));
wDrawBevel(scr->geometry_display, scr->geometry_display_width+1,
scr->geometry_display_height+1, scr->resizebar_texture[0],
WREL_RAISED);
scr->geometry_display_height+1,
scr->widget_texture, WREL_RAISED);
}
}
@@ -343,8 +343,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
/ wwin->normal_hints->height_inc);
fw = wTextWidth(scr->info_text_font->font, num, strlen(num));
XSetForeground(dpy, scr->info_text_gc,
scr->window_title_pixel[WS_UNFOCUSED]);
XSetForeground(dpy, scr->info_text_gc, scr->black_pixel);
/* Display the height. */
wDrawString(scr->geometry_display, scr->info_text_font,
@@ -353,8 +352,8 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
(scr->geometry_display_height-fh)/2 +scr->info_text_font->y,
num, strlen(num));
wDrawBevel(scr->geometry_display, scr->geometry_display_width+1,
scr->geometry_display_height+1, scr->resizebar_texture[0],
WREL_RAISED);
scr->geometry_display_height+1,
scr->widget_texture, WREL_RAISED);
}
}

View File

@@ -484,8 +484,8 @@ createInternalWindows(WScreen *scr)
attribs.override_redirect = True;
attribs.cursor = wCursor[WCUR_DEFAULT];
attribs.background_pixmap = None;
if (scr->resizebar_texture[0])
attribs.background_pixel = scr->resizebar_texture[0]->normal.pixel;
if (scr->widget_texture)
attribs.background_pixel = scr->widget_texture->normal.pixel;
else
attribs.background_pixel = scr->light_pixel;
vmask |= CWColormap;

View File

@@ -171,7 +171,7 @@ typedef struct _WScreen {
union WTexture *menu_title_texture[3];/* menu titlebar texture (tex, -, -) */
union WTexture *window_title_texture[3]; /* win textures (foc, unfoc, pfoc) */
struct WTexSolid *resizebar_texture[3];/* window resizebar texture (tex, -, -) */
union WTexture *resizebar_texture[3];/* window resizebar texture (tex, -, -) */
union WTexture *menu_item_texture; /* menu item texture */

View File

@@ -44,10 +44,6 @@
extern WPreferences wPreferences;
static Pixmap renderTexture(WScreen *scr, int width, int height,
WTexture *texture, int rel);
static void bevelImage(RImage *image, int relief);

View File

@@ -886,7 +886,7 @@ wManageWindow(WScreen *scr, Window window)
wwin->frame = wFrameWindowCreate(scr, window_level,
x, y, width, height, foo,
scr->window_title_texture,
(WTexture**)scr->resizebar_texture,
scr->resizebar_texture,
scr->window_title_pixel,
&scr->window_title_gc,
&scr->title_font);
@@ -1237,7 +1237,7 @@ wManageInternalWindow(WScreen *scr, Window window, Window owner,
wwin->frame_x, wwin->frame_y,
width, height, foo,
scr->window_title_texture,
(WTexture**)scr->resizebar_texture,
scr->resizebar_texture,
scr->window_title_pixel,
&scr->window_title_gc,
&scr->title_font);

View File

@@ -60,6 +60,7 @@ static char *options[] = {
"FTitleBack",
"PTitleBack",
"UTitleBack",
"ResizebarBack",
"MenuTitleColor",
"MenuTextColor",
"MenuDisabledColor",
@@ -68,7 +69,7 @@ static char *options[] = {
"IconBack",
"IconTitleColor",
"IconTitleBack",
"AlternativeMenuStyle",
"MenuStyle",
#ifdef TITLE_TEXT_SHADOW
"Shadow",
"FShadowColor",

View File

@@ -51,6 +51,7 @@ char *FontOptions[] = {
char *ProgName;
int ignoreFonts = 0;
Display *dpy;
char*
defaultsPathForDomain(char *domain)
@@ -127,6 +128,69 @@ hackPaths(proplist_t style, char *prefix)
}
static proplist_t
getColor(proplist_t texture)
{
proplist_t value, type;
char *str;
type = PLGetArrayElement(texture, 0);
if (!type)
return NULL;
value = NULL;
str = PLGetString(type);
if (strcasecmp(str, "solid")==0) {
value = PLGetArrayElement(texture, 1);
} else if (strcasecmp(str, "dgradient")==0
|| strcasecmp(str, "hgradient")==0
|| strcasecmp(str, "vgradient")==0) {
proplist_t c1, c2;
int r1, g1, b1, r2, g2, b2;
char buffer[32];
c1 = PLGetArrayElement(texture, 1);
c2 = PLGetArrayElement(texture, 2);
if (!dpy) {
if (sscanf(PLGetString(c1), "#%2x%2x%2x", &r1, &g1, &b1)==3
&& sscanf(PLGetString(c2), "#%2x%2x%2x", &r2, &g2, &b2)==3) {
sprintf(buffer, "#%2x%2x%2x", (r1+r2)/2, (g1+g2)/2,
(b1+b2)/2);
value = PLMakeString(buffer);
} else {
value = c1;
}
} else {
XColor color1;
XColor color2;
XParseColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
PLGetString(c1), &color1);
XParseColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
PLGetString(c1), &color2);
sprintf(buffer, "#%4x%4x%4x", (color1.red+color2.red)/2,
(color1.green+color2.green)/2,
(color1.blue+color2.blue)/2);
value = PLMakeString(buffer);
}
} else if (strcasecmp(str, "mdgradient")==0
|| strcasecmp(str, "mhgradient")==0
|| strcasecmp(str, "mvgradient")==0) {
value = PLGetArrayElement(texture, 1);
} else if (strcasecmp(str, "tpixmap")==0
|| strcasecmp(str, "cpixmap")==0
|| strcasecmp(str, "spixmap")==0) {
value = PLGetArrayElement(texture, 2);
}
return value;
}
/*
* since some of the options introduce incompatibilities, we will need
@@ -142,6 +206,7 @@ hackStyle(proplist_t style)
proplist_t tmp;
int i;
int foundIconTitle = 0;
int foundResizebarBack = 0;
keys = PLGetAllDictionaryKeys(style);
@@ -168,6 +233,8 @@ hackStyle(proplist_t style)
if (strcasecmp(str, "IconTitleColor")==0
|| strcasecmp(str, "IconTitleBack")==0) {
foundIconTitle = 1;
} else if (strcasecmp(str, "ResizebarBack")==0) {
foundResizebarBack = 1;
}
}
}
@@ -182,48 +249,9 @@ hackStyle(proplist_t style)
tmp = PLGetDictionaryEntry(style, PLMakeString("FTitleBack"));
if (tmp) {
proplist_t type;
proplist_t value;
char *str;
type = PLGetArrayElement(tmp, 0);
if (!type)
return;
value = NULL;
str = PLGetString(type);
if (strcasecmp(str, "solid")==0) {
value = PLGetArrayElement(tmp, 1);
} else if (strcasecmp(str, "dgradient")==0
|| strcasecmp(str, "hgradient")==0
|| strcasecmp(str, "vgradient")==0) {
proplist_t c1, c2;
int r1, g1, b1, r2, g2, b2;
char buffer[32];
c1 = PLGetArrayElement(tmp, 1);
c2 = PLGetArrayElement(tmp, 2);
if (sscanf(PLGetString(c1), "#%2x%2x%2x", &r1, &g1, &b1)==3
&& sscanf(PLGetString(c2), "#%2x%2x%2x", &r2, &g2, &b2)==3) {
sprintf(buffer, "#%2x%2x%2x", (r1+r2)/2, (g1+g2)/2,
(b1+b2)/2);
value = PLMakeString(buffer);
} else {
value = c1;
}
} else if (strcasecmp(str, "mdgradient")==0
|| strcasecmp(str, "mhgradient")==0
|| strcasecmp(str, "mvgradient")==0) {
value = PLGetArrayElement(tmp, 1);
} else if (strcasecmp(str, "tpixmap")==0
|| strcasecmp(str, "cpixmap")==0
|| strcasecmp(str, "spixmap")==0) {
value = PLGetArrayElement(tmp, 2);
}
value = getColor(tmp);
if (value) {
PLInsertDictionaryEntry(style, PLMakeString("IconTitleBack"),
@@ -232,9 +260,29 @@ hackStyle(proplist_t style)
}
}
if (!PLGetDictionaryEntry(style, PLMakeString("AlternativeMenuStyle"))) {
PLInsertDictionaryEntry(style, PLMakeString("AlternativeMenuStyle"),
PLMakeString("NO"));
if (!foundResizebarBack) {
/* set the default values */
tmp = PLGetDictionaryEntry(style, PLMakeString("UTitleBack"));
if (tmp) {
proplist_t value;
value = getColor(tmp);
if (value) {
proplist_t t;
t = PLMakeArrayFromElements(PLMakeString("solid"), value,
NULL);
PLInsertDictionaryEntry(style, PLMakeString("ResizebarBack"),
t);
}
}
}
if (!PLGetDictionaryEntry(style, PLMakeString("MenuStyle"))) {
PLInsertDictionaryEntry(style, PLMakeString("MenuStyle"),
PLMakeString("normal"));
}
}
@@ -277,6 +325,8 @@ main(int argc, char **argv)
struct stat statbuf;
int i;
dpy = XOpenDisplay("");
ProgName = argv[0];
if (argc<2) {
@@ -380,10 +430,8 @@ main(int argc, char **argv)
PLSave(prop, YES);
{
Display *dpy;
XEvent ev;
dpy = XOpenDisplay("");
if (dpy) {
int i;
char *msg = "Reconfigure";