Dominik Vogt wrote:
I don't really care whether it's possible or not. But if the thickness is 0, RelieveRectangle() should never be called.
Of course. Sorry for not catching that this first time. Fixed in this version of the patch.
I wouldn't mind to add this to your patch.
Included... - Chris
Index: fvwm/libs/Graphics.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/libs/Graphics.c,v retrieving revision 1.78 diff -u -u -r1.78 Graphics.c --- fvwm/libs/Graphics.c 16 Feb 2004 10:18:29 -0000 1.78 +++ fvwm/libs/Graphics.c 15 Mar 2004 20:29:18 -0000 @@ -87,6 +87,13 @@ { return; } + /* If line_width is negative, reverse the rotation, which will */ + /* have the effect of inverting the relief. */ + if (line_width < 0) + { + line_width *= -1; + rotation = (rotation + 2) % 4; + } if (rotation == ROTATION_270) { rotation = ROTATION_90; Index: fvwm/modules/FvwmIconMan/FvwmIconMan.1 =================================================================== RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/FvwmIconMan.1,v retrieving revision 1.27 diff -u -u -r1.27 FvwmIconMan.1 --- fvwm/modules/FvwmIconMan/FvwmIconMan.1 19 Apr 2003 03:01:02 -0000 1.27 +++ fvwm/modules/FvwmIconMan/FvwmIconMan.1 15 Mar 2004 20:29:19 -0000 @@ -108,6 +108,7 @@ NoIconAction animate iconification NOP PlainButton style for normal buttons up black grey PlainColorset +ReliefThickness size of button relief 2 Resolution global/desk/page/screen page Reverse normal, icon or none none SelectButton style for selected buttons flat black grey @@ -249,6 +250,13 @@ .IP "*FvwmIconMan: [id] PlainColorset \fIcolorset\fP" Works like plainbutton but uses colorsets instead. The style setting can still only be applied with plainbutton. See FvwmTheme. + +.IP "*FvwmIconMan: [id] ReliefThickness \fInum\fP" +\fInum\fP is a positive integer specifying the number of pixels thick +that the relief at the edge of non-flat buttons should be. This has +no effect on flat buttons. In theory, you should be able to set this +to a negative number and have it act like \fIReverse\fP, but negative +numbers don't work. This may change later. .IP "*FvwmIconMan: [id] Resolution \fIresolution\fP" Specifies when the manager will display an entry for a certain Index: fvwm/modules/FvwmIconMan/FvwmIconMan.h =================================================================== RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/FvwmIconMan.h,v retrieving revision 1.55 diff -u -u -r1.55 FvwmIconMan.h --- fvwm/modules/FvwmIconMan/FvwmIconMan.h 25 Aug 2003 06:47:09 -0000 1.55 +++ fvwm/modules/FvwmIconMan/FvwmIconMan.h 15 Mar 2004 20:29:19 -0000 @@ -303,6 +303,7 @@ Uchar showonlyiconic; Uchar showtransient; rectangle managed_g; /* dimensions of managed screen portion */ + int relief_thickness; /* relief thickness for each non-flat button */ /* X11 state */ Window theWindow, theFrame; Index: fvwm/modules/FvwmIconMan/globals.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/globals.c,v retrieving revision 1.25 diff -u -u -r1.25 globals.c --- fvwm/modules/FvwmIconMan/globals.c 29 Jun 2003 19:53:25 -0000 1.25 +++ fvwm/modules/FvwmIconMan/globals.c 15 Mar 2004 20:29:19 -0000 @@ -83,6 +83,7 @@ globals.managers[id].we_are_drawing = 1; globals.managers[id].showonlyiconic = 0; globals.managers[id].showtransient = 0; + globals.managers[id].relief_thickness = 2; } void print_managers(void) Index: fvwm/modules/FvwmIconMan/readconfig.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/readconfig.c,v retrieving revision 1.55 diff -u -u -r1.55 readconfig.c --- fvwm/modules/FvwmIconMan/readconfig.c 5 Jul 2003 01:37:47 -0000 1.55 +++ fvwm/modules/FvwmIconMan/readconfig.c 15 Mar 2004 20:29:19 -0000 @@ -1951,6 +1951,19 @@ ConsoleDebug(CONFIG, "Setting usewinlist to: %d\n", i); SET_MANAGER(manager, usewinlist, i); } + else if (!strcasecmp(option1, "reliefthickness")) { + p = read_next_cmd(READ_ARG); + if (!p) { + ConsoleMessage("Bad line: %s\n", current_line); + continue; + } + if (extract_int(p, &n) == 0) { + ConsoleMessage("This is not a number: %s\n", p); + ConsoleMessage("Bad line: %s\n", current_line); + continue; + } + SET_MANAGER(manager, relief_thickness, n); + } else { ConsoleMessage("Bad line: %s\n", current_line); ConsoleMessage("Unknown option: %s\n", p); Index: fvwm/modules/FvwmIconMan/xmanager.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/xmanager.c,v retrieving revision 1.83 diff -u -u -r1.83 xmanager.c --- fvwm/modules/FvwmIconMan/xmanager.c 25 Aug 2003 06:47:09 -0000 1.83 +++ fvwm/modules/FvwmIconMan/xmanager.c 15 Mar 2004 20:29:20 -0000 @@ -1336,13 +1336,13 @@ static void draw_3d_icon(WinManager *man, int box, ButtonGeometry *g, int iconified, Contexts contextId) { - if (iconified == 0) + if ((iconified == 0) || (man->relief_thickness == 0)) return; else RelieveRectangle(theDisplay, man->theWindow, g->icon_x, g->icon_y, g->icon_w - 1, g->icon_h - 1, man->reliefContext[contextId], - man->shadowContext[contextId], 2); + man->shadowContext[contextId], man->relief_thickness); } @@ -1537,19 +1537,36 @@ GC context1, GC context2) { int state; + int relief; + state = man->buttonState[button_state]; + relief = man->relief_thickness; + + /* Make sure that the relief isn't too large for the button... */ + if ((abs(relief) > (man->geometry.boxheight / 2)) || + (abs(relief) > (man->geometry.boxwidth / 2))) { + relief = min(man->geometry.boxheight/2, man->geometry.boxwidth/2); + if (man->relief_thickness < 0) + relief *= -1; + fprintf(stderr, "%s: Requested relief (%d) too large (for %dx%d box); capped to %d.\n", + MyName, man->relief_thickness, man->geometry.boxwidth, man->geometry.boxheight, relief); + man->relief_thickness = relief; + } - if (state == BUTTON_FLAT) + if (state == BUTTON_FLAT || relief == 0) return; if (state == BUTTON_EDGEUP || state == BUTTON_EDGEDOWN) { RelieveRectangle(theDisplay, man->theWindow, g->button_x, g->button_y, - g->button_w - 1, g->button_h - 1, context1, context2, 2); + g->button_w - 1, g->button_h - 1, context1, context2, + relief); RelieveRectangle(theDisplay, man->theWindow, g->button_x+2, g->button_y+2, - g->button_w - 5, g->button_h - 5, context2, context1, 2); + g->button_w - 5, g->button_h - 5, context2, context1, + relief); } else { RelieveRectangle(theDisplay, man->theWindow, g->button_x, g->button_y, - g->button_w - 1, g->button_h - 1, context1, context2, 2); + g->button_w - 1, g->button_h - 1, context1, context2, + relief); } }