1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-18 23:45:47 +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

@@ -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
},
@@ -1152,7 +1156,7 @@ wReadDefaults(WScreen *scr, proplist_t new_dict)
foo = 0;
if (needs_refresh & REFRESH_WINDOW_FONT) {
foo |= WFontSettings;
}
}
if (needs_refresh & REFRESH_WINDOW_TEXTURES) {
foo |= WTextureSettings;
}
@@ -1162,7 +1166,7 @@ wReadDefaults(WScreen *scr, proplist_t new_dict)
if (foo)
WMPostNotificationName(WNWindowAppearanceSettingsChanged, NULL,
(void*)foo);
if (!(needs_refresh & REFRESH_ICON_TILE)) {
foo = 0;
if (needs_refresh & REFRESH_ICON_FONT) {
@@ -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;
}
@@ -2850,17 +2858,19 @@ setUTitleBack(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
wTextureDestroy(scr, scr->window_title_texture[WS_UNFOCUSED]);
}
scr->window_title_texture[WS_UNFOCUSED] = *texture;
return REFRESH_WINDOW_TEXTURES;
}
static int
setResizebarBack(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
{
if (scr->resizebar_texture[0]) {
wTextureDestroy(scr, (WTexture*)scr->resizebar_texture[0]);
wTextureDestroy(scr, scr->resizebar_texture[0]);
}
scr->resizebar_texture[0]
= wTextureMakeSolid(scr, &scr->window_title_texture[WS_UNFOCUSED]->any.color);
if (scr->geometry_display != None)
XSetWindowBackground(dpy, scr->geometry_display,
scr->resizebar_texture[0]->normal.pixel);
scr->resizebar_texture[0] = *texture;
return REFRESH_WINDOW_TEXTURES;
}

View File

@@ -1330,7 +1330,7 @@ doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
WScreen *scr = wScreenForRootWindow(event->xkey.root);
Bool done = False;
Bool openedSwitchMenu = False;
WWindow *newFocused;
WWindow *newFocused;
WWindow *oldFocused;
int modifiers;
XModifierKeymap *keymap;
@@ -1355,15 +1355,15 @@ doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
wWindowFocus(newFocused, scr->focused_window);
oldFocused = newFocused;
if (wPreferences.circ_raise)
if (wPreferences.circ_raise)
wRaiseFrame(newFocused->frame->core);
if (wPreferences.popup_switchmenu &&
(!scr->switch_menu || !scr->switch_menu->flags.mapped))
{
OpenSwitchMenu(scr, scr->scr_width/2, scr->scr_height/2, False);
openedSwitchMenu = True;
}
(!scr->switch_menu || !scr->switch_menu->flags.mapped)) {
OpenSwitchMenu(scr, scr->scr_width/2, scr->scr_height/2, False);
openedSwitchMenu = True;
}
while (!done) {
XEvent ev;
@@ -1386,8 +1386,8 @@ doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
newFocused = nextToFocusAfter(newFocused);
wWindowFocus(newFocused, oldFocused);
oldFocused = newFocused;
if (wPreferences.circ_raise)
wRaiseFrame(newFocused->frame->core);
if (wPreferences.circ_raise)
wRaiseFrame(newFocused->frame->core);
UpdateSwitchMenu(scr, newFocused, ACTION_CHANGE_STATE);
} else if (ev.type == KeyPress
@@ -1398,8 +1398,8 @@ doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
newFocused = nextToFocusBefore(newFocused);
wWindowFocus(newFocused, oldFocused);
oldFocused = newFocused;
if (wPreferences.circ_raise)
wRaiseFrame(newFocused->frame->core);
if (wPreferences.circ_raise)
wRaiseFrame(newFocused->frame->core);
UpdateSwitchMenu(scr, newFocused, ACTION_CHANGE_STATE);
}
if (ev.type == KeyRelease) {

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);
}
}
@@ -624,14 +661,14 @@ remakeTexture(WFrameWindow *fwin, int state)
&& !fwin->flags.lbutton_dont_fit;
right = fwin->right_button && !fwin->flags.hide_right_button
&& !fwin->flags.rbutton_dont_fit;
width = fwin->core->width+1;
renderTexture(fwin->screen_ptr, fwin->title_texture[state],
width, fwin->titlebar->height,
fwin->titlebar->height, fwin->titlebar->height,
left, right, &pmap, &lpmap, &rpmap);
fwin->title_back[state] = pmap;
if (wPreferences.new_style) {
fwin->lbutton_back[state] = lpmap;
@@ -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

@@ -140,8 +140,8 @@ showPosition(WWindow *wwin, int x, int y)
False);
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);
}
}
@@ -342,10 +342,9 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
(by - ty - wwin->normal_hints->base_height)
/ 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,
scr->info_text_gc,
@@ -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);