diff --git a/src/actions.c b/src/actions.c index a79de8a0..65218707 100644 --- a/src/actions.c +++ b/src/actions.c @@ -362,7 +362,7 @@ void wMaximizeWindow(WWindow *wwin, int directions) has_border = 0; /* the size to adjust the geometry */ - adj_size = FRAME_BORDER_WIDTH * 2 * has_border; + adj_size = wwin->screen_ptr->frame_border_width * 2 * has_border; /* save old coordinates before we change the current values * always if the window is not currently maximized at all @@ -626,7 +626,7 @@ static void find_Maximus_geometry(WWindow *wwin, WArea usableArea, int *new_x, i if (HAS_RESIZEBAR(wwin)) rbar_height_0 = RESIZEBAR_HEIGHT; if (HAS_BORDER(wwin)) - bd_width_0 = FRAME_BORDER_WIDTH; + bd_width_0 = wwin->screen_ptr->frame_border_width; /* the length to be subtracted if the window has titlebar, etc */ adjust_height = tbar_height_0 + 2 * bd_width_0 + rbar_height_0; @@ -1871,7 +1871,7 @@ void wSelectWindow(WWindow *wwin, Bool flag) XSetWindowBorder(dpy, wwin->frame->core->window, scr->white_pixel); if (!HAS_BORDER(wwin)) { - XSetWindowBorderWidth(dpy, wwin->frame->core->window, FRAME_BORDER_WIDTH); + XSetWindowBorderWidth(dpy, wwin->frame->core->window, wwin->screen_ptr->frame_border_width); } if (!scr->selected_windows) diff --git a/src/client.c b/src/client.c index c11f3061..ab87ecbb 100644 --- a/src/client.c +++ b/src/client.c @@ -75,8 +75,8 @@ void wClientRestore(WWindow * wwin) wClientGetGravityOffsets(wwin, &gx, &gy); /* set the position of the frame on screen */ - wwin->frame_x -= gx * FRAME_BORDER_WIDTH; - wwin->frame_y -= gy * FRAME_BORDER_WIDTH; + wwin->frame_x -= gx * wwin->screen_ptr->frame_border_width; + wwin->frame_y -= gy * wwin->screen_ptr->frame_border_width; /* if gravity is to the south, account for the border sizes */ if (gy > 0) wwin->frame_y += (wwin->frame->top_width + wwin->frame->bottom_width); @@ -224,7 +224,7 @@ void wClientConfigure(WWindow * wwin, XConfigureRequestEvent * xcre) nx = xcre->x; /* Subtracting the border makes the window shift by 1 pixel -Dan */ /*if (HAS_BORDER(wwin)) { - nx -= FRAME_BORDER_WIDTH; + nx -= wwin->screen_ptr->frame_border_width; } */ } else { nx = wwin->frame_x; @@ -234,7 +234,7 @@ void wClientConfigure(WWindow * wwin, XConfigureRequestEvent * xcre) ny = xcre->y - ((ofs_y < 0) ? 0 : wwin->frame->top_width); /* Subtracting the border makes the window shift by 1 pixel -Dan */ /*if (HAS_BORDER(wwin)) { - ny -= FRAME_BORDER_WIDTH; + ny -= wwin->screen_ptr->frame_border_width; } */ } else { ny = wwin->frame_y; diff --git a/src/defaults.c b/src/defaults.c index 490242dc..c72f623d 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -122,6 +122,7 @@ static int setMenuTextFont(); static int setIconTitleFont(); static int setIconTitleColor(); static int setIconTitleBack(); +static int setFrameBorderWidth(); static int setFrameBorderColor(); static int setFrameSelectedBorderColor(); static int setLargeDisplayFont(); @@ -542,6 +543,8 @@ WDefaultEntry optionList[] = { NULL, getPropList, setSwPOptions, NULL, NULL}, {"ModifierKeyLabels", "(\"Shift+\", \"Ctrl+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences, NULL, getPropList, setModifierKeyLabels, NULL, NULL}, + {"FrameBorderWidth", "1", NULL, + NULL, getInt, setFrameBorderWidth, NULL, NULL}, {"FrameBorderColor", "black", NULL, NULL, getColor, setFrameBorderColor, NULL, NULL}, {"FrameSelectedBorderColor", "white", NULL, @@ -2584,6 +2587,13 @@ static int setIconTitleBack(WScreen * scr, WDefaultEntry * entry, XColor * color return REFRESH_ICON_TITLE_BACK; } +static int setFrameBorderWidth(WScreen * scr, WDefaultEntry * entry, int * value, void *foo) +{ + scr->frame_border_width = *value; + + return REFRESH_FRAME_BORDER; +} + static int setFrameBorderColor(WScreen * scr, WDefaultEntry * entry, XColor * color, void *foo) { if (scr->frame_border_color) diff --git a/src/framewin.c b/src/framewin.c index 1ce3b584..fe6a1b29 100644 --- a/src/framewin.c +++ b/src/framewin.c @@ -106,7 +106,7 @@ WFrameWindow *wFrameWindowCreate(WScreen * scr, int wlevel, int x, int y, fwin->colormap = colormap; fwin->core = wCoreCreateTopLevel(scr, x, y, width, height, (flags & WFF_BORDER) - ? FRAME_BORDER_WIDTH : 0, fwin->depth, fwin->visual, fwin->colormap, scr->frame_border_pixel); + ? scr->frame_border_width : 0, fwin->depth, fwin->visual, fwin->colormap, scr->frame_border_pixel); /* setup stacking information */ fwin->core->stacking = wmalloc(sizeof(WStacking)); @@ -369,7 +369,7 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int flags) wFrameWindowResize(fwin, width, height + fwin->top_width + fwin->bottom_width); if (flags & WFF_BORDER) - XSetWindowBorderWidth(dpy, fwin->core->window, FRAME_BORDER_WIDTH); + XSetWindowBorderWidth(dpy, fwin->core->window, scr->frame_border_width); else XSetWindowBorderWidth(dpy, fwin->core->window, 0); diff --git a/src/menu.c b/src/menu.c index 7bb0639d..b770d4cd 100644 --- a/src/menu.c +++ b/src/menu.c @@ -57,8 +57,8 @@ extern WPreferences wPreferences; #define MENU_SCROLL_STEP menuScrollParameters[(int)wPreferences.menu_scroll_speed].steps #define MENU_SCROLL_DELAY menuScrollParameters[(int)wPreferences.menu_scroll_speed].delay -#define MENUW(m) ((m)->frame->core->width+2*FRAME_BORDER_WIDTH) -#define MENUH(m) ((m)->frame->core->height+2*FRAME_BORDER_WIDTH) +#define MENUW(m) ((m)->frame->core->width+2*(m)->frame->screen_ptr->frame_border_width) +#define MENUH(m) ((m)->frame->core->height+2*(m)->frame->screen_ptr->frame_border_width) /***** Local Stuff ******/ diff --git a/src/moveres.c b/src/moveres.c index 44ddefa2..e3a63b97 100644 --- a/src/moveres.c +++ b/src/moveres.c @@ -228,10 +228,10 @@ static void showGeometry(WWindow * wwin, int x1, int y1, int x2, int y2, int dir x2--; if (HAS_BORDER_WITH_SELECT(wwin)) { - x1 += FRAME_BORDER_WIDTH; - x2 += FRAME_BORDER_WIDTH; - y1 += FRAME_BORDER_WIDTH; - y2 += FRAME_BORDER_WIDTH; + x1 += scr->frame_border_width; + x2 += scr->frame_border_width; + y1 += scr->frame_border_width; + y2 += scr->frame_border_width; } ty = y1 + wwin->frame->top_width; @@ -463,8 +463,8 @@ static void drawTransparentFrame(WWindow * wwin, int x, int y, int width, int he int bottom = 0; if (HAS_BORDER_WITH_SELECT(wwin)) { - x += FRAME_BORDER_WIDTH; - y += FRAME_BORDER_WIDTH; + x += wwin->screen_ptr->frame_border_width; + y += wwin->screen_ptr->frame_border_width; } if (HAS_TITLEBAR(wwin) && !wwin->flags.shaded) { @@ -596,9 +596,9 @@ typedef struct { #define WTOP(w) (w)->frame_y #define WLEFT(w) (w)->frame_x #define WRIGHT(w) ((w)->frame_x + (int)(w)->frame->core->width - 1 + \ - (HAS_BORDER_WITH_SELECT(w) ? 2*FRAME_BORDER_WIDTH : 0)) + (HAS_BORDER_WITH_SELECT(w) ? 2*(w)->screen_ptr->frame_border_width : 0)) #define WBOTTOM(w) ((w)->frame_y + (int)(w)->frame->core->height - 1 + \ - (HAS_BORDER_WITH_SELECT(w) ? 2*FRAME_BORDER_WIDTH : 0)) + (HAS_BORDER_WITH_SELECT(w) ? 2*(w)->screen_ptr->frame_border_width : 0)) static int compareWTop(const void *a, const void *b) { @@ -830,8 +830,8 @@ static void initMoveData(WWindow * wwin, MoveData * data) data->calcX = wwin->frame_x; data->calcY = wwin->frame_y; - data->winWidth = wwin->frame->core->width + (HAS_BORDER_WITH_SELECT(wwin) ? 2 * FRAME_BORDER_WIDTH : 0); - data->winHeight = wwin->frame->core->height + (HAS_BORDER_WITH_SELECT(wwin) ? 2 * FRAME_BORDER_WIDTH : 0); + data->winWidth = wwin->frame->core->width + (HAS_BORDER_WITH_SELECT(wwin) ? 2 * wwin->screen_ptr->frame_border_width : 0); + data->winHeight = wwin->frame->core->height + (HAS_BORDER_WITH_SELECT(wwin) ? 2 * wwin->screen_ptr->frame_border_width : 0); } static Bool checkWorkspaceChange(WWindow * wwin, MoveData * data, Bool opaqueMove) diff --git a/src/placement.c b/src/placement.c index f9667d23..5e4a8e77 100644 --- a/src/placement.c +++ b/src/placement.c @@ -294,8 +294,8 @@ static void set_width_height(WWindow *wwin, unsigned int *width, unsigned int *h *height += RESIZEBAR_HEIGHT; } if (HAS_BORDER(wwin)) { - *height += 2 * FRAME_BORDER_WIDTH; - *width += 2 * FRAME_BORDER_WIDTH; + *height += 2 * wwin->screen_ptr->frame_border_width; + *width += 2 * wwin->screen_ptr->frame_border_width; } } diff --git a/src/screen.h b/src/screen.h index b4cbddf0..5f44555d 100644 --- a/src/screen.h +++ b/src/screen.h @@ -167,6 +167,7 @@ typedef struct _WScreen { WMColor *mtext_color; /* menu item text */ WMColor *dtext_color; /* disabled menu item text */ + int frame_border_width; WMColor *frame_border_color; WMColor *frame_selected_border_color; diff --git a/src/startup.c b/src/startup.c index e1400264..00e32ef6 100644 --- a/src/startup.c +++ b/src/startup.c @@ -876,7 +876,7 @@ static void manageAllWindows(WScreen * scr, int crashRecovery) if (crashRecovery) { int border; - border = (!HAS_BORDER(wwin) ? 0 : FRAME_BORDER_WIDTH); + border = (!HAS_BORDER(wwin) ? 0 : scr->frame_border_width); wWindowMove(wwin, wwin->frame_x - border, wwin->frame_y - border - diff --git a/src/wconfig.h.in b/src/wconfig.h.in index 70f583d7..b8063dbe 100644 --- a/src/wconfig.h.in +++ b/src/wconfig.h.in @@ -355,7 +355,6 @@ #define MIN_TITLEFONT_HEIGHT(h) ((h)>14 ? (h) : 14) #define TITLEBAR_HEIGHT 18 /* window's titlebar height */ #define RESIZEBAR_HEIGHT 8 /* height of the resizebar */ -#define FRAME_BORDER_WIDTH 1 /* width of window border for frames */ #define RESIZEBAR_MIN_WIDTH 20 /* min width of handles-corner_width */ #define RESIZEBAR_CORNER_WIDTH 28 /* width of the corner of resizebars */ #define MENU_INDICATOR_SPACE 12 diff --git a/src/window.c b/src/window.c index aad3fe01..a070b0b1 100644 --- a/src/window.c +++ b/src/window.c @@ -2021,8 +2021,8 @@ void wWindowConfigure(WWindow *wwin, int req_x, int req_y, int req_width, int re wwin->frame_x = req_x; wwin->frame_y = req_y; if (HAS_BORDER(wwin)) { - wwin->client.x += FRAME_BORDER_WIDTH; - wwin->client.y += FRAME_BORDER_WIDTH; + wwin->client.x += wwin->screen_ptr->frame_border_width; + wwin->client.y += wwin->screen_ptr->frame_border_width; } #ifdef SHAPE if (wShapeSupported && wwin->flags.shaped && resize) @@ -2058,8 +2058,8 @@ void wWindowMove(WWindow *wwin, int req_x, int req_y) wwin->client.x = req_x; wwin->client.y = req_y + wwin->frame->top_width; if (HAS_BORDER(wwin)) { - wwin->client.x += FRAME_BORDER_WIDTH; - wwin->client.y += FRAME_BORDER_WIDTH; + wwin->client.x += wwin->screen_ptr->frame_border_width; + wwin->client.y += wwin->screen_ptr->frame_border_width; } XMoveWindow(dpy, wwin->frame->core->window, req_x, req_y); diff --git a/src/wmspec.c b/src/wmspec.c index c758f0a8..515b66ca 100644 --- a/src/wmspec.c +++ b/src/wmspec.c @@ -1608,10 +1608,10 @@ void wNETFrameExtents(WWindow *wwin) if (wwin->frame->resizebar) extents[3] = wwin->frame->resizebar->height; if (HAS_BORDER(wwin)) { - extents[0] += FRAME_BORDER_WIDTH; - extents[1] += FRAME_BORDER_WIDTH; - extents[2] += FRAME_BORDER_WIDTH; - extents[3] += FRAME_BORDER_WIDTH; + extents[0] += wwin->screen_ptr->frame_border_width; + extents[1] += wwin->screen_ptr->frame_border_width; + extents[2] += wwin->screen_ptr->frame_border_width; + extents[3] += wwin->screen_ptr->frame_border_width; } XChangeProperty(dpy, wwin->client_win, net_frame_extents, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) extents, 4); diff --git a/util/getstyle.c b/util/getstyle.c index 3caa3155..e9ee696a 100644 --- a/util/getstyle.c +++ b/util/getstyle.c @@ -86,6 +86,7 @@ static char *options[] = { "IconBack", "IconTitleColor", "IconTitleBack", + "FrameBorderWidth", "FrameBorderColor", "FrameSelectedBorderColor", "MenuStyle",