Compare commits
8
Commits
bb943fb84b
...
v0.1.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8be14052ae | ||
|
|
aa419fdfc9
|
||
|
|
407ce00ab9
|
||
|
|
d427d05b96
|
||
|
|
c2897aa21a
|
||
|
|
f72528c474
|
||
|
|
1317c4ad39
|
||
|
|
fdb8317d24
|
No files matched your search
+1
-1
@@ -8,7 +8,7 @@ exclude = ["engines", "reference"]
|
||||
version = "0.1.5"
|
||||
edition = "2024"
|
||||
rust-version = "1.95"
|
||||
license = "AGPL-3.0-or-later"
|
||||
license = "MIT"
|
||||
publish = false
|
||||
|
||||
[workspace.dependencies]
|
||||
|
||||
@@ -1,661 +1,21 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Yang Zhang
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -756,7 +756,7 @@ Doc、Table、Show 的 PDF 输出由 LOK 完成,不要求安装 ElyPDF。ElyMa
|
||||
|
||||
### 21.1 自有代码默认许可
|
||||
|
||||
本 PRD 对新增应用代码采用 AGPL-3.0-or-later 作为发行默认,便于与 MuPDF 的开源使用路线保持一致。Ely GPUI Components 继续保留现有 MIT/Apache-2.0 许可,不因被应用使用而改写其许可证。[S1]
|
||||
本 PRD 对新增应用代码采用 MIT 作为发行默认(用户 2026-10-19 定,原为 AGPL-3.0-or-later)。MIT 只管 Ely 的自有代码:链接 MuPDF 的 ElyPDF 发行包整体仍须按 MuPDF 的 AGPL 条款提供对应源码。Ely GPUI Components 继续保留现有 MIT/Apache-2.0 许可,不因被应用使用而改写其许可证。[S1]
|
||||
|
||||
第三方代码保持原许可证。不得把 LibreOffice、Git 或其他依赖的版权声明统一替换成 Ely 的声明。最终发行须按实际链接、进程调用、修改和打包方式审查,进程隔离不作为免除许可义务的依据。
|
||||
|
||||
|
||||
@@ -43,4 +43,4 @@ Packages: `packaging/macos/release.sh` writes each app's `.app` and `.dmg`, the
|
||||
|
||||
## Licence
|
||||
|
||||
AGPL-3.0-or-later (`LICENSE`). Third-party components keep their own licences; see `docs/licenses.md`.
|
||||
MIT (`LICENSE`). Third-party components keep their own licences; see `docs/licenses.md`.
|
||||
@@ -170,6 +170,7 @@ tests/scripts/pdf-recovery.sh 真窗口 ElyPDF:加锁文件的封存恢复点
|
||||
tests/scripts/autosave.sh 真窗口 ElyDoc:自动保存开关、停手即写、外部改动不覆盖(需辅助功能权限)
|
||||
tests/scripts/print.sh 真窗口 ElyDoc:打印用文档自己的纸张,取消不动文档(需辅助功能权限)
|
||||
tests/scripts/show-fullscreen.sh 真窗口 ElyShow:F5 放映的窗口盖住整块屏幕(菜单栏与程序坞之上,需辅助功能权限)
|
||||
tests/scripts/dock-macos.sh dist 里 ElyDoc、ElyTable、ElyShow 与包外的 target/debug/ely-doc 各启动数次:LOK worker 从未登记为程序坞应用,图块照出
|
||||
tests/scripts/windows-installer.sh 假应用的安装程序:所选目录原有的文件经两次安装与卸载都在,旧版按注册表清理,文件被占用或程序在运行时什么也不改,写不进时放回旧版(缺 makensis 时 SKIP)
|
||||
tests/scripts/types.sh packaging/types.tsv 的文件类型在 Linux 桌面项、Windows 安装程序与 macOS 文档类型里一致,从不设为默认
|
||||
tests/scripts/layout.sh 真窗口:六个应用在 640、800、1100 宽下无元素越出窗口左右,留截图(需辅助功能与屏幕录制权限)
|
||||
@@ -303,3 +304,5 @@ cargo run -p ely-doc 启动一个应用(ElyDoc 先 cargo build -p ely
|
||||
- 2026-10-15(用户报:ElyMark 代码块后的“你好↵测试”离开输入框后成了“你好 测试”):单个换行照 Typora 的默认(编辑时保留,导出与打印不保留):组件库 93efa7f 起 `MarkdownReader::new`(屏上:可视、预览、右键与命令的读法)把软换行读作换行,`MarkdownReader::joined`(输出)照 GFM 读作空格;标题的大纲与目录文字照旧一行。ElyMark 的 HTML、PDF、富文本复制与纯文本导出用 `joined`(R6.7)。组件库 c31d092 与 26af4be:画出成一个换行的 CRLF 对回其起点(原先按在 CRLF 行末键入落在 CR 与 LF 之间),行内代码照留两字则逐字对回。
|
||||
- 2026-10-15(用户报:ElyMark 源码模式“测”后的插入点画在“测”的中间):组件库 `CodeEditor` 原按“列 × m 的宽”放插入点、选区、按下处与输入法框,中日韩字与表情约宽两格。组件库 9fb607b 起按 gpui 排好的这一行定位(`editor::measure`,含着色带来的字重),块状与下划线插入点取所在字的宽;标尺与缩进参考线仍按列(R6.8)。上下移动仍按字数记目标列。cd61653:按下处取最近的字首或行末(gpui 的 `closest_index_for_x` 越过末字字首即给行末);上次绘制得出的括号与配对位置只属当时的文字(`Buffer` 每次改动换一个戳),输入法改字后、下次绘制前的测量不用它们(原先把新字切进不同字体段,DirectWrite 崩溃)。
|
||||
- 2026-10-15(用户报:ElyMark 三、四级标题不显眼):组件库 5954132 起标题字号随正文按 Typora 的倍数(一至六级 2.25、1.75、1.5、1.25、1、1),一律加粗,六级为次要色,行高为字号的 1.3 倍(原为固定的 24、20、16、14 像素,正文 13,三、四级只是中等字重)(R6.9)。90bd37b:粗体与标题同一字重(原粗体为半粗,标题里的粗体反而更细,正文粗体随之由半粗改为粗,同 Typora);标题行高按自身字号取 1.3 倍。Windows 真窗口核对(`.work/r69`):可视模式各级标题分明、“你好↵测试”两行,源码模式“测”后的插入点落在两字之间。
|
||||
- 2026-10-15(用户报:macOS 打开一个文档,程序坞里有两个同样的图标):LOK worker 在应用包的 `Contents/MacOS` 里启动 AppKit,系统按包的 Info.plist 把它也登记为常规应用(`lsappinfo` 里应用与 worker 都是 Foreground),程序坞多一个图标;内核自己从不设激活策略。worker 在内核启动 AppKit 之前(`Lok::hook` 打开内核之后、调钩子之前)把本进程主包信息里的 `LSUIElement` 设为真,AppKit 登记时即为辅助应用(无程序坞图标、无菜单栏,仍可建屏外窗口);钩子之后核对激活策略是辅助,不是即报错、不启动(`ffi/accessory.rs`);包外的 worker(`cargo run`、单测)无包可登记,策略为禁止,此时改设辅助(R6.12 第 2 轮)。原先在登记之后才改策略,审查实测 15 次启动有 11 次先登记为 Foreground 约 30 毫秒(R6.12 第 1 轮)。`tests/scripts/dock-macos.sh` 连续启动三个应用与包外的开发构建,从 worker 启动起采样其类型到首块图块,见 Foreground 即失败(R6.12)。
|
||||
- 2026-10-15(用户报:ElyShow 编辑区滚轮与上下键不换页,三端):内核在未选中对象时把上下键当作滚动窗口(`fupoor.cxx`),Ely 的画布整页适合、无处可滚,滚轮同样。`LokView::turn_parts`(ElyShow 首次适合时调用)之后:整页可见时滚轮换页(`view/turn.rs`):滚轮的行按本平台每格的行数(`ely_lok::notch`:macOS 1,Windows 取系统设置,X11 与 Wayland 为 3)折成格,整格的行每格一页(快速连滚与一次多格都照格数);一串行里出现不足一格的(X11、Windows 的触控板)即为平滑滚动,此后到停顿前不再换页,像素(macOS、Wayland 的触控板)同按手势:一次手势换一页(满一格或 50 像素),惯性不算;有起止的手势(macOS)只到结束才算完,没有起止的停 200 毫秒即为下一次。X11 的滚轮与触控板同为行、gpui 不分,以整格开头的触控板滑动在出现小数之前会按格换页(已知限制)。未选中对象、未编辑文字时上下键换页。换页一律经有序输入队列交 worker(`TURN`):worker 按之前各输入回报后的状态判定,有选区、选中对象或插入点即把方向键照常交内核,否则当场切页(到首末页即停,同缩略图条的 `setPart`),视图在落地时换上 worker 所示的页,其后排队的键与点按都落在新页上(Tab 后紧接的 Down 移动所选对象;Down、Tab、Down 是换页后在新页上选中并移动);ElyShow 后台读回的当前页只在视图已无待落地输入时采用(R6.13)。
|
||||
@@ -95,7 +95,10 @@ impl Host for Deck {
|
||||
&& !tab.extra.fitted
|
||||
{
|
||||
tab.extra.fitted = true;
|
||||
view.update(cx, |view, cx| view.fit_page(cx));
|
||||
view.update(cx, |view, cx| {
|
||||
view.fit_page(cx);
|
||||
view.turn_parts();
|
||||
});
|
||||
}
|
||||
// Pictures follow the kernel's light or dark scheme.
|
||||
let dark = view.read(cx).dark();
|
||||
@@ -263,7 +266,12 @@ impl Deck {
|
||||
Ok(((slides, at), (design, objects, notes, remarks, (motion, media)), size, history)) => {
|
||||
tab.extra.read_at = Some(at);
|
||||
log::info!("show: tab {id} has {} parts", slides.list.len());
|
||||
view.update(cx, |view, _| view.set_part(slides.current));
|
||||
// A queued turn or part outranks an earlier read.
|
||||
view.update(cx, |view, _| {
|
||||
if view.settled() {
|
||||
view.set_part(slides.current)
|
||||
}
|
||||
});
|
||||
let names: HashSet<&String> =
|
||||
slides.list.iter().map(|slide| &slide.name).collect();
|
||||
tab.extra.keep_pictures(&names);
|
||||
|
||||
@@ -19,6 +19,7 @@ mod play_time;
|
||||
mod review;
|
||||
mod slides;
|
||||
mod strip;
|
||||
mod turn;
|
||||
|
||||
/// An unrendered Deck over a fresh worker, if LOK exists.
|
||||
pub(super) fn deck(cx: &mut TestAppContext, dir: &Path) -> Option<Entity<Deck>> {
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
use ely_lok::LokView;
|
||||
use ely_office::prelude::*;
|
||||
use gpui::{Entity, ScrollDelta, ScrollWheelEvent, TestAppContext, VisualTestContext, point};
|
||||
|
||||
use super::objects::{blank, selection};
|
||||
use super::{counts, quiet, settle, update};
|
||||
use crate::deck::Deck;
|
||||
|
||||
/// The slide canvas alone in a window.
|
||||
struct Host(Entity<LokView>);
|
||||
|
||||
impl gpui::Render for Host {
|
||||
fn render(&mut self, _: &mut gpui::Window, _: &mut gpui::Context<Self>) -> impl gpui::IntoElement {
|
||||
use gpui::{ParentElement as _, Styled as _};
|
||||
gpui::div().size_full().child(self.0.clone())
|
||||
}
|
||||
}
|
||||
|
||||
/// The current slide once every turn landed.
|
||||
fn current(shown: &mut VisualTestContext, deck: &Entity<Deck>) -> usize {
|
||||
quiet(shown, deck);
|
||||
shown.update(|_, app| deck.read(app).active_tab().map(|tab| tab.extra.slides.current).expect("a tab"))
|
||||
}
|
||||
|
||||
/// Whole notches, in this platform's lines.
|
||||
fn wheel(shown: &mut VisualTestContext, notches: f32) {
|
||||
let middle = shown.update(|window, _| window.viewport_size()).center();
|
||||
let delta = ScrollDelta::Lines(point(0.0, notches * ely_lok::notch()));
|
||||
shown.simulate_event(ScrollWheelEvent { position: middle.into(), delta, ..Default::default() });
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_wheel_and_up_down_turn_slides() {
|
||||
let dir = tempfile::tempdir().expect("a temp dir");
|
||||
let mut cx = TestAppContext::single();
|
||||
let Some(deck) = blank(&mut cx, dir.path()) else {
|
||||
return eprintln!("SKIP: no LOK build");
|
||||
};
|
||||
for n in 2..=3 {
|
||||
update(&mut cx, &deck, |deck, cx| deck.object_command("slide.insert", &[], cx));
|
||||
settle(&cx, |app| counts(app, &deck).0 == n);
|
||||
}
|
||||
let view = cx.update(|app| deck.read(app).active_tab().expect("a tab").view.clone());
|
||||
cx.update(|app| view.update(app, |view, _| view.show_part(0)));
|
||||
let window = cx.add_window(|_, _| Host(view.clone()));
|
||||
let mut shown = VisualTestContext::from_window(window.into(), &cx);
|
||||
shown.run_until_parked();
|
||||
assert_eq!(current(&mut shown, &deck), 0);
|
||||
wheel(&mut shown, -2.0);
|
||||
assert_eq!(current(&mut shown, &deck), 2, "two notches in one event turn two");
|
||||
wheel(&mut shown, 1.0);
|
||||
wheel(&mut shown, 1.0);
|
||||
assert_eq!(current(&mut shown, &deck), 0, "rapid notches each turn");
|
||||
wheel(&mut shown, -1.0);
|
||||
assert_eq!(current(&mut shown, &deck), 1, "the wheel turns down");
|
||||
shown.update(|window, app| {
|
||||
let focus = view.read(app).focus_handle().clone();
|
||||
window.focus(&focus, app)
|
||||
});
|
||||
shown.simulate_keystrokes("down");
|
||||
assert_eq!(current(&mut shown, &deck), 2, "Down turns");
|
||||
shown.simulate_keystrokes("down");
|
||||
assert_eq!(current(&mut shown, &deck), 2, "the last slide stays");
|
||||
shown.simulate_keystrokes("up");
|
||||
assert_eq!(current(&mut shown, &deck), 1, "Up turns back");
|
||||
wheel(&mut shown, 1.0);
|
||||
assert_eq!(current(&mut shown, &deck), 0, "the wheel turns up");
|
||||
// Down queued behind Tab moves the object Tab picks.
|
||||
shown.simulate_keystrokes("tab down");
|
||||
assert_eq!(current(&mut shown, &deck), 0, "Down after Tab moves, not turns");
|
||||
assert!(shown.update(|_, app| selection(app, &deck)).is_some(), "Tab picked an object");
|
||||
// A turn lands before the keys queued after it.
|
||||
shown.simulate_keystrokes("escape down tab down");
|
||||
assert_eq!(current(&mut shown, &deck), 1, "Down turns, then moves");
|
||||
assert!(shown.update(|_, app| selection(app, &deck)).is_some(), "Tab picked on the new slide");
|
||||
}
|
||||
@@ -237,6 +237,15 @@ impl Worker {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Turns `step` parts, or posts `key` if something is picked.
|
||||
pub fn turn(&mut self, doc: &Doc, step: i32, key: Option<(u32, i32)>) -> io::Result<Option<usize>> {
|
||||
let (char_code, key_code) = key.unwrap_or_default();
|
||||
let doc_id = self.doc_id(doc)?;
|
||||
let payload = Pack::new().u64(doc_id).i64(step.into()).i64(char_code.into()).i64(key_code.into()).bytes();
|
||||
let shown = Unpack::new(&self.request(tag::TURN, &payload)?).i64()?;
|
||||
Ok(usize::try_from(shown).ok())
|
||||
}
|
||||
|
||||
/// Drags a selected object's handle, start then end.
|
||||
pub fn drag_graphic(&mut self, doc: &Doc, from: (i32, i32), to: (i32, i32)) -> io::Result<()> {
|
||||
for (kind, (x, y)) in [(0, from), (1, to)] {
|
||||
|
||||
@@ -362,11 +362,14 @@ pub fn stop_all(docs: &HashMap<u64, Document>) {
|
||||
|
||||
/// The current generation of `id`.
|
||||
pub fn generation(id: u64) -> u64 {
|
||||
slots()
|
||||
.lock()
|
||||
.expect("the events lock")
|
||||
.get(&id)
|
||||
.map_or(0, |slot| slot.batch.generation)
|
||||
slots().lock().expect("the events lock").get(&id).map_or(0, |slot| slot.batch.generation)
|
||||
}
|
||||
|
||||
/// Whether `id` shows a selection, object or caret.
|
||||
pub fn picked(id: u64) -> bool {
|
||||
let slots = slots().lock().expect("the events lock");
|
||||
let Some(batch) = slots.get(&id).map(|slot| &slot.batch) else { return false };
|
||||
batch.graphic.is_some() || !batch.selection.is_empty() || batch.cursor_visible && batch.cursor.is_some()
|
||||
}
|
||||
|
||||
/// Blocks until documents have unpushed events.
|
||||
@@ -399,12 +402,7 @@ pub fn clear_result(id: u64) {
|
||||
|
||||
/// The completion the last dispatch reported.
|
||||
pub fn take_result(id: u64) -> Option<(String, bool)> {
|
||||
slots()
|
||||
.lock()
|
||||
.expect("the events lock")
|
||||
.get_mut(&id)?
|
||||
.result
|
||||
.take()
|
||||
slots().lock().expect("the events lock").get_mut(&id)?.result.take()
|
||||
}
|
||||
|
||||
/// The bridged a11y text now.
|
||||
|
||||
@@ -60,6 +60,8 @@ macro_rules! call {
|
||||
}};
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod accessory;
|
||||
mod document;
|
||||
mod slideshow;
|
||||
pub use document::{Raw, close_window};
|
||||
@@ -80,6 +82,9 @@ impl Lok {
|
||||
let install_c = cstring(&install_str)?;
|
||||
let profile_c = cstring(profile_url)?;
|
||||
let lib = Library::open(install)?;
|
||||
// Before the kit starts, so no Dock icon shows.
|
||||
#[cfg(target_os = "macos")]
|
||||
accessory::hide()?;
|
||||
let hook: Hook2 = unsafe {
|
||||
lib.symbol(b"libreofficekit_hook_2\0")
|
||||
.or_else(|_| lib.symbol(b"libreofficekit_hook\0"))
|
||||
@@ -97,6 +102,8 @@ impl Lok {
|
||||
"lok hook failed for {install_str}"
|
||||
)));
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
accessory::check()?;
|
||||
log::info!("lok: hooked {}", install_str);
|
||||
Ok(Self { kit, _lib: lib })
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
//! The worker stays out of the Dock (macOS).
|
||||
|
||||
use std::ffi::{c_char, c_void};
|
||||
use std::io;
|
||||
|
||||
#[link(name = "Foundation", kind = "framework")]
|
||||
#[link(name = "objc")]
|
||||
unsafe extern "C" {
|
||||
fn objc_getClass(name: *const c_char) -> *mut c_void;
|
||||
fn sel_registerName(name: *const c_char) -> *mut c_void;
|
||||
fn objc_msgSend();
|
||||
}
|
||||
|
||||
/// NSApplicationActivationPolicyAccessory: no Dock icon, no menu bar.
|
||||
const ACCESSORY: isize = 1;
|
||||
/// NSApplicationActivationPolicyProhibited: an unbundled worker starts so.
|
||||
const PROHIBITED: isize = 2;
|
||||
|
||||
type Id = *mut c_void;
|
||||
|
||||
fn send() -> unsafe extern "C" fn() {
|
||||
objc_msgSend as unsafe extern "C" fn()
|
||||
}
|
||||
|
||||
fn class(name: &std::ffi::CStr) -> io::Result<Id> {
|
||||
let class = unsafe { objc_getClass(name.as_ptr()) };
|
||||
if class.is_null() {
|
||||
return Err(io::Error::other(format!("no {} class", name.to_string_lossy())));
|
||||
}
|
||||
Ok(class)
|
||||
}
|
||||
|
||||
fn get(object: Id, selector: &std::ffi::CStr) -> io::Result<Id> {
|
||||
type F = unsafe extern "C" fn(Id, Id) -> Id;
|
||||
let f: F = unsafe { std::mem::transmute(send()) };
|
||||
let result = unsafe { f(object, sel_registerName(selector.as_ptr())) };
|
||||
if result.is_null() {
|
||||
return Err(io::Error::other(format!("{} gave nothing", selector.to_string_lossy())));
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Marks the process a UI element before registration.
|
||||
pub fn hide() -> io::Result<()> {
|
||||
// The kit reads the bundle's LSUIElement when it registers.
|
||||
let info = get(get(class(c"NSBundle")?, c"mainBundle")?, c"infoDictionary")?;
|
||||
type Text = unsafe extern "C" fn(Id, Id, *const c_char) -> Id;
|
||||
type Flag = unsafe extern "C" fn(Id, Id, i8) -> Id;
|
||||
type Set = unsafe extern "C" fn(Id, Id, Id, Id);
|
||||
let text: Text = unsafe { std::mem::transmute(send()) };
|
||||
let flag: Flag = unsafe { std::mem::transmute(send()) };
|
||||
let set: Set = unsafe { std::mem::transmute(send()) };
|
||||
unsafe {
|
||||
let key = text(class(c"NSString")?, sel_registerName(c"stringWithUTF8String:".as_ptr()), c"LSUIElement".as_ptr());
|
||||
let yes = flag(class(c"NSNumber")?, sel_registerName(c"numberWithBool:".as_ptr()), 1);
|
||||
set(info, sel_registerName(c"setObject:forKey:".as_ptr()), yes, key);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Fails unless the kernel's application came up an accessory.
|
||||
pub fn check() -> io::Result<()> {
|
||||
type Policy = unsafe extern "C" fn(Id, Id) -> isize;
|
||||
type SetPolicy = unsafe extern "C" fn(Id, Id, isize) -> i8;
|
||||
let policy: Policy = unsafe { std::mem::transmute(send()) };
|
||||
let set: SetPolicy = unsafe { std::mem::transmute(send()) };
|
||||
let app = get(class(c"NSApplication")?, c"sharedApplication")?;
|
||||
let read = || unsafe { policy(app, sel_registerName(c"activationPolicy".as_ptr())) };
|
||||
let mut found = read();
|
||||
if found == PROHIBITED {
|
||||
// Outside a bundle nothing registers; accessory lets it draw.
|
||||
let done = unsafe { set(app, sel_registerName(c"setActivationPolicy:".as_ptr()), ACCESSORY) };
|
||||
found = read();
|
||||
log::info!("lok: the unbundled worker asked for accessory ({done})");
|
||||
}
|
||||
if found != ACCESSORY {
|
||||
return Err(io::Error::other(format!("the worker's activation policy is {found}, not accessory")));
|
||||
}
|
||||
log::info!("lok: the worker is an accessory app");
|
||||
Ok(())
|
||||
}
|
||||
@@ -88,6 +88,8 @@ pub mod tag {
|
||||
pub const REVISION: u8 = 34;
|
||||
/// One layer's pixels from the last `SLIDE_LAYERS`.
|
||||
pub const SLIDE_LAYER: u8 = 35;
|
||||
/// Turns parts; an arrow with something picked goes in.
|
||||
pub const TURN: u8 = 36;
|
||||
pub const OK: u8 = 100;
|
||||
pub const ERR: u8 = 101;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ pub use client::{
|
||||
};
|
||||
#[cfg(feature = "view")]
|
||||
pub use view::{
|
||||
CONTEXT, Copy, Cut, Geom, Layout, LokError, LokView, Paste, Reported, ZOOM_STEPS,
|
||||
CONTEXT, Copy, Cut, Geom, Layout, LokError, LokView, Paste, Reported, ZOOM_STEPS, notch,
|
||||
Zoomed, init, layout, paper, read_off, scheme,
|
||||
};
|
||||
#[cfg(feature = "view")]
|
||||
|
||||
@@ -32,7 +32,9 @@ mod scroll;
|
||||
mod sheet;
|
||||
pub use input::{CONTEXT, Copy, Cut, Paste, init};
|
||||
pub use off::read_off;
|
||||
pub use render::scheme;
|
||||
pub use render::{paper, scheme};
|
||||
mod turn;
|
||||
pub use turn::notch;
|
||||
|
||||
pub(crate) use crate::{TILE_TWIPS, TWIPS_PER_PIXEL};
|
||||
|
||||
@@ -125,6 +127,8 @@ pub struct LokView {
|
||||
dark: Option<bool>,
|
||||
/// The zoom follows the viewport so a page fits.
|
||||
fit: bool,
|
||||
/// Set when the wheel and Up, Down turn parts.
|
||||
turning: Option<turn::Turning>,
|
||||
/// The sheet shown, and the offered function chosen.
|
||||
part: usize,
|
||||
picked: usize,
|
||||
@@ -150,17 +154,6 @@ pub type Layout = ((i64, i64), Vec<Rect>);
|
||||
|
||||
use sheet::{Measured, measure};
|
||||
|
||||
/// A page's colour; the kernel's Ely schemes share it.
|
||||
pub fn paper(cx: &gpui::App) -> gpui::Hsla {
|
||||
use ely_gpui_component::theme::ActiveTheme as _;
|
||||
let theme = cx.theme();
|
||||
if theme.is_dark() {
|
||||
theme.colors.surface
|
||||
} else {
|
||||
theme.colors.paper
|
||||
}
|
||||
}
|
||||
|
||||
/// Reads `doc`'s size and page frames.
|
||||
pub fn layout(worker: &mut Worker, doc: &Doc) -> io::Result<Layout> {
|
||||
Ok((doc.size(worker)?, doc.pages(worker)?))
|
||||
@@ -227,6 +220,7 @@ impl LokView {
|
||||
cell: crate::Cell::default(),
|
||||
dark: None,
|
||||
fit: false,
|
||||
turning: None,
|
||||
part: 0,
|
||||
picked: 0,
|
||||
marked: None,
|
||||
|
||||
@@ -64,6 +64,14 @@ pub(super) enum Input {
|
||||
Visible(Rect, (u32, i32)),
|
||||
/// Shows sheet or slide `part`, from 0.
|
||||
Part(usize),
|
||||
/// Turns `step` parts; a picked object takes the arrow `key`.
|
||||
Turn { step: i32, key: Option<(u32, i32)> },
|
||||
}
|
||||
|
||||
/// What an input gives back.
|
||||
pub(super) enum Back {
|
||||
Copied(String),
|
||||
Shown(usize),
|
||||
}
|
||||
|
||||
impl Input {
|
||||
@@ -73,6 +81,7 @@ impl Input {
|
||||
// Arrows, Home, End, Page keys, Escape.
|
||||
Input::Key { key_code, .. } => !matches!(key_code & 0x0FFF, 1024..=1031 | 1281),
|
||||
Input::Mouse(_)
|
||||
| Input::Turn { .. }
|
||||
| Input::Copy { cut: false }
|
||||
| Input::Visible(..)
|
||||
| Input::Part(_)
|
||||
@@ -169,7 +178,7 @@ fn lok_button(button: MouseButton) -> Option<i32> {
|
||||
}
|
||||
|
||||
/// Runs one input; gives a copy's mark and the revision.
|
||||
pub(super) fn run(worker: &Mutex<Worker>, doc: &Doc, input: Input) -> (io::Result<Option<String>>, Option<u64>) {
|
||||
pub(super) fn run(worker: &Mutex<Worker>, doc: &Doc, input: Input) -> (io::Result<Option<Back>>, Option<u64>) {
|
||||
let mut worker = worker.lock().expect("the worker lock");
|
||||
let counts = !matches!(input, Input::Visible(..));
|
||||
let copied = apply(&mut worker, doc, input);
|
||||
@@ -181,12 +190,13 @@ pub(super) fn run(worker: &Mutex<Worker>, doc: &Doc, input: Input) -> (io::Resul
|
||||
(copied, now)
|
||||
}
|
||||
|
||||
fn apply(worker: &mut Worker, doc: &Doc, input: Input) -> io::Result<Option<String>> {
|
||||
fn apply(worker: &mut Worker, doc: &Doc, input: Input) -> io::Result<Option<Back>> {
|
||||
let done = match input {
|
||||
Input::Key {
|
||||
char_code,
|
||||
key_code,
|
||||
} => worker.post_key(doc, char_code, key_code),
|
||||
Input::Turn { step, key } => return Ok(worker.turn(doc, step, key)?.map(Back::Shown)),
|
||||
Input::Mouse(event) => worker.post_mouse(doc, event),
|
||||
Input::Drag { from, to } => worker.drag_graphic(doc, from, to),
|
||||
Input::Visible(area, scale) => doc.visible_area(worker, area, scale),
|
||||
@@ -195,9 +205,8 @@ fn apply(worker: &mut Worker, doc: &Doc, input: Input) -> io::Result<Option<Stri
|
||||
Input::Theme(scheme) => worker.run(doc, "view.theme", &[scheme]),
|
||||
Input::Text { commit, text } => worker.post_text(doc, commit, &text),
|
||||
Input::Copy { cut } => {
|
||||
return clip::copy_out(worker, doc, cut, |clip| {
|
||||
clipboard::write(clip).map_err(io::Error::other)
|
||||
});
|
||||
let copied = clip::copy_out(worker, doc, cut, |clip| clipboard::write(clip).map_err(io::Error::other));
|
||||
return copied.map(|copied| copied.map(Back::Copied));
|
||||
}
|
||||
Input::Run { commands, at } => {
|
||||
let values: Vec<Vec<&str>> =
|
||||
@@ -298,7 +307,10 @@ impl LokView {
|
||||
_: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
if self.walk(&event.keystroke, cx) || self.key_down(&event.keystroke) {
|
||||
if self.walk(&event.keystroke, cx)
|
||||
|| self.turn_key(&event.keystroke)
|
||||
|| self.key_down(&event.keystroke)
|
||||
{
|
||||
cx.stop_propagation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ use std::{
|
||||
use futures::{StreamExt, channel::mpsc, select_biased};
|
||||
use gpui::Context;
|
||||
|
||||
use super::{Geom, LokError, LokView, Reported, TILE_TWIPS, input::Input};
|
||||
use super::input::{Back, Input};
|
||||
use super::{Geom, LokError, LokView, Reported, TILE_TWIPS};
|
||||
use crate::{Doc, Tile, Worker};
|
||||
|
||||
/// An input slower than this is logged as a warning.
|
||||
@@ -24,7 +25,7 @@ pub(super) struct Job {
|
||||
/// What came back from the lane.
|
||||
enum Landed {
|
||||
/// Sequence, whether it edits, whether it switched part, outcome.
|
||||
Input(u64, bool, bool, (io::Result<Option<String>>, Option<u64>)),
|
||||
Input(u64, bool, bool, (io::Result<Option<Back>>, Option<u64>)),
|
||||
Tile(Job, io::Result<Tile>),
|
||||
}
|
||||
|
||||
@@ -111,7 +112,13 @@ impl LokView {
|
||||
}
|
||||
self.seen_revision(now.unwrap_or(0));
|
||||
match outcome {
|
||||
Ok(Some(copied)) => self.copied = Some(copied),
|
||||
Ok(Some(Back::Copied(copied))) => self.copied = Some(copied),
|
||||
Ok(Some(Back::Shown(part))) if part != self.part => {
|
||||
// The worker turned in order.
|
||||
self.part = part;
|
||||
self.invalidate(cx);
|
||||
}
|
||||
Ok(Some(Back::Shown(_))) => {}
|
||||
Ok(None) => {}
|
||||
Err(error) => {
|
||||
log::error!("lok: input failed ({:?})", error.kind());
|
||||
|
||||
@@ -24,6 +24,16 @@ pub fn scheme(dark: bool) -> &'static str {
|
||||
if dark { DARK } else { LIGHT }
|
||||
}
|
||||
|
||||
/// A page's colour; the kernel's Ely schemes share it.
|
||||
pub fn paper(cx: &gpui::App) -> gpui::Hsla {
|
||||
let theme = cx.theme();
|
||||
if theme.is_dark() {
|
||||
theme.colors.surface
|
||||
} else {
|
||||
theme.colors.paper
|
||||
}
|
||||
}
|
||||
|
||||
impl LokView {
|
||||
/// Paints with the app's light or dark scheme.
|
||||
pub(super) fn follow_theme(&mut self, dark: bool) {
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
//! The wheel and Up, Down turn slides (SHOW-01).
|
||||
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use gpui::{Keystroke, Modifiers, ScrollDelta, ScrollWheelEvent, TouchPhase};
|
||||
|
||||
use super::LokView;
|
||||
use super::input::{Input, vcl_key};
|
||||
|
||||
/// Trackpad pixels one turn takes.
|
||||
const SWIPE: f32 = 50.0;
|
||||
/// A pause this long ends a gesture without phases.
|
||||
const PAUSE: Duration = Duration::from_millis(200);
|
||||
|
||||
/// Lines one wheel notch scrolls on this platform.
|
||||
pub fn notch() -> f32 {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use windows_sys::Win32::UI::WindowsAndMessaging::{SPI_GETWHEELSCROLLLINES, SystemParametersInfoW};
|
||||
let mut lines = 3u32;
|
||||
// Same setting gpui scales the wheel by.
|
||||
unsafe { SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, (&raw mut lines).cast(), 0) };
|
||||
lines as f32
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
1.0
|
||||
}
|
||||
// gpui's X11 and Wayland scroll three lines a notch.
|
||||
#[cfg(not(any(windows, target_os = "macos")))]
|
||||
{
|
||||
3.0
|
||||
}
|
||||
}
|
||||
|
||||
/// The wheel's progress towards a turn.
|
||||
#[derive(Default)]
|
||||
pub(super) struct Turning {
|
||||
/// This gesture's travel, in turns.
|
||||
travel: f32,
|
||||
/// This gesture already turned.
|
||||
spent: bool,
|
||||
/// The platform began a gesture it has not ended.
|
||||
held: bool,
|
||||
/// Fractional lines in this run: a touchpad, not a wheel.
|
||||
smooth: bool,
|
||||
last: Option<Instant>,
|
||||
}
|
||||
|
||||
impl Turning {
|
||||
/// The turn a wheel event makes; 0 for none.
|
||||
pub(super) fn wheel(&mut self, delta: ScrollDelta, phase: TouchPhase, now: Instant, notch: f32) -> i32 {
|
||||
let paused = self.last.is_none_or(|last| now.duration_since(last) >= PAUSE);
|
||||
self.last = Some(now);
|
||||
// X11 lines mix wheels and touchpads; they carry no phase.
|
||||
let (travel, phase) = match delta {
|
||||
ScrollDelta::Lines(_) if notch <= 0.0 => return 0,
|
||||
ScrollDelta::Lines(lines) => (lines.y / notch, None),
|
||||
ScrollDelta::Pixels(pixels) => (f32::from(pixels.y) / SWIPE, Some(phase)),
|
||||
};
|
||||
// Phases bound a gesture; without them, a pause does.
|
||||
if phase == Some(TouchPhase::Started) || paused && !self.held {
|
||||
(self.travel, self.spent, self.smooth) = (0.0, false, false);
|
||||
}
|
||||
let whole = travel.round();
|
||||
if phase.is_none() && (whole == 0.0 || (travel - whole).abs() >= 1e-3) {
|
||||
self.smooth = true;
|
||||
}
|
||||
// Whole wheel notches each turn, until fractions show a touchpad.
|
||||
if phase.is_none() && !self.smooth {
|
||||
(self.travel, self.spent, self.held) = (0.0, true, false);
|
||||
return -(whole as i32);
|
||||
}
|
||||
self.held = match phase {
|
||||
Some(TouchPhase::Started) => true,
|
||||
Some(TouchPhase::Moved) => self.held,
|
||||
Some(TouchPhase::Ended | TouchPhase::Cancelled) | None => false,
|
||||
};
|
||||
// One gesture turns once, momentum included.
|
||||
if self.spent {
|
||||
return 0;
|
||||
}
|
||||
self.travel += travel;
|
||||
if self.travel.abs() < 1.0 - 1e-3 {
|
||||
return 0;
|
||||
}
|
||||
self.spent = true;
|
||||
// Content moving down shows the part before.
|
||||
-(self.travel.signum() as i32)
|
||||
}
|
||||
}
|
||||
|
||||
impl LokView {
|
||||
/// The wheel and Up, Down turn parts from now on.
|
||||
pub fn turn_parts(&mut self) {
|
||||
self.turning.get_or_insert_default();
|
||||
}
|
||||
|
||||
/// Queues Up, Down; the worker turns if nothing is picked.
|
||||
pub(super) fn turn_key(&mut self, keystroke: &Keystroke) -> bool {
|
||||
if self.turning.is_none() || keystroke.modifiers != Modifiers::none() {
|
||||
return false;
|
||||
}
|
||||
let step = match keystroke.key.as_str() {
|
||||
"down" => 1,
|
||||
"up" => -1,
|
||||
_ => return false,
|
||||
};
|
||||
let Some(key) = vcl_key(keystroke) else {
|
||||
return false;
|
||||
};
|
||||
self.send(Input::Turn { step, key: Some(key) });
|
||||
true
|
||||
}
|
||||
|
||||
/// The wheel turns while the whole page shows.
|
||||
pub(super) fn turn_wheel(&mut self, event: &ScrollWheelEvent) -> bool {
|
||||
let (width, height) = self.extent();
|
||||
// A pixel of slack for rounding.
|
||||
let whole = self.geom.px_of(width) <= self.viewport.0 + 1.0
|
||||
&& self.geom.px_of(height) <= self.viewport.1 + 1.0;
|
||||
let Some(turning) = self.turning.as_mut().filter(|_| whole) else {
|
||||
return false;
|
||||
};
|
||||
let step = turning.wheel(event.delta, event.touch_phase, Instant::now(), notch());
|
||||
if step != 0 {
|
||||
// In order with the input around it.
|
||||
self.send(Input::Turn { step, key: None });
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use gpui::{ScrollDelta, TouchPhase, point, px};
|
||||
|
||||
use super::{PAUSE, Turning};
|
||||
|
||||
const NOTCH: f32 = 3.0;
|
||||
|
||||
fn lines(y: f32) -> ScrollDelta {
|
||||
ScrollDelta::Lines(point(0.0, y))
|
||||
}
|
||||
|
||||
fn pixels(y: f32) -> ScrollDelta {
|
||||
ScrollDelta::Pixels(point(px(0.0), px(y)))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_notch_with_a_pause_turns_once() {
|
||||
let (mut turning, now) = (Turning::default(), std::time::Instant::now());
|
||||
let mut wheel = |y, at| turning.wheel(lines(y), TouchPhase::Moved, at, NOTCH);
|
||||
assert_eq!(wheel(-3.0, now), 1, "Windows and Linux scroll three lines a notch");
|
||||
assert_eq!(wheel(-3.0, now + PAUSE), 1);
|
||||
assert_eq!(wheel(3.0, now + PAUSE * 2), -1);
|
||||
assert_eq!(wheel(-6.0, now + PAUSE * 3), 2, "two notches in one event");
|
||||
assert_eq!(wheel(-3.0, now + PAUSE * 3), 1, "rapid notches each turn");
|
||||
assert_eq!(wheel(-3.0, now + PAUSE * 3), 1);
|
||||
assert_eq!(wheel(-1.0, now + PAUSE * 4), 0, "a third of a notch");
|
||||
let mut mac = Turning::default();
|
||||
assert_eq!(mac.wheel(lines(-1.0), TouchPhase::Moved, now, 1.0), 1, "macOS scrolls a line a notch");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_stream_of_lines_turns_once() {
|
||||
let (mut turning, now) = (Turning::default(), std::time::Instant::now());
|
||||
// A whole step, then fractions: no more turns once smooth.
|
||||
let stream = [-3.0, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -3.0];
|
||||
let turned: i32 = stream.iter().map(|&y| turning.wheel(lines(y), TouchPhase::Moved, now, NOTCH)).sum();
|
||||
assert_eq!(turned, 1, "one swipe turns once");
|
||||
let mut turning = Turning::default();
|
||||
let turned: i32 = (0..30).map(|_| turning.wheel(lines(-0.4), TouchPhase::Moved, now, NOTCH)).sum();
|
||||
assert_eq!(turned, 1, "fractions add up once");
|
||||
assert_eq!(turning.wheel(lines(-3.0), TouchPhase::Moved, now + PAUSE, NOTCH), 1, "a pause ends it");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_swipe_turns_once_until_the_next() {
|
||||
let (mut turning, now) = (Turning::default(), std::time::Instant::now());
|
||||
let mut swipe = |y, phase, at| turning.wheel(pixels(y), phase, at, NOTCH);
|
||||
assert_eq!(swipe(-30.0, TouchPhase::Started, now), 0);
|
||||
assert_eq!(swipe(-30.0, TouchPhase::Moved, now), 1);
|
||||
// A pause with fingers down is the same gesture.
|
||||
assert_eq!(swipe(-60.0, TouchPhase::Moved, now + PAUSE * 2), 0);
|
||||
assert_eq!(swipe(0.0, TouchPhase::Ended, now + PAUSE * 2), 0);
|
||||
// Momentum after the turn turns nothing more.
|
||||
for _ in 0..20 {
|
||||
assert_eq!(swipe(-80.0, TouchPhase::Moved, now + PAUSE * 2), 0);
|
||||
}
|
||||
assert_eq!(swipe(60.0, TouchPhase::Started, now + PAUSE * 2), -1);
|
||||
assert_eq!(swipe(0.0, TouchPhase::Ended, now + PAUSE * 2), 0);
|
||||
// Without phases a pause ends a gesture (Wayland).
|
||||
let later = now + PAUSE * 4;
|
||||
assert_eq!(swipe(60.0, TouchPhase::Moved, later), -1);
|
||||
assert_eq!(swipe(60.0, TouchPhase::Moved, later), 0);
|
||||
assert_eq!(swipe(60.0, TouchPhase::Moved, later + PAUSE), -1);
|
||||
}
|
||||
}
|
||||
@@ -65,9 +65,9 @@ impl LokView {
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
/// Ctrl (macOS: Cmd) and the wheel zoom; else scroll.
|
||||
/// Ctrl (macOS: Cmd) wheel zooms; else it turns or scrolls.
|
||||
pub(super) fn on_wheel(&mut self, event: &ScrollWheelEvent, window: &mut Window, cx: &mut Context<Self>) {
|
||||
if !self.wheel_zoom(event, cx) {
|
||||
if !self.wheel_zoom(event, cx) && !self.turn_wheel(event) {
|
||||
self.on_scroll(event, window, cx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +218,7 @@ fn answer(lok: &Lok, tag: u8, id: u64, payload: &[u8]) {
|
||||
}
|
||||
}),
|
||||
tag::POST_KEY => input::key(unpack),
|
||||
tag::TURN => input::turn(unpack),
|
||||
tag::POST_MOUSE => input::mouse(unpack),
|
||||
tag::GRAPHIC => input::graphic(unpack),
|
||||
tag::POST_TEXT => input::text(unpack),
|
||||
|
||||
@@ -99,6 +99,28 @@ pub(super) fn key(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
||||
/// Turns `step` parts in order, or posts the arrow (-1).
|
||||
pub(super) fn turn(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
let (id, step, char_code, key_code) = (unpack.u64()?, unpack.i64()?, unpack.i64()?, unpack.i64()?);
|
||||
// Earlier input's callbacks already landed here.
|
||||
if key_code != 0 && crate::events::picked(id) {
|
||||
with_doc(id, |doc| {
|
||||
doc.post_key(0, char_code as i32, key_code as i32);
|
||||
doc.post_key(1, char_code as i32, key_code as i32);
|
||||
})?;
|
||||
return Ok(Pack::new().i64(-1).bytes());
|
||||
}
|
||||
let shown = with_doc(id, |doc| {
|
||||
let (part, last) = (i64::from(doc.part()), i64::from(doc.parts()) - 1);
|
||||
let next = (part + step).clamp(0, last.max(0));
|
||||
if next != part {
|
||||
doc.set_part(next as i32);
|
||||
}
|
||||
next
|
||||
})?;
|
||||
Ok(Pack::new().i64(shown).bytes())
|
||||
}
|
||||
|
||||
/// One mouse event: kind, x, y, count, buttons, modifiers.
|
||||
pub(super) fn mouse(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
let id = unpack.u64()?;
|
||||
|
||||
@@ -51,7 +51,7 @@ pub fn expect(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
pub fn bump(request: u8, payload: &[u8]) {
|
||||
let changes = matches!(
|
||||
request,
|
||||
tag::POST_KEY | tag::POST_MOUSE | tag::GRAPHIC | tag::POST_TEXT | tag::POST_UNO | tag::PASTE | tag::CUT | tag::COMPLETE_FUNCTION
|
||||
tag::POST_KEY | tag::TURN | tag::POST_MOUSE | tag::GRAPHIC | tag::POST_TEXT | tag::POST_UNO | tag::PASTE | tag::CUT | tag::COMPLETE_FUNCTION
|
||||
);
|
||||
let mut unpack = Unpack::new(payload);
|
||||
let Ok(id) = unpack.u64() else {
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
|
||||
## 自有代码
|
||||
|
||||
Ely Office 的自有代码以 AGPL-3.0-or-later 发布,全文在仓库根的 `LICENSE`,并随每个应用包放在 `Resources/Licenses/LICENSE`。组件库 Ely-GPUI-Components 保留其 MIT/Apache-2.0。
|
||||
Ely Office 的自有代码以 MIT 发布,全文在仓库根的 `LICENSE`,并随每个应用包放在 `Resources/Licenses/LICENSE`。随包的引擎不随之改许可:ElyPDF 链接的 MuPDF 是 AGPL-3.0,ElyPDF 的发行包整体须按 AGPL 履行(对应源码见上游源码包);ElyDoc、ElyTable、ElyShow 的 LibreOffice 仍为 MPL-2.0 等;ElyTree 带的 Git 仍为 GPL-2.0。组件库 Ely-GPUI-Components 保留其 MIT/Apache-2.0。
|
||||
|
||||
## 每个发行版附带
|
||||
|
||||
@@ -12,7 +12,7 @@ Ely Office 的自有代码以 AGPL-3.0-or-later 发布,全文在仓库根的 `
|
||||
| --- | --- | --- |
|
||||
| `ElyOffice-<版本>-source.tar.gz` | 自有源码、`Cargo.lock`、`rust-toolchain.toml`、上游补丁(`patches/libreoffice`、`patches/mupdf`)、构建与取上游的脚本(各上游钉在提交,脚本里写明地址与散列)、测试、文档 | `packaging/macos/release.sh` |
|
||||
| `ElyOffice-<版本>-upstream-source.tar.gz` | 实际编译的 MuPDF 源码(钉住的提交加我们的补丁,AGPL)与随包 Git 的源码(v2.56.0,GPLv2) | 同上;`tests/scripts/release-macos.sh` 核对其中是打过补丁的 MuPDF |
|
||||
| 各应用包 `Resources/Licenses/` | Ely 的 AGPL 全文;`rust-crates.txt`(链进该应用各二进制的全部 crate 与其许可文件,无许可文件的取标准文本并写明作者);所带引擎的许可与通知(见下) | `packaging/licenses.sh`,缺任何一份即打包失败 |
|
||||
| 各应用包 `Resources/Licenses/` | Ely 的 MIT 全文;`rust-crates.txt`(链进该应用各二进制的全部 crate 与其许可文件,无许可文件的取标准文本并写明作者);所带引擎的许可与通知(见下) | `packaging/licenses.sh`,缺任何一份即打包失败 |
|
||||
|
||||
## 第三方,按应用
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@ row=$(awk -F'\t' -v slug="$slug" '$1 == slug { print $2 "\t" $3 }' "$root/packag
|
||||
}
|
||||
name=${row%%$'\t'*}
|
||||
categories=${row##*$'\t'}
|
||||
# Ely is MIT; bundled engines keep their licences.
|
||||
case $slug in
|
||||
ely-doc | ely-table | ely-show) license="MIT AND MPL-2.0" ;;
|
||||
ely-pdf) license="MIT AND AGPL-3.0-or-later" ;;
|
||||
ely-tree) license="MIT AND GPL-2.0-only" ;;
|
||||
*) license=MIT ;;
|
||||
esac
|
||||
# The types it opens, from packaging/types.tsv; none drops the line.
|
||||
mimes=$(awk -F'\t' -v slug="$slug" '$1 == slug && !seen[$3]++ { printf "%s;", $3 }' "$root/packaging/types.tsv")
|
||||
desktop_entry() {
|
||||
@@ -193,7 +200,7 @@ maintainer: ZacharyZhang
|
||||
vendor: ZacharyZhang
|
||||
description: $name, part of Ely Office
|
||||
homepage: https://git.zacharyzhang.com/ZacharyZhang-NY/ElyOffice
|
||||
license: AGPL-3.0-or-later
|
||||
license: $license
|
||||
contents:
|
||||
- src: $appdir/usr
|
||||
dst: /opt/ely-office/$slug
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ const en = {
|
||||
ElyTree: "Stage lines, commit, read the graph. Git without a terminal.",
|
||||
ElyMark: "Markdown as you read it. Math and diagrams in place.",
|
||||
offline: "Works with the network off.",
|
||||
open: "Open source, under the AGPL.",
|
||||
open: "Open source, under the MIT licence.",
|
||||
local: "Your files stay in your folders.",
|
||||
download: "Download",
|
||||
platforms: "Out now for macOS, Windows and Linux.",
|
||||
@@ -48,7 +48,7 @@ const zh: typeof en = {
|
||||
ElyTree: "按行暂存、提交、看提交图。不用终端的 Git。",
|
||||
ElyMark: "写的就是看到的 Markdown。公式与图表就地显示。",
|
||||
offline: "断网照常工作。",
|
||||
open: "开源,AGPL 许可。",
|
||||
open: "开源,MIT 许可。",
|
||||
local: "文件留在你自己的文件夹里。",
|
||||
download: "下载",
|
||||
platforms: "macOS、Windows 与 Linux 版已发布。",
|
||||
|
||||
@@ -270,3 +270,6 @@
|
||||
- [x] R6.9 ElyMark 三、四级标题不显眼(用户报):各级字号随正文按 Typora 的倍数(2.25、1.75、1.5、1.25、1、1),一律加粗,六级为次要色(组件库渲染)
|
||||
- [x] R6.11 Windows 升级后旧文件仍在(R6.10 本机重装查出):安装程序只覆盖不删除,旧版 ElyMark 的 `git` 与 CEF 文件留在安装目录;安装程序记下所装的文件,升级与卸载只移去这些;文件被占用即什么也不改,失败时放回旧版。第 3 轮后(最后一轮,修完不再审查):备份按清单次序编号,近 260 字的路径照样升级与卸载;卸载先查清单本身,删不掉即放回全部
|
||||
- [x] R6.10 重发 0.1.5(用户定:仍为 0.1.5):删去 v0.1.5 的全部文件,标签移到修复的提交,三端全部包重建并上传,本机重装(标签在 53630ce;推标签即起发布流程,其 Windows 与 Linux 任务建出并上传,与本机同时起的 Windows 构建撞上,本机那份未上传;macOS 任务未上传,dmg 由 Mac mini 本机建、公证、钉票;44 个文件,同名的源码包只留 Linux 的一份,见 P3-16;下载回的 ElyMark 安装程序与清单的散列与构建相同;本机六个应用 0.1.5 经新安装程序升级,ElyMark 目录无 `git`,冒烟启动均正常退出、日志无警告)
|
||||
- [x] R6.12 macOS 打开一个文档,程序坞里 ElyDoc、ElyTable、ElyShow 各出现两个图标(用户 2026-10-15 报):LOK worker 在应用包内启动 AppKit,系统按包的 Info.plist 把它也登记为常规应用(`lsappinfo` 两个 Foreground);worker 在内核启动 AppKit 前把本进程主包信息的 `LSUIElement` 设为真,登记即为辅助应用,钩子后核对策略(第 1 轮:原先登记后才改,15 次有 11 次先为 Foreground);`tests/scripts/dock-macos.sh` 在 Mac mini 上 30 次启动全为 UIElement,旧 worker 即失败;第 2 轮:包外的 worker(`cargo run`、单测)策略为禁止,原核对即退出,改设辅助,测试另启包外的开发构建(40 次全过);第 3 轮通过
|
||||
- [x] R6.13 ElyShow 编辑区的滚轮与上下键不换页(用户报,三端;放映时正常):内核在未选中对象时把上下键当作滚动窗口,Ely 的画布整页适合、无处可滚;整页可见时滚轮换页(每格一页,触控板一次手势一页),未选中对象、未编辑文字时上下键换页,同缩略图条的路径,到首末页即停;第 1 轮:Windows 一格三行原换三页,X11 触控板的小数行一次滑动换多页,按住手指停顿后再滑又换一页,Tab 后紧接的 Down 按旧状态换页;改为按平台每格行数计格、小数行与像素按手势计、有起止的手势只到结束才算完、上下键由 worker 按输入次序判定;第 2 轮:换页在 worker 回复后才排进队列,排在其后的键先作用于旧页,以整格开头的 X11 平滑滚动仍按格多次换页;改为换页(键与滚轮)都由 worker 在输入次序中当场切页;第 3 轮:一律按手势计使快速连滚与一次多格只换一页,`LokView::part` 已无调用者;改为整格的行每格一页、出现小数即按手势,删去 `part`(第 3 轮为最后一轮,修后不再审查)
|
||||
- [ ] R6.14 重发 0.1.5(用户定:仍为 0.1.5,全部重建并重传):删去 v0.1.5 的全部文件,标签移到 R6.12、R6.13 的提交,三端全部包重建并上传,本机重装
|
||||
@@ -0,0 +1,3 @@
|
||||
FAIL
|
||||
|
||||
- crates/ely-lok/src/ffi/accessory.rs:38 — The worker still registers briefly as a foreground application: `sharedApplication` initializes AppKit under the parent bundle's regular identity before line 42 sets the accessory policy. On macOS 27.0.1 arm64, I built this revision and launched the worker under the shipped Doc/Table/Show bundle identities five times each. Eleven of fifteen launches reported `Foreground` before `UIElement`; one ElyTable launch reported those states at 0.1602 s and 0.1892 s respectively. All launches still loaded documents and painted tiles (`.work/R6.12-r1/dock-repeat.log`). This leaves a startup window for the second Dock entry and disproves the claim that the worker registers as UIElement from the outset; bundled apps default to the Dock-visible regular policy ([Apple documentation](https://developer.apple.com/documentation/appkit/nsapplication/activationpolicy-swift.enum/regular)). Establish the worker's agent identity before AppKit first registers it, preserving the main application's regular identity, and add a bundled-startup regression test that rejects any `Foreground` observation while checking document loading and rendering.
|
||||
@@ -0,0 +1,5 @@
|
||||
FAIL
|
||||
|
||||
- crates/ely-lok/src/ffi/accessory.rs:65 — Unbundled macOS workers now fail during startup. Setting the main bundle dictionary's `LSUIElement` leaves their activation policy at 2, which this check rejects. On macOS 27.0.1 arm64, the independently built round 2 worker exited 1 before answering its first IPC request with `the worker's activation policy is 2, not accessory`; the independently built round 1 worker, using the same engine and fresh profiles, loaded and rendered Writer, Calc and Impress documents and shut down successfully (`.work/R6.12-r2/unbundled-r2-worker.log`, `unbundled-r1.log`). This breaks the standalone worker layout used by `cargo run` and the macOS worker tests. Establish an appropriate policy for unbundled workers while retaining the pre-registration bundle fix, and cover both launch layouts in the regression test.
|
||||
|
||||
- crates/ely-lok/src/ffi/accessory.rs:41 — The new documentation comment contains eleven words, exceeding the explicit ten-word limit. Running `python tests/scripts/comments.py` exits 1 and identifies this line (`.work/R6.12-r2/comments.log`). Shorten it to ten words or fewer, or remove it.
|
||||
@@ -0,0 +1 @@
|
||||
PASS
|
||||
@@ -0,0 +1,9 @@
|
||||
FAIL
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:41 — Logical scroll lines are counted as physical wheel notches. Windows multiplies each notch by the system scroll-line setting (`vendor/gpui-pre-windows/src/events.rs:589`); with three lines configured, one downward notch produces `Lines(0, -3)`. Replaying that event through ElyShow and the rebuilt LOK worker moved from slide 1 to slide 4, rather than slide 2 (`.work/R6.13-r1/probe-explicit.log`). The pinned Linux X11 backend also uses three lines per notch. Normalize platform wheel units before counting slide changes, and cover realistic platform deltas; the existing tests only exercise unit notches.
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:37 — The line-delta branch never applies the one-turn-per-gesture limit, but the pinned GPUI X11 backend also represents smooth touchpad scrolling as `ScrollDelta::Lines` (`gpui-pre-linux-0.3.8`, `x11/client.rs`, `get_scroll_delta_and_update_state` and `make_scroll_wheel_event`). Replaying ten consecutive `-0.4` line deltas in one UI update through ElyShow/LOK moved from slide 1 to slide 5 instead of slide 2 (`.work/R6.13-r1/probe-extra.log`). Preserve the distinction between discrete wheel steps and smooth XInput gestures in the input adapter, and apply gesture limiting to the latter; clamping each event individually would still turn repeatedly during one swipe.
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:48 — A 250 ms pause resets `spent` even when the platform reports continuation of the same gesture. With a fitted deck, a `Started` event of -60 pixels turns one slide; keeping fingers down, pausing 300 ms, then sending a `Moved` event of -60 pixels turns another. This reproduced through ElyShow/LOK with slide index 2 instead of 1 (`.work/R6.13-r1/probe-explicit.log`). Track explicit gesture lifetime when phases are available; elapsed time must not reopen an explicitly ongoing gesture. Reserve timeout inference for streams without gesture boundaries and test continuation after a pause.
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:80 — The arrow-key decision uses the last selection callback without accounting for earlier queued input. On a title slide, press Tab to select its placeholder and Down before the worker's selection callback arrives: Down emits `Turn`, so the queued Tab selects the object and the following part change leaves the slide instead of moving that object. The integration probe changed slide index 0 to 1; its control case, waiting for Tab's selection before Down, stayed on slide 0 (`.work/R6.13-r1/probe-extra.log`). Resolve the arrow's action against the selection/editing state after preceding inputs and their callbacks have landed, while preserving input order, and add this queued-input regression.
|
||||
@@ -0,0 +1,5 @@
|
||||
FAIL
|
||||
|
||||
- crates/ely-lok/src/view/lane.rs:116 — An arrow's actual page change is queued only after its worker reply returns to the UI, behind subsequent inputs already in the lane. On slide 1, queue Down–Tab–Down before the worker catches up: Tab selects slide 1's title and the second Down moves it, then the deferred turn shows slide 2. The rebuilt-worker integration probe changed the departing title's y coordinate from 628 to 728 (1/100 mm); Down–Tab also loses the intended selection on slide 2, while the settled control passes (`.work/R6.13-r2/probe-final.log`). Complete the page change in input order before processing following keys or mouse events, and cover navigation immediately followed by selection/editing.
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:67 — Round 1's smooth-scroll defect remains when a gesture begins with whole increments: these events are classified as discrete wheel notches until a fractional delta appears. The pinned X11 adapter emits `Lines` for smooth motion and permits whole increments. Replaying `-3, -3`, then eight `-0.4` line deltas without a pause produces three turns instead of one (`.work/R6.13-r2/scroll-probe.log`); the equivalent stream normalized to this Windows machine's seven-line setting moves ElyShow from slide 1 to slide 4 (`.work/R6.13-r2/probe-final.log`). Preserve the smooth-versus-discrete distinction in the input adapter instead of inferring it from fractional values, and test gestures beginning with whole increments.
|
||||
@@ -0,0 +1,5 @@
|
||||
FAIL
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:69 — Treating every line delta as one gesture breaks R6.13's one-page-per-wheel-notch requirement. In the rebuilt-worker integration probes, three physical notches delivered without a 200 ms pause advance from slide 1 to slide 2 instead of slide 4; one event containing two notches reaches slide 2 instead of slide 3 (`.work/R6.13-r3/probe-tests.log`). The new unit test even expects two notches to turn once. Preserve the adapter's discrete-wheel versus smooth-scroll distinction, count every discrete notch, and retain the one-turn limit for touchpad gestures; cover both rapid notches and multi-notch events.
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:89 — `LokView::part()` is now dead code: this round deletes its sole caller, `Deck::turn`, and no production or checked-in test caller remains under `apps/` or `crates/` (`.work/R6.13-r3/part-callers.log`). The worker-driven navigation path no longer uses this accessor, violating agents.md rule 6. Remove the unused accessor.
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
# dock-macos.sh: the LOK worker never registers as a Dock app.
|
||||
set -euo pipefail
|
||||
[ "$(uname)" = Darwin ] || { echo "SKIP: macOS only"; exit 0; }
|
||||
runs=${ELY_DOCK_RUNS:-5}
|
||||
apps=("$@")
|
||||
# Bundled apps from dist and one unbundled dev build.
|
||||
[ ${#apps[@]} -gt 0 ] || apps=(dist/ElyDoc.app dist/ElyTable.app dist/ElyShow.app target/debug/ely-doc)
|
||||
|
||||
# One launch: samples the worker's type until a tile shows.
|
||||
launch() {
|
||||
local bin=$1 log=$2 start pid worker="" types="" asn i=0
|
||||
start=$(( $( [ -f "$log" ] && wc -l < "$log" || echo 0 ) + 1 ))
|
||||
ELY_NO_DIALOG=1 ELY_SMOKE=hold ELY_LOG=debug "$bin" >/dev/null 2>&1 &
|
||||
pid=$!
|
||||
local end=$((SECONDS + 60)) shown=0
|
||||
while [ $SECONDS -lt $end ] && kill -0 "$pid" 2>/dev/null; do
|
||||
[ -n "$worker" ] || worker=$(pgrep -P "$pid" -x ely-lok-worker || true)
|
||||
if [ -n "$worker" ]; then
|
||||
asn=$(lsappinfo find "pid=$worker" || true)
|
||||
[ -z "$asn" ] || types+=" $(lsappinfo info -only applicationtype "$asn" | grep -o 'type="[A-Za-z]*"' || true)"
|
||||
fi
|
||||
i=$((i + 1))
|
||||
if [ $((i % 20)) -eq 0 ] && tail -n +"$start" "$log" 2>/dev/null | grep -q 'lok: tile ('; then shown=1; break; fi
|
||||
done
|
||||
kill "$pid" 2>/dev/null || true
|
||||
wait "$pid" 2>/dev/null || true
|
||||
local seen
|
||||
seen=$(tr ' ' '\n' <<<"$types" | grep . | sort | uniq -c | tr -s ' \n' ' ')
|
||||
echo "$(basename "$bin"): worker $worker:$seen"
|
||||
[ "$shown" = 1 ] || { echo "FAIL: no tile shown"; return 1; }
|
||||
[ -n "$worker" ] || { echo "FAIL: no worker started"; return 1; }
|
||||
case $types in *Foreground*) echo "FAIL: the worker was a Dock app"; return 1 ;; esac
|
||||
case $types in *UIElement*) ;; *) echo "FAIL: the worker's type was never seen"; return 1 ;; esac
|
||||
tail -n +"$start" "$log" | grep -q 'lok: the worker is an accessory app' || { echo "FAIL: no accessory log"; return 1; }
|
||||
}
|
||||
|
||||
for app in "${apps[@]}"; do
|
||||
if [ -f "$app" ]; then
|
||||
bin=$app
|
||||
[ -x "$(dirname "$app")/ely-lok-worker" ] || { echo "FAIL: no worker beside $app (cargo build -p ely-lok --bins)"; exit 1; }
|
||||
else
|
||||
[ -d "$app" ] || { echo "FAIL: $app is missing"; exit 1; }
|
||||
bin=$(find "$app/Contents/MacOS" -maxdepth 1 -type f -name 'ely-*' ! -name 'ely-lok-worker' | head -1)
|
||||
[ -n "$bin" ] || { echo "FAIL: $app has no app binary"; exit 1; }
|
||||
fi
|
||||
log="$HOME/Library/Application Support/ElyOffice/$(basename "$bin")/ely.log"
|
||||
for _ in $(seq 1 "$runs"); do launch "$bin" "$log"; done
|
||||
done
|
||||
echo "PASS: no LOK worker registered as a Dock app"
|
||||
Reference in new issue
Block a user