summarylogtreecommitdiffstats
path: root/13-FvwmIconMan.patch
blob: cf14f4f6ce49d7b295fb8e7918210a9c67834b26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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