kiss-mfavila-small/ports/unofficial/stable/fvwm-patched/patches/13-FvwmIconMan.patch

115 lines
4.0 KiB
Diff
Raw Normal View History

2021-05-09 02:10:08 -04:00
diff --unified --recursive --text fvwm-2.6.9/modules/FvwmIconMan/FvwmIconMan.h fvwm-patched/modules/FvwmIconMan/FvwmIconMan.h
--- fvwm-2.6.9/modules/FvwmIconMan/FvwmIconMan.h 2016-10-15 08:51:45.000000000 -0600
+++ fvwm-patched/modules/FvwmIconMan/FvwmIconMan.h 2020-08-21 16:30:38.324120869 -0600
@@ -317,6 +317,8 @@
char *tips_fontname;
char *tips_formatstring;
ftips_config *tips_conf;
+ Uchar roundedcorners;
+ int padding;
/* X11 state */
Window theWindow, theFrame;
Only in fvwm-patched/modules/FvwmIconMan: FvwmIconMan.h.orig
diff --unified --recursive --text fvwm-2.6.9/modules/FvwmIconMan/readconfig.c fvwm-patched/modules/FvwmIconMan/readconfig.c
--- fvwm-2.6.9/modules/FvwmIconMan/readconfig.c 2018-05-26 05:35:26.000000000 -0600
+++ fvwm-patched/modules/FvwmIconMan/readconfig.c 2020-08-21 16:30:38.324120869 -0600
@@ -2037,6 +2037,40 @@
}
SET_MANAGER(manager, relief_thickness, n);
}
+ else if (!strcasecmp(option1, "padding")) {
+ 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, padding, n);
+ }
+ else if (!strcasecmp(option1, "roundedcorners")) {
+ p = read_next_cmd(READ_ARG);
+ if (!p) {
+ ConsoleMessage("Bad line: %s\n", current_line);
+ ConsoleMessage("Need argument to roundedcorners\n");
+ continue;
+ }
+ if (!strcasecmp(p, "true")) {
+ i = 1;
+ }
+ else if (!strcasecmp(p, "false")) {
+ i = 0;
+ }
+ else {
+ ConsoleMessage("Bad line: %s\n", current_line);
+ ConsoleMessage("What is this: %s?\n", p);
+ continue;
+ }
+ ConsoleDebug(CONFIG, "Setting roundedcorners to: %d\n", i);
+ SET_MANAGER(manager, roundedcorners, i);
+ }
else if (!strcasecmp(option1, "tips")) {
p = read_next_cmd(READ_ARG);
if (!p) {
Only in fvwm-patched/modules/FvwmIconMan: readconfig.c.orig
diff --unified --recursive --text fvwm-2.6.9/modules/FvwmIconMan/xmanager.c fvwm-patched/modules/FvwmIconMan/xmanager.c
--- fvwm-2.6.9/modules/FvwmIconMan/xmanager.c 2018-05-26 05:35:26.000000000 -0600
+++ fvwm-patched/modules/FvwmIconMan/xmanager.c 2020-08-21 16:30:38.324120869 -0600
@@ -1397,6 +1397,8 @@
g->text_y = g->button_y + text_pad;
g->text_base = g->text_y + man->FButtonFont->ascent;
+
+ g->button_w -= man->padding;
}
static void draw_button_background(
@@ -1669,6 +1671,33 @@
}
}
+static void __draw_rounded_corner(WinManager *man, ButtonGeometry *g,
+ int x, int y, int width, int height, GC gc)
+{
+ int x1 = g->button_x + x;
+ int x2 = g->button_x + g->button_w - x - width;
+ int y1 = g->button_y + y;
+ int y2 = g->button_y + g->button_h - y - height;
+
+ XFillRectangle(theDisplay, man->theWindow, gc, x1, y1, width, height);
+ XFillRectangle(theDisplay, man->theWindow, gc, x2, y1, width, height);
+ XFillRectangle(theDisplay, man->theWindow, gc, x1, y2, width, height);
+ XFillRectangle(theDisplay, man->theWindow, gc, x2, y2, width, height);
+}
+
+static void draw_rounded_corners(WinManager *man, ButtonGeometry *g, GC gc)
+{
+ if (man->roundedcorners)
+ {
+ __draw_rounded_corner(man, g, 0, 0, 2, 1, man->backContext[TITLE_CONTEXT]);
+ __draw_rounded_corner(man, g, 0, 1, 1, 1, man->backContext[TITLE_CONTEXT]);
+ __draw_rounded_corner(man, g, 1, 1, 1, 1, gc);
+ }
+
+ XFillRectangle(theDisplay, man->theWindow, man->backContext[TITLE_CONTEXT],
+ g->button_x + g->button_w, g->button_y, man->padding, g->button_h);
+}
+
static void draw_button(WinManager *man, int button, int force)
{
Button *b;
@@ -1857,6 +1886,8 @@
draw_relief(
man, button_state, &g, context1,
context2);
+
+ draw_rounded_corners(man, &g, context1);
}
else if (button_state == SELECT_CONTEXT ||
button_state == FOCUS_SELECT_CONTEXT ||
Only in fvwm-patched/modules/FvwmIconMan: xmanager.c.orig