Skip to content

Commit eeb3303

Browse files
committedFeb 2, 2025·
Refine copyright information
1 parent a290fd0 commit eeb3303

19 files changed

+51
-23
lines changed
 

‎backend/fbdev.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Twin - A Tiny Window System
3-
* Copyright (c) 2024 National Cheng Kung University, Taiwan
3+
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
44
* All rights reserved.
55
*/
66

‎backend/linux_vt.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Twin - A Tiny Window System
3-
* Copyright (c) 2024 National Cheng Kung University, Taiwan
3+
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
44
* All rights reserved.
55
*/
66

@@ -25,12 +25,10 @@ static volatile sig_atomic_t *is_vt_actived;
2525

2626
static inline int twin_vt_open(int vt_num)
2727
{
28-
int fd;
29-
3028
char vt_dev[VT_DEV_TTY_MAX] = {0};
3129
snprintf(vt_dev, VT_DEV_TTY_MAX, "/dev/tty%d", vt_num);
3230

33-
fd = open(vt_dev, O_RDWR);
31+
int fd = open(vt_dev, O_RDWR);
3432
if (fd < 0) {
3533
log_error("Failed to open %s", vt_dev);
3634
}

‎include/twin.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

‎include/twin_private.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

‎src/dispatch.c

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

@@ -16,6 +17,7 @@ void twin_dispatch(twin_context_t *ctx)
1617
for (;;) {
1718
_twin_run_timeout();
1819
_twin_run_work();
20+
1921
if (g_twin_backend.poll && !g_twin_backend.poll(ctx)) {
2022
twin_time_t delay = _twin_timeout_delay();
2123
if (delay > 0)

‎src/draw-pixman.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Twin - A Tiny Window System
3-
* Copyright (c) 2024 National Cheng Kung University, Taiwan
3+
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
44
* All rights reserved.
55
*/
66

‎src/draw.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

‎src/fixed.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

‎src/matrix.c

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

@@ -11,9 +12,9 @@ void twin_matrix_multiply(twin_matrix_t *result,
1112
const twin_matrix_t *b)
1213
{
1314
twin_matrix_t r;
14-
twin_fixed_t t;
1515

16-
for (int row = 0; row < 3; row++)
16+
for (int row = 0; row < 3; row++) {
17+
twin_fixed_t t;
1718
for (int col = 0; col < 2; col++) {
1819
if (row == 2)
1920
t = b->m[2][col];
@@ -23,6 +24,7 @@ void twin_matrix_multiply(twin_matrix_t *result,
2324
t += twin_fixed_mul(a->m[row][n], b->m[n][col]);
2425
r.m[row][col] = t;
2526
}
27+
}
2628

2729
*result = r;
2830
}
@@ -72,14 +74,13 @@ void twin_matrix_scale(twin_matrix_t *m, twin_fixed_t sx, twin_fixed_t sy)
7274
twin_fixed_t _twin_matrix_determinant(twin_matrix_t *matrix)
7375
{
7476
twin_fixed_t a, b, c, d;
75-
twin_fixed_t det;
7677

7778
a = matrix->m[0][0];
7879
b = matrix->m[0][1];
7980
c = matrix->m[1][0];
8081
d = matrix->m[1][1];
8182

82-
det = twin_fixed_mul(a, d) - twin_fixed_mul(b, c);
83+
twin_fixed_t det = twin_fixed_mul(a, d) - twin_fixed_mul(b, c);
8384

8485
return det;
8586
}
@@ -99,31 +100,32 @@ twin_point_t _twin_matrix_expand(twin_matrix_t *matrix)
99100

100101
void twin_matrix_rotate(twin_matrix_t *m, twin_angle_t a)
101102
{
102-
twin_matrix_t t;
103103
twin_fixed_t c, s;
104104
twin_sincos(a, &s, &c);
105105

106-
t.m[0][0] = c;
107-
t.m[0][1] = s;
108-
t.m[1][0] = -s;
109-
t.m[1][1] = c;
110-
t.m[2][0] = 0;
111-
t.m[2][1] = 0;
106+
twin_matrix_t t = {
107+
.m[0][0] = c,
108+
.m[0][1] = s,
109+
.m[1][0] = -s,
110+
.m[1][1] = c,
111+
.m[2][0] = 0,
112+
.m[2][1] = 0,
113+
};
112114
twin_matrix_multiply(m, &t, m);
113115
}
114116

115117
twin_sfixed_t _twin_matrix_x(twin_matrix_t *m, twin_fixed_t x, twin_fixed_t y)
116118
{
117-
twin_sfixed_t s;
118-
s = twin_fixed_to_sfixed(twin_fixed_mul(m->m[0][0], x) +
119+
twin_sfixed_t s =
120+
twin_fixed_to_sfixed(twin_fixed_mul(m->m[0][0], x) +
119121
twin_fixed_mul(m->m[1][0], y) + m->m[2][0]);
120122
return s;
121123
}
122124

123125
twin_sfixed_t _twin_matrix_y(twin_matrix_t *m, twin_fixed_t x, twin_fixed_t y)
124126
{
125-
twin_sfixed_t s;
126-
s = twin_fixed_to_sfixed(twin_fixed_mul(m->m[0][1], x) +
127+
twin_sfixed_t s =
128+
twin_fixed_to_sfixed(twin_fixed_mul(m->m[0][1], x) +
127129
twin_fixed_mul(m->m[1][1], y) + m->m[2][1]);
128130
return s;
129131
}

‎src/path.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

‎src/pixmap.c

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

@@ -13,6 +14,7 @@
1314
(((alignment) & ((alignment) - 1)) == 0 \
1415
? (((sz) + (alignment) - 1) & ~((alignment) - 1)) \
1516
: ((((sz) + (alignment) - 1) / (alignment)) * (alignment)))
17+
1618
twin_pixmap_t *twin_pixmap_create(twin_format_t format,
1719
twin_coord_t width,
1820
twin_coord_t height)

‎src/poly.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

‎src/queue.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

@@ -17,6 +18,7 @@ void _twin_queue_insert(twin_queue_t **head,
1718
for (prev = head; (q = *prev); prev = &q->next)
1819
if ((*proc)(new, q) == TWIN_AFTER)
1920
break;
21+
2022
new->next = *prev;
2123
new->order = 0;
2224
new->deleted = false;
@@ -59,9 +61,8 @@ twin_queue_t *_twin_queue_set_order(twin_queue_t **head)
5961
{
6062
twin_queue_t *first = *head;
6163

62-
for (twin_queue_t *q = first; q; q = q->next) {
64+
for (twin_queue_t *q = first; q; q = q->next)
6365
q->order = q->next;
64-
}
6566
return first;
6667
}
6768

‎src/screen.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

‎src/spline.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Carl Worth <cworth@cworth.org>
4+
* Copyright (c) 2024 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

‎src/trig.c

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

@@ -34,6 +35,7 @@ twin_fixed_t twin_tan(twin_angle_t a)
3435
}
3536
if (s == 0)
3637
return 0;
38+
3739
return ((s << 15) / c) << 1;
3840
}
3941

@@ -124,7 +126,9 @@ static twin_angle_t twin_atan2_first_quadrant(twin_fixed_t y, twin_fixed_t x)
124126
return TWIN_ANGLE_90;
125127
if (y == 0)
126128
return TWIN_ANGLE_0;
129+
127130
twin_angle_t angle = 0;
131+
128132
/* CORDIC iteration */
129133
/*
130134
* To enhance accuracy, the angle is mapped from the range 0-360 degrees to
@@ -143,6 +147,7 @@ static twin_angle_t twin_atan2_first_quadrant(twin_fixed_t y, twin_fixed_t x)
143147
angle -= atan_table[i];
144148
}
145149
}
150+
146151
return (twin_angle_t) (double) angle / (32768.0) * TWIN_ANGLE_360;
147152
}
148153

@@ -154,6 +159,7 @@ twin_angle_t twin_atan2(twin_fixed_t y, twin_fixed_t x)
154159
return (y > 0) ? TWIN_ANGLE_90 : TWIN_ANGLE_270;
155160
if (y == 0)
156161
return (x > 0) ? TWIN_ANGLE_0 : TWIN_ANGLE_180;
162+
157163
twin_fixed_t x_sign_mask = x >> 31;
158164
twin_fixed_t abs_x = (x ^ x_sign_mask) - x_sign_mask;
159165
twin_fixed_t y_sign_mask = y >> 31;
@@ -164,6 +170,7 @@ twin_angle_t twin_atan2(twin_fixed_t y, twin_fixed_t x)
164170
((~x_sign_mask & y_sign_mask) * 2);
165171
twin_fixed_t sign = 1 - 2 * (x_sign_mask ^ y_sign_mask);
166172
twin_angle_t angle = twin_atan2_first_quadrant(abs_y, abs_x);
173+
167174
/* First quadrant : angle
168175
* Second quadrant : 180 - angle
169176
* Third quadrant : 180 + angle
@@ -178,6 +185,7 @@ twin_angle_t twin_acos(twin_fixed_t x)
178185
return TWIN_ANGLE_180;
179186
if (x >= TWIN_FIXED_ONE)
180187
return TWIN_ANGLE_0;
188+
181189
twin_fixed_t y = twin_fixed_sqrt(TWIN_FIXED_ONE - twin_fixed_mul(x, x));
182190
if (x < 0)
183191
return TWIN_ANGLE_180 - twin_atan2_first_quadrant(y, -x);

‎src/widget.c

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

@@ -117,6 +118,7 @@ void _twin_widget_init(twin_widget_t *widget,
117118
window = parent->widget.window;
118119
} else
119120
widget->next = NULL;
121+
120122
widget->window = window;
121123
widget->parent = parent;
122124
widget->copy_geom = NULL;
@@ -137,6 +139,7 @@ void _twin_widget_queue_paint(twin_widget_t *widget)
137139
while (widget->parent) {
138140
if (widget->paint)
139141
return;
142+
140143
widget->paint = true;
141144
widget = &widget->parent->widget;
142145
}
@@ -148,6 +151,7 @@ void _twin_widget_queue_layout(twin_widget_t *widget)
148151
while (widget->parent) {
149152
if (widget->layout)
150153
return;
154+
151155
widget->layout = true;
152156
widget->paint = true;
153157
widget = &widget->parent->widget;
@@ -179,6 +183,7 @@ void _twin_widget_bevel(twin_widget_t *widget, twin_fixed_t b, bool down)
179183
top_color = 0x80808080;
180184
bot_color = 0x80000000;
181185
}
186+
182187
twin_path_move(path, 0, 0);
183188
twin_path_draw(path, w, 0);
184189
twin_path_draw(path, w - b, b);

‎src/window.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Twin - A Tiny Window System
33
* Copyright (c) 2004 Keith Packard <keithp@keithp.com>
4+
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
45
* All rights reserved.
56
*/
67

‎tools/font-edit/twin-fedit.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2004 Keith Packard
3+
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
34
*
45
* Permission to use, copy, modify, distribute, and sell this software and its
56
* documentation for any purpose is hereby granted without fee, provided that

0 commit comments

Comments
 (0)
Please sign in to comment.