Commit graph

6702 commits

Author SHA1 Message Date
Tamás Zolnai
29df46219c Need to extract the initial part id from status message
Change-Id: Ia0651d93fedb71d3ca1e24d0356ac179e95e907e
2018-07-19 14:11:36 +02:00
Tamás Zolnai
85f96bc281 Store sent tiles's id instead of using a simple counter
Change-Id: I8cbf84923a53fb6b294bd4039eb7382326f8c445
2018-07-19 14:11:18 +02:00
Tamás Zolnai
464dd72e1c We might need to rerequest tile rendering when we are at sending them
Change-Id: I0551e51c5f5023931dad13435b4ac3517fc48931
2018-07-19 14:11:02 +02:00
Tamás Zolnai
30f4cafd37 Reduce code deduplication
We can request tilecombine even if client needs actually one tile only.

Change-Id: Id897f219885be4cb93635d727d4ee871a4b55cb7
2018-07-19 14:10:48 +02:00
Tamás Zolnai
1f2982cdc5 Send the right visible area to the server
Change-Id: I036dfaa566fa7d4e370386d839bd2397cbf929f8
2018-07-19 14:10:36 +02:00
Tamás Zolnai
a9c5ea9022 Add a timeout for tileprocessed message handling
For debug purposes.

Change-Id: Icc9dfc05b18f9da96b29b7cadeb57f7218832295
2018-07-19 14:10:22 +02:00
Tamás Zolnai
15afe2c0fb Wait tileprocessed message from client to send new bunch of tiles
We always  one bunch of tiles (e.g. all tiles invalidated) and we
are waiting until client send tileprocessed message back for all
tiles before sending the new tiles.
By canceltiles message we drop every previously requested tiles and
make wsd ready to send new tiles, which will be requested by the client
in theory.

Change-Id: I9901420ada549e962ffaf5e6bd58e52b86bd129d
2018-07-19 14:10:08 +02:00
Tamás Zolnai
57cdd68fcf Request new tiles in wsd by invalidateTiles message
And don't wait for the client to send back a tilecombine
request.

Change-Id: I9ea5de0f6b12dfaaf61992d34735d5b78ea382ed
2018-07-19 14:09:49 +02:00
Tamás Zolnai
161695eb66 Store client's visible are information in wsd
Change-Id: Iec3c146181b7db2e76247d5775076e6ac90eed2c
2018-07-19 14:09:33 +02:00
Tor Lillqvist
3352603011 Avoid cast that causes gcc warning
gcc 8 warns: cast between incompatible function types from ‘void
(*)(int, siginfo_t*, void*)’ to ‘__sighandler_t’ {aka ‘void (*)(int’}
[-Werror=cast-function-type].

The struct sigaction already has an appropriately typed field
sa_sigaction in a union with the sa_handler field, so use that. (If
that is not present in some older Linux and/or glibc that we still
need to support, this commit will have to be reverted then.)

Change-Id: I67667073c89b7b22e7de1933ccaaa60868685866
2018-07-19 12:46:54 +03:00
Tor Lillqvist
eae43a262b Drop unused LogPrefix variable
Also gets rid of a potentially problematic strncpy() use that causes a
gcc warning: specified bound 256 equals destination size
[-Werror=stringop-truncation].

(Whether that would have caused a problem or not depends on how
LogPrefix would have been used, and whether it ever would have been
filled completely, without any terminating nul character, by that
strncpy().)

Change-Id: I92dba3726e3f46777d9b4c8cf88f557c02788fe0
2018-07-19 12:16:19 +03:00
Tor Lillqvist
ff31f2dba1 Avoid potential confusion by not using the term "packet" in a comment
It confused at least me for a while into pondering whether the code
thinks TCP is packet-oriented.

Change-Id: I143fc7821abd6b4023d551cdcb42a00e1613e466
2018-07-19 11:39:45 +03:00
Tor Lillqvist
6b96c73f46 Don't log binary data as such, use Util::stringifyHexLine()
Also, log the cases with still incomplete data in the buffer
separately.

Change-Id: Idfa915378c2823dd898789d6a63a0cd71a817b8a
2018-07-19 11:36:11 +03:00
Tor Lillqvist
1e7a56ddc6 Add FIXME: Do we really want to log binary data as such here?
Change-Id: I386d3c377d698f25da5094d87cd82183fc36aee4
2018-07-18 21:16:49 +03:00
Tor Lillqvist
86a20fc927 Allow also the IPv6 loopback address ::1
Change-Id: I4e079095d0a599f36b1d48d7a1311db75e3d79bf
2018-07-18 17:54:45 +03:00
Pranav Kant
5521af3826 loleaflet: use larger savemodified icon
otherwise it doesn't match exactly, in size, with save icon resulting in
ugly transition.

Change-Id: I0ce25253b1436d6e4343c61e83a8a06941964eba
2018-07-16 15:55:37 +05:30
Pranav Kant
a5c58228c6 loleaflet: switch all icons to colibre
Change-Id: Id13c9a8c726c8b99849b6be201dcc2a1e7ea36ef
2018-07-16 15:55:37 +05:30
Pranav Kant
4691eb32d7 loleaflet: rename image file names as they are in core.git
use the original file name from the links.txt file for currencyfield.svg

Change-Id: Ib28b4aa82705b83145dd4e2cc2c6ec6ad9fa8a9f
2018-07-16 15:55:37 +05:30
Pranav Kant
a2de2713b8 loleaflet: switch to colibre svgs for shapes
Change-Id: Iba42bcea55b3b172d21139352347c0bfbb59e7e6
2018-07-16 15:55:37 +05:30
Andras Timar
3719faf5e9 loleaflet: remove latin access keys in parentheses (in case of CJK, Indian, etc. langs)
Change-Id: I15763165535771511a4871882dd067fc689baaa3
2018-07-16 09:04:05 +02:00
Andras Timar
d239a3b373 adjust paths of toolbar.js and unocommands.js
Change-Id: I0373f1a05d18a85d5e351fd11bf3b81c43367279
2018-07-16 09:04:05 +02:00
Pranav Kant
6f8b15dfa8 wsd: missing include
Change-Id: I561db86b4b46f1cff0d9f0c744c556d9ec74291f
2018-07-16 10:34:24 +05:30
Tor Lillqvist
0c425c82d3 Be consistent, no space before the '|' in LOG_BODY()
Change-Id: Iecab73efcb19562c5a7ebee506f13668b1a827c3
2018-07-13 17:51:21 +03:00
Tor Lillqvist
b4192de6fa Output '|' before the source file name in LOG_END(), too, like in LOG_BODY()
Change-Id: I57d825d03321992d680670f3560e951bc0cb2005
2018-07-13 17:49:21 +03:00
Tor Lillqvist
3a9e536dfa When asked to convert to PNG, look for an embedded ODF thumbnail first
Change-Id: Ib777572fe5f79b1cfdd95ec3a7f84484a13ae145
2018-07-12 19:27:54 +03:00
Tor Lillqvist
405b66c8db Add a cache of "thumbnails" (PNG images) generated using the convert-to API
When asked to "convert" a document to a PNG image, i.e. what one can
call a thumbnail, check if we have a cached PNG for the same docuemnt
already, and in that case return it.

When we have done such a convert-to operation to PNG, save the result
in the cache for later re-use.

This change adds no thumbnail cache cleanup mechanism. That will have
to be implemented separately using a cron job or whatever.

There are further improvement possibilities: For instance, if the
document is of a type that contains an embedded thumbnail (like ODF),
just extract and return that. For ODF that embedded thumbnail even
already is in PNG format.

Change-Id: I882efe97acc1d81041dc7a4ccb222995940e4836
Reviewed-on: https://gerrit.libreoffice.org/57345
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2018-07-12 18:27:23 +02:00
Tor Lillqvist
63a24e0082 Accept also localhost and IPv4-mapped IPv6 addresses
Change-Id: Ifc295d164276c0dd17592ff27066a522482fe04a
Reviewed-on: https://gerrit.libreoffice.org/57351
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2018-07-12 17:43:11 +02:00
Tor Lillqvist
b152e021b3 Drop noise output
Make prints the sudo setcap commands it executes, no need to
additionally echo "Set required capabilities".

Especially as "set" can be misunderstood as being in the imperative
mood, telling the developer to do something, instead of being past
tense telling what was done on the previous line.

Change-Id: I1138fa28a4d08b57d55552d0e012dcfd778b423c
2018-07-12 11:46:56 +03:00
Tor Lillqvist
3b4269a301 Use Util::symbolicErrno()
I think the general policy should be to always log errno using both
Util::symbolicErrno() and std::strerror(), never log a naked errno.
But only in cases where we know that it is highly likely that it is
the most recent system call that has failed, so errno makes sense.

Change-Id: I4a1fb31e375ea949e7da17687464361efe7c1761
2018-07-11 13:05:22 +03:00
Tor Lillqvist
40f4cf17c9 Add a symbolicErrno() function to Util
For a developer, it is much nicer to see "EXDEV" in a log than "18",
for instance. (Sure, we often also log strerror(), but might that
perhaps be localised? And the symbolic names are what one uses when
coding anyway.)

Change-Id: I456a8c2589147dcad87f1b4c3a20b3bd5a35d097
2018-07-11 12:54:27 +03:00
Tor Lillqvist
1c09d4a607 Improve logging a bit
Log all error: cases in ClientSession::handleKitToClientMessage(), not
just the case of cmd=load with kind= some password failure.

Change-Id: I53c959068f5642ae41157e8feb14fd34fc59dc9a
2018-07-11 12:33:42 +03:00
Tor Lillqvist
a8b41b0cbb Log also when retrying the saveAs
Although, at least for me, after calling LOK's saveAs with an
intentionally bogus file extension 'file:///user/docs/u0.frobozz'
retrying with 'file:///user/docs/u0.frobozz.odt' does not work either.

Actually, I am not sure how useful this retry feature is as it is now.
If the user tries to save as some unsupported format, why can we
assume that maybe they want to save in some other format instead, and
possibly overwrite an existing file? Maybe the retry should be done
only if the file name to saveAs was without extension? But that was
already discussed in gerrit, I see.

Change-Id: I8bd4fbf241cb492d9654ae893af4baaf28b6b3a0
2018-07-11 12:15:26 +03:00
Tor Lillqvist
c852d9340b Fix the help message after my option handling changes last night
Change-Id: I9cc869b9957236803d41f3495eb1a444fa8ebad1
2018-07-11 11:35:59 +03:00
Tor Lillqvist
42e6a1e96d Make the loolconvert tool compatible with libreoffice --convert-to
Accept the same options, as applicable. Ignore irrelevant options
(like -env:userInstallation or --headless, but actually just ignore
anything we don't need). Handle options manually so that we can accept
them also with just one dash.

Drop superfluous verbosity. Succeed silently, as is The Unix
Philosophy (haha).

Change-Id: I05793b11886f61955db4746b864be97a6bef5674
2018-07-11 01:29:57 +03:00
Tor Lillqvist
bc0f76d6ad It's /lool/convert-to, not /convert-to
(But it doesn't seem to work anyway any more.)

Change-Id: I53261cd24d945dc47e156ff16240679beeb85f6a
2018-07-10 23:14:51 +03:00
Tor Lillqvist
32036fcadf We can pass a std::string directly to LOG_ERR()
Change-Id: I10027e680ad009eb04e44913323ca91c61821b87
2018-07-10 23:14:51 +03:00
Tor Lillqvist
a97c8c3455 Fis our use of inet_ntop() etc
We had:
    auto ipv4 = (struct sockaddr_in *)&clientInfo.sin_addr
even if the clientInfo variable itself was a struct sockaddr_in.

And then we also had:
    auto ipv6 = (struct sockaddr_in6 *)&clientInfo.sin_addr
which makes even less sense.

Instead, make clientInfo into a struct sockaddr_in6, which is big
enough to also to be interpreted as a sockaddr_in. Pass the address of
the correct field, either sin_addr or sin6_addr, to inet_ntop(). (Note
that sin_addr in sockaddr_in has a different offset than sin6_addr in
sockaddr_in6.)

At least on my Fedora 28, when I connect using IPv4, accept4() still
returns the client address as an IPv4 mapped IPv6 address, that is
::ffff:192.168.1.113 for 192.168.1.113. So the sample
net.post_allow.host value in loolwsd.xml.in should probably be changed
to have that ::ffff: prefix, too.

Change-Id: I0ad774616b210d94b904982e2f7dc928adc879ed
2018-07-10 23:14:51 +03:00
Tor Lillqvist
73dbf27ede The std::string compare() method is like strcmp(): it returns 0 on equality
Change-Id: I4d080afd98419cbdaa531cc6f2c306533bbc1737
2018-07-10 23:14:51 +03:00
Tor Lillqvist
c783485a3b The option is called "server" and not "uri"
(It's the parameter of that option that is called "uri".)

Change-Id: If247a932bf8879b4eb626d850e813c3e8d5a7d60
2018-07-10 23:14:51 +03:00
Miklos Vajna
8ad281e12f wsd: avoid unnecessary value parameter 2018-07-09 09:11:20 +02:00
Tor Lillqvist
72dfbc9594 Our zoom step factor is 1.2, not 2 as in upstream
This change makes the zooming animation of the document while doing a
pinch gesture (closing and/or opening) match the finger movement much
better.

(But sure, there is till lots of weird jumping around after finishing
the pinch gesture.)

Change-Id: I9d5affe653c1a0ebaebced54629bc9e8d9de5854
Reviewed-on: https://gerrit.libreoffice.org/57089
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2018-07-07 00:01:28 +02:00
Tor Lillqvist
ed69ecf81f Add Emacs mode lines to get the indent level right
It's irritating to have to manually align lines even when just adding
temporary console.debug() calls. Sure, these mode lines should be
added in all .js files; these are just some I happened to be touching
now.

Change-Id: I13b3a62e66e4430878713fd64a459c72c014ded1
2018-07-05 16:05:31 +03:00
Tor Lillqvist
26b5a3745e Better and more dynamic way to show ruler conditionally
Use conditional CSS, setting the ruler height to zero if it would be
too high. Now the ruler even shows up and disappears dynamically as
the window height changes, for instance when turning a mobile device
between landscape and portrait orientation. No JS conditional needed
after all.

Change-Id: Iebfbd182d1675f4d6abd2f252389fdcdf46ed4d3
2018-07-04 16:44:46 +03:00
Tor Lillqvist
1800a8ee17 Decide whether to display a ruler based on ruler percentage of window height
If the ruler would be over 5% of the window height, don't display it.

Change-Id: Ieed55318fc76dfe0f9248985b816e306b6654dee
2018-07-04 16:00:58 +03:00
Tor Lillqvist
23c7c7d2a9 Don't show the ruler if the window has too small height
Of course, for this to really be worthy of being called "responsive"
web design, we should update this decision also if the window is
re-sized dynamically, like when a desktop browser's window is
arbitrarily re-sized by the user, or a mobile device is rotated
between portrait and landscape orientation, or a mobile device enters
or leaves some kind of split-screen mode where another application
than the browser shares the display.

Also, it would be nice if the window height limit used here, 1280, was
some kind of global variable. (For width limits used to detect mobile
devices, we use 768 or 768px here and there in our JS code. (And,
interestingly, 767px, too.) Ideally this 1280 and those 768s should be
defined in some common place. No idea how to do that correctly in
JavaScript.

Change-Id: I02bb54f309bc116ae1a0b5264e72b9ba674f56e4
Reviewed-on: https://gerrit.libreoffice.org/56936
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2018-07-04 13:29:46 +02:00
Andras Timar
3f0f2c671c loleaflet: no fill or automatic color handling in color picker
Change-Id: Iab98aadf54f0c1b041fe46eb2be1a798662d935b
2018-07-02 16:53:16 +02:00
Henry Castro
68ce5cac97 loleaflet: disable default context menu, part 2
Change-Id: I92548bffdfd96811155560b77ff28e49f3289ba4
2018-07-01 17:49:34 -04:00
Henry Castro
43a7b465bf lolefalet: mobile mode, hide tooltips
Change-Id: I0bc1f10184f63318c483b590139d570380a47222
Reviewed-on: https://gerrit.libreoffice.org/56421
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-07-01 17:47:13 -04:00
Henry Castro
276e367977 loleaflet: set bottom position of tooltip
Change-Id: I2ff39ce70df1f87788b7d5a1233cd97d2d0af5d7
Reviewed-on: https://gerrit.libreoffice.org/56392
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-07-01 17:43:36 -04:00
Henry Castro
22416fc45c loleaflet: disable the overflow buttons on the formula toolbar
Change-Id: I788625dd5c7fbd96372a19f3cdbcbefdddeb51c8
Reviewed-on: https://gerrit.libreoffice.org/56059
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/56783
Reviewed-by: Henry Castro <hcastro@collabora.com>
Tested-by: Henry Castro <hcastro@collabora.com>
2018-07-01 23:41:05 +02:00