Skip to content

Commit 30a8d5a

Browse files
authored
Merge pull request #62 from ful1e5/feat/custom-canvas-sizes
feat: custom canvas sizes for improved Windows cursor resizing
2 parents 5bc1a49 + 16d4f24 commit 30a8d5a

File tree

22 files changed

+123
-62
lines changed

22 files changed

+123
-62
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [unreleased]
99

10+
### What's New?
11+
12+
- Clickgen now allows cursor bitmap re-canvasing by specifying size using the `cursor_size:canvas_size` format. See [changelog-05212024](https://github.com/ful1e5/clickgen/discussions/59#discussioncomment-9511166)
13+
1014
## [v2.2.2] - 24 April 2024
1115

1216
### Important Changes

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,22 @@ Clickgen's core functionality is heavily inspired by [quantum5/win2xcur](https:/
1717
> **Note**
1818
> The project's success depends on sponsorships. Meeting sponsorship goals for [ful1e5](https://github.com/ful1e5) GitHub Account will drive new releases and ongoing development.
1919
20-
- **2023-08-23:** `ctgen` CLI supports `.json` and `.yaml`/`.yml` as configuration file.
21-
- **2023-08-17:** Cursor size settings moved to `[cursors.fallback_settings]` in config. See [changelog-08172023](https://github.com/ful1e5/clickgen/discussions/59#discussioncomment-6747666)
22-
- **2022-06-15:** Docker Image support deprecated due to cross-platform compatibility.
23-
- **2022-07-09:** :warning: All the **functionality and modules are removed from older versions in `v2.0.0`**.
24-
I will be restricting any updates to the `>=v1.2.0` versions to security updates and hotfixes.
25-
Check updated documentations for [building cursors from API](#api-examples) and [CLIs](#usage) usage.
20+
- **2024-05-24:** Clickgen now allows cursor bitmap re-canvasing by specifying size using the `cursor_size:canvas_size` format. See [changelog-05212024](https://github.com/ful1e5/clickgen/discussions/59#discussioncomment-9511166)
21+
- **2023-08-23:** `ctgen` CLI supports `.json` and `.yaml`/`.yml` as configuration file.
22+
- **2023-08-17:** Cursor size settings moved to `[cursors.fallback_settings]` in config. See [changelog-08172023](https://github.com/ful1e5/clickgen/discussions/59#discussioncomment-6747666)
23+
- **2022-06-15:** Docker Image support deprecated due to cross-platform compatibility.
24+
- **2022-07-09:** :warning: All the **functionality and modules are removed from older versions in `v2.0.0`**.
25+
I will be restricting any updates to the `>=v1.2.0` versions to security updates and hotfixes.
26+
Check updated documentations for [building cursors from API](#api-examples) and [CLIs](#usage) usage.
2627

2728
## Requirements
2829

29-
- Python version 3.7.5 or higher
30-
- [Pillow](https://pypi.org/project/Pillow) >= 8.1.1
31-
- [PyYaml](https://pypi.org/project/PyYaml) >= 6.0.1
32-
- [attrs](https://pypi.org/project/attrs) >= 15.0.0
33-
- [numpy](https://pypi.org/project/numpy) >= 1.21.6
34-
- [toml](https://pypi.org/project/toml) >= 0.10.2
30+
- Python version 3.7.5 or higher
31+
- [Pillow](https://pypi.org/project/Pillow) >= 8.1.1
32+
- [PyYaml](https://pypi.org/project/PyYaml) >= 6.0.1
33+
- [attrs](https://pypi.org/project/attrs) >= 15.0.0
34+
- [numpy](https://pypi.org/project/numpy) >= 1.21.6
35+
- [toml](https://pypi.org/project/toml) >= 0.10.2
3536

3637
## Install
3738

@@ -45,7 +46,7 @@ pip3 install clickgen
4546
4647
### Arch Linux
4748

48-
- [AUR](https://aur.archlinux.org/packages/python-clickgen)
49+
- [AUR](https://aur.archlinux.org/packages/python-clickgen)
4950

5051
## Usage
5152

samples/custom_build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
pngs.append(p.read())
2626

2727
try:
28-
ani = open_blob(pngs, hotspot=(100, 100))
28+
ani = open_blob(pngs, hotspot=(100, 100), sizes=["24:32", "32"])
2929

3030
# save Windows animated cursor
3131
aext, aresult = to_win(ani.frames)

samples/sample.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"cursors": {
1313
"fallback_settings": {
1414
"x11_sizes": [16, 20, 24, 28, 32, 40, 48, 56, 64, 72, 80, 88, 96],
15-
"win_sizes": [24, 32, 48, 64, 96],
15+
"win_sizes": ["24:32", "32", "48", "64", "96"],
1616
"x_hotspot": 53,
1717
"y_hotspot": 36,
1818
"x11_delay": 30,

samples/sample.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ platforms = ['x11', 'windows']
1010

1111
[cursors]
1212
[cursors.fallback_settings]
13-
x11_sizes = [16,20, 24, 28, 32, 40, 48, 56, 64, 72, 80, 88, 96]
14-
win_sizes = [24, 32, 48, 64, 96]
13+
x11_sizes = [16, 20, 24, 28, 32, 40, 48, 56, 64, 72, 80, 88, 96]
14+
win_sizes = ['24:32', '32', '48', '64', '96']
1515
x_hotspot = 53
1616
y_hotspot = 36
1717
x11_delay = 30
@@ -27,7 +27,7 @@ x11_symlinks = ['link1']
2727
png = 'pointer.png'
2828
win_name = 'Alternate'
2929
x11_name = 'pointer2'
30-
x11_symlinks = ['link2','link3', 'link4', 'link5', 'link6','link7', 'link8']
30+
x11_symlinks = ['link2', 'link3', 'link4', 'link5', 'link6', 'link7', 'link8']
3131

3232

3333
[cursors.test_pointer3]

samples/sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ config:
1111
cursors:
1212
fallback_settings:
1313
x11_sizes: [16, 20, 24, 28, 32, 40, 48, 56, 64, 72, 80, 88, 96]
14-
win_sizes: [24, 32, 48, 64, 96]
14+
win_sizes: ["24", "32", "48", "64", "96"]
1515
x_hotspot: 53
1616
y_hotspot: 36
1717
x11_delay: 30

src/clickgen/configparser.pyi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from clickgen.parser.png import DELAY as DELAY, SIZES as SIZES
44
from clickgen.writer.windows import to_win as to_win
55
from clickgen.writer.x11 import to_x11 as to_x11
66
from pathlib import Path
7-
from typing import Any, Dict, List, TypeVar
7+
from typing import Any, TypeVar
88

99
class ThemeSection:
1010
name: str
@@ -16,25 +16,25 @@ class ThemeSection:
1616
def __gt__(self, other): ...
1717
def __ge__(self, other): ...
1818

19-
def parse_theme_section(d: Dict[str, Any], **kwargs) -> ThemeSection: ...
19+
def parse_theme_section(d: dict[str, Any], **kwargs) -> ThemeSection: ...
2020

2121
class ConfigSection:
2222
bitmaps_dir: Path
2323
out_dir: Path
24-
platforms: List[str]
24+
platforms: list[str]
2525
def __init__(self, bitmaps_dir, out_dir, platforms) -> None: ...
2626
def __lt__(self, other): ...
2727
def __le__(self, other): ...
2828
def __gt__(self, other): ...
2929
def __ge__(self, other): ...
3030

31-
def parse_config_section(fp: Path, d: Dict[str, Any], **kwargs) -> ConfigSection: ...
31+
def parse_config_section(fp: Path, d: dict[str, Any], **kwargs) -> ConfigSection: ...
3232
T = TypeVar('T')
3333

3434
class CursorSection:
3535
x11_cursor_name: str | None
3636
x11_cursor: bytes | None
37-
x11_symlinks: List[str]
37+
x11_symlinks: list[str]
3838
win_cursor_name: str | None
3939
win_cursor: bytes | None
4040
def __init__(self, x11_cursor_name, x11_cursor, x11_symlinks, win_cursor_name, win_cursor) -> None: ...
@@ -43,12 +43,12 @@ class CursorSection:
4343
def __gt__(self, other): ...
4444
def __ge__(self, other): ...
4545

46-
def parse_cursors_section(d: Dict[str, Any], config: ConfigSection, **kwargs) -> List[CursorSection]: ...
46+
def parse_cursors_section(d: dict[str, Any], config: ConfigSection, **kwargs) -> list[CursorSection]: ...
4747

4848
class ClickgenConfig:
4949
theme: ThemeSection
5050
config: ConfigSection
51-
cursors: List[CursorSection]
51+
cursors: list[CursorSection]
5252
def __init__(self, theme, config, cursors) -> None: ...
5353
def __lt__(self, other): ...
5454
def __le__(self, other): ...

src/clickgen/cursors.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
from PIL.Image import Image as Image
2-
from typing import Iterator, List, Tuple
2+
from typing import Iterator
33

44
class CursorImage:
55
image: Image
6-
hotspot: Tuple[int, int]
6+
hotspot: tuple[int, int]
77
nominal: int
8-
def __init__(self, image: Image, hotspot: Tuple[int, int], nominal: int) -> None: ...
8+
def __init__(self, image: Image, hotspot: tuple[int, int], nominal: int) -> None: ...
99

1010
class CursorFrame:
11-
images: List[CursorImage]
11+
images: list[CursorImage]
1212
delay: int
13-
def __init__(self, images: List[CursorImage], delay: int = 0) -> None: ...
13+
def __init__(self, images: list[CursorImage], delay: int = 0) -> None: ...
1414
def __getitem__(self, item: int) -> CursorImage: ...
1515
def __len__(self) -> int: ...
1616
def __iter__(self) -> Iterator[CursorImage]: ...

src/clickgen/packer/windows.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from _typeshed import Incomplete
22
from pathlib import Path
33
from string import Template
4-
from typing import Dict
54

6-
FILE_TEMPLETES: Dict[str, Template]
5+
FILE_TEMPLETES: dict[str, Template]
76
all_wreg: Incomplete
87

98
def pack_win(dir: Path, theme_name: str, comment: str, website: str | None = None) -> None: ...

src/clickgen/packer/x11.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from pathlib import Path
22
from string import Template
3-
from typing import Dict
43

5-
FILE_TEMPLATES: Dict[str, Template]
4+
FILE_TEMPLATES: dict[str, Template]
65

76
def pack_x11(dir: Path, theme_name: str, comment: str) -> None: ...

0 commit comments

Comments
 (0)