Skip to content

Commit

Permalink
Refine copyright information
Browse files Browse the repository at this point in the history
  • Loading branch information
jserv committed Feb 2, 2025
1 parent a290fd0 commit eeb3303
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 23 deletions.
2 changes: 1 addition & 1 deletion backend/fbdev.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down
6 changes: 2 additions & 4 deletions backend/linux_vt.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
* All rights reserved.
*/

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

static inline int twin_vt_open(int vt_num)
{
int fd;

char vt_dev[VT_DEV_TTY_MAX] = {0};
snprintf(vt_dev, VT_DEV_TTY_MAX, "/dev/tty%d", vt_num);

fd = open(vt_dev, O_RDWR);
int fd = open(vt_dev, O_RDWR);
if (fd < 0) {
log_error("Failed to open %s", vt_dev);
}
Expand Down
1 change: 1 addition & 0 deletions include/twin.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down
1 change: 1 addition & 0 deletions include/twin_private.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down
2 changes: 2 additions & 0 deletions src/dispatch.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand All @@ -16,6 +17,7 @@ void twin_dispatch(twin_context_t *ctx)
for (;;) {
_twin_run_timeout();
_twin_run_work();

if (g_twin_backend.poll && !g_twin_backend.poll(ctx)) {
twin_time_t delay = _twin_timeout_delay();
if (delay > 0)
Expand Down
2 changes: 1 addition & 1 deletion src/draw-pixman.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down
1 change: 1 addition & 0 deletions src/draw.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down
1 change: 1 addition & 0 deletions src/fixed.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down
32 changes: 17 additions & 15 deletions src/matrix.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand All @@ -11,9 +12,9 @@ void twin_matrix_multiply(twin_matrix_t *result,
const twin_matrix_t *b)
{
twin_matrix_t r;
twin_fixed_t t;

for (int row = 0; row < 3; row++)
for (int row = 0; row < 3; row++) {
twin_fixed_t t;
for (int col = 0; col < 2; col++) {
if (row == 2)
t = b->m[2][col];
Expand All @@ -23,6 +24,7 @@ void twin_matrix_multiply(twin_matrix_t *result,
t += twin_fixed_mul(a->m[row][n], b->m[n][col]);
r.m[row][col] = t;
}
}

*result = r;
}
Expand Down Expand Up @@ -72,14 +74,13 @@ void twin_matrix_scale(twin_matrix_t *m, twin_fixed_t sx, twin_fixed_t sy)
twin_fixed_t _twin_matrix_determinant(twin_matrix_t *matrix)
{
twin_fixed_t a, b, c, d;
twin_fixed_t det;

a = matrix->m[0][0];
b = matrix->m[0][1];
c = matrix->m[1][0];
d = matrix->m[1][1];

det = twin_fixed_mul(a, d) - twin_fixed_mul(b, c);
twin_fixed_t det = twin_fixed_mul(a, d) - twin_fixed_mul(b, c);

return det;
}
Expand All @@ -99,31 +100,32 @@ twin_point_t _twin_matrix_expand(twin_matrix_t *matrix)

void twin_matrix_rotate(twin_matrix_t *m, twin_angle_t a)
{
twin_matrix_t t;
twin_fixed_t c, s;
twin_sincos(a, &s, &c);

t.m[0][0] = c;
t.m[0][1] = s;
t.m[1][0] = -s;
t.m[1][1] = c;
t.m[2][0] = 0;
t.m[2][1] = 0;
twin_matrix_t t = {
.m[0][0] = c,
.m[0][1] = s,
.m[1][0] = -s,
.m[1][1] = c,
.m[2][0] = 0,
.m[2][1] = 0,
};
twin_matrix_multiply(m, &t, m);
}

twin_sfixed_t _twin_matrix_x(twin_matrix_t *m, twin_fixed_t x, twin_fixed_t y)
{
twin_sfixed_t s;
s = twin_fixed_to_sfixed(twin_fixed_mul(m->m[0][0], x) +
twin_sfixed_t s =
twin_fixed_to_sfixed(twin_fixed_mul(m->m[0][0], x) +
twin_fixed_mul(m->m[1][0], y) + m->m[2][0]);
return s;
}

twin_sfixed_t _twin_matrix_y(twin_matrix_t *m, twin_fixed_t x, twin_fixed_t y)
{
twin_sfixed_t s;
s = twin_fixed_to_sfixed(twin_fixed_mul(m->m[0][1], x) +
twin_sfixed_t s =
twin_fixed_to_sfixed(twin_fixed_mul(m->m[0][1], x) +
twin_fixed_mul(m->m[1][1], y) + m->m[2][1]);
return s;
}
Expand Down
1 change: 1 addition & 0 deletions src/path.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down
2 changes: 2 additions & 0 deletions src/pixmap.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand All @@ -13,6 +14,7 @@
(((alignment) & ((alignment) - 1)) == 0 \
? (((sz) + (alignment) - 1) & ~((alignment) - 1)) \
: ((((sz) + (alignment) - 1) / (alignment)) * (alignment)))

twin_pixmap_t *twin_pixmap_create(twin_format_t format,
twin_coord_t width,
twin_coord_t height)
Expand Down
1 change: 1 addition & 0 deletions src/poly.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down
5 changes: 3 additions & 2 deletions src/queue.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand All @@ -17,6 +18,7 @@ void _twin_queue_insert(twin_queue_t **head,
for (prev = head; (q = *prev); prev = &q->next)
if ((*proc)(new, q) == TWIN_AFTER)
break;

new->next = *prev;
new->order = 0;
new->deleted = false;
Expand Down Expand Up @@ -59,9 +61,8 @@ twin_queue_t *_twin_queue_set_order(twin_queue_t **head)
{
twin_queue_t *first = *head;

for (twin_queue_t *q = first; q; q = q->next) {
for (twin_queue_t *q = first; q; q = q->next)
q->order = q->next;
}
return first;
}

Expand Down
1 change: 1 addition & 0 deletions src/screen.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down
1 change: 1 addition & 0 deletions src/spline.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Carl Worth <[email protected]>
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down
8 changes: 8 additions & 0 deletions src/trig.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down Expand Up @@ -34,6 +35,7 @@ twin_fixed_t twin_tan(twin_angle_t a)
}
if (s == 0)
return 0;

return ((s << 15) / c) << 1;
}

Expand Down Expand Up @@ -124,7 +126,9 @@ static twin_angle_t twin_atan2_first_quadrant(twin_fixed_t y, twin_fixed_t x)
return TWIN_ANGLE_90;
if (y == 0)
return TWIN_ANGLE_0;

twin_angle_t angle = 0;

/* CORDIC iteration */
/*
* To enhance accuracy, the angle is mapped from the range 0-360 degrees to
Expand All @@ -143,6 +147,7 @@ static twin_angle_t twin_atan2_first_quadrant(twin_fixed_t y, twin_fixed_t x)
angle -= atan_table[i];
}
}

return (twin_angle_t) (double) angle / (32768.0) * TWIN_ANGLE_360;
}

Expand All @@ -154,6 +159,7 @@ twin_angle_t twin_atan2(twin_fixed_t y, twin_fixed_t x)
return (y > 0) ? TWIN_ANGLE_90 : TWIN_ANGLE_270;
if (y == 0)
return (x > 0) ? TWIN_ANGLE_0 : TWIN_ANGLE_180;

twin_fixed_t x_sign_mask = x >> 31;
twin_fixed_t abs_x = (x ^ x_sign_mask) - x_sign_mask;
twin_fixed_t y_sign_mask = y >> 31;
Expand All @@ -164,6 +170,7 @@ twin_angle_t twin_atan2(twin_fixed_t y, twin_fixed_t x)
((~x_sign_mask & y_sign_mask) * 2);
twin_fixed_t sign = 1 - 2 * (x_sign_mask ^ y_sign_mask);
twin_angle_t angle = twin_atan2_first_quadrant(abs_y, abs_x);

/* First quadrant : angle
* Second quadrant : 180 - angle
* Third quadrant : 180 + angle
Expand All @@ -178,6 +185,7 @@ twin_angle_t twin_acos(twin_fixed_t x)
return TWIN_ANGLE_180;
if (x >= TWIN_FIXED_ONE)
return TWIN_ANGLE_0;

twin_fixed_t y = twin_fixed_sqrt(TWIN_FIXED_ONE - twin_fixed_mul(x, x));
if (x < 0)
return TWIN_ANGLE_180 - twin_atan2_first_quadrant(y, -x);
Expand Down
5 changes: 5 additions & 0 deletions src/widget.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down Expand Up @@ -117,6 +118,7 @@ void _twin_widget_init(twin_widget_t *widget,
window = parent->widget.window;
} else
widget->next = NULL;

widget->window = window;
widget->parent = parent;
widget->copy_geom = NULL;
Expand All @@ -137,6 +139,7 @@ void _twin_widget_queue_paint(twin_widget_t *widget)
while (widget->parent) {
if (widget->paint)
return;

widget->paint = true;
widget = &widget->parent->widget;
}
Expand All @@ -148,6 +151,7 @@ void _twin_widget_queue_layout(twin_widget_t *widget)
while (widget->parent) {
if (widget->layout)
return;

widget->layout = true;
widget->paint = true;
widget = &widget->parent->widget;
Expand Down Expand Up @@ -179,6 +183,7 @@ void _twin_widget_bevel(twin_widget_t *widget, twin_fixed_t b, bool down)
top_color = 0x80808080;
bot_color = 0x80000000;
}

twin_path_move(path, 0, 0);
twin_path_draw(path, w, 0);
twin_path_draw(path, w - b, b);
Expand Down
1 change: 1 addition & 0 deletions src/window.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Twin - A Tiny Window System
* Copyright (c) 2004 Keith Packard <[email protected]>
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
* All rights reserved.
*/

Expand Down
1 change: 1 addition & 0 deletions tools/font-edit/twin-fedit.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2004 Keith Packard
* Copyright (c) 2024-2025 National Cheng Kung University, Taiwan
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
Expand Down

0 comments on commit eeb3303

Please sign in to comment.