Commit graph

6897 commits

Author SHA1 Message Date
Tamás Zolnai
9683f53a9c Filter out tiles by wired on wsd side too
Some times tiles with the same wireID survives the wireID
filtering in kit, so we should do that in wsd too.
The issue is with the tilesBeingRendered construction. First when
one tile is filtered out on kit side the client remains subcribed
to the tile, since wsd does not know filtering happened.
Second via the tilesBeingRendered object more clients can be subcribed
to the same tile and so when one client request a new version of this
tile (with an old wireID) the rendered tile is sent to all subscribed
clients even if the other clients has up-to-date tiles.

Change-Id: I4ca6b7a83a5d6979a9f924d766a71aba5e5362c7
2018-09-29 09:27:06 +02:00
Tamás Zolnai
a1a0bf3718 Don't send tiles which was changed outside of the visible area
Since this commit:
9473908d45
We can avoid that, because the tiles will be invalidated
on the client side and when the client visible area changes
the invalidated tiles are requested anyway.

Change-Id: I272e3b4b87380ae574c16a2b480dbc8caabf4b32
2018-09-29 09:27:06 +02:00
Tamás Zolnai
07e99ad336 Fix tilesBeingRendered tracking by client
I changed the code in this commit:
c2a5f6acb0

To make kit send a tilecombine message even if it does not
send actual tile data so we can track that the rendering was
done and so we can update the clients' _tilesBeingRendered
list. The issue is that tileBeingRendered object
belongs to not only one client, but more and so we don't
know which client gets the actual empty tile response.

So revert this method and rather use a smaller timeout for "waiting" the
arrival of the rendered tile.

Change-Id: I2dbbab1a62b81cbbb5314f2f37fdbc3415c69130
2018-09-29 09:27:06 +02:00
Tamás Zolnai
5260eae05f Avoid rendering / sending the same tile twice
When we're doing the prerendering we also need to register
a tileBeingRendered object, so we know that the given tile
will arrive soon. In earlier version of the code, rendering
and sending of the tile was not separated in time, but now it is,
so we need create a tileBeingRendered object even if we don't
subscribe the client to it yet.

Change-Id: I1374c22e5ffebe1d6fcc6e37261ddcedeb9066ec
2018-09-29 09:27:06 +02:00
Tamás Zolnai
b7f76d24fb loleaflet: Reset invalid counter when request new tiles by view change
This invalidCount does not work perfectly, since we don't always
send tile after every invalidation message (e.g. tile deduplication
on severs side, wireID handling). So this invalidCount usage should
be reconsidered. Now just avoid to have a tile still invalid after
we requested (and get) the newest tile when we are changing the view.

Change-Id: I249be63611767af02b04e142bb1c2afcb3a8eebb
2018-09-29 09:27:06 +02:00
Henry Castro
d1b7f10e8f loleaflet: remove docLayer precondition when the map is focused
Change-Id: Id7fb2e9d7823a788cb40cd3a953b3f024dd22ee5
2018-09-27 09:51:44 -04:00
Henry Castro
c47a27b49b loleaflet: mobile: fix non composition input
Change-Id: I6f72f888314baaef00549bb08bcfa78854a0b610
2018-09-27 09:51:02 -04:00
Henry Castro
2adfcb0995 loleaflet: mobile: hide the ruler
Change-Id: I87335f3a1116553f1ea548ee759680ffa6533aca
2018-09-27 09:50:04 -04:00
Henry Castro
c95f319f94 loleaflet: mobile: fix input text composition events
Change-Id: I04446f8c29c4901ebe67e49ae8dffcfac286f300
2018-09-27 09:49:23 -04:00
Henry Castro
a25aefaaee loleaflet: mobile: add to layer if and only if the cursor marker is created
Change-Id: Ida69eeceddcc0a3f223b724fb31d48f7722e21bf
2018-09-27 09:48:48 -04:00
Henry Castro
91c074a1f2 loleaflet: update cursor position
to fix IME pop up window

Change-Id: Ied2ca0b7518a20f6114f7e8f628bc3c352d7326f
2018-09-27 09:48:16 -04:00
Henry Castro
5e65d5f491 loleaflet: hide the mobile input cursor
Change-Id: I978e388eb1066374bd0174e35211bd3bd5a6743b
2018-09-27 09:47:22 -04:00
Tamás Zolnai
b623aca57e Use a bigger timeout for waiting tileprocessed message
The main purpose of this time-out is to avoid waiting forever for lost
tile messages, but since it rare to loose them we can use bigger value,
so we can avoid to send new tiles to a slow network.

Note that the used time stamp does not mean the time when the tile
actually send to the client, but the time when it gets to the sender
queue.

Change-Id: I230d85c38b3a5dafd195851d0cf4caac23149e3e
2018-09-21 16:04:53 +02:00
Tamás Zolnai
0807d04934 Convert this warning to info
There valid cases when we get unknown tileID. For example we
sent some tiles, but in the meantime canceltiles arrives which
resets tiles-on-fly list, but the client still send tileprocessed
messages for earlier requested tiles.

Change-Id: If2ec015106a0e58d66ae4517b64a9552eb8c38fc
2018-09-21 16:01:44 +02:00
Tamás Zolnai
4b13430f6d Fix warning: in case of a text document part number has no meaning
In this case the part number is undefined, somewhere it is set to 0 or 1,
but has no meaning at all. Just avoid using it with text ducments.

Change-Id: Ic98217bf3ea6c86d37c34e42302bf456f7274975
2018-09-21 16:01:44 +02:00
Aron Budea
132fc22f2b Revert "loleaflet: mobile: disable scroll bars"
This reverts commit 4d5fa8f833.

Change-Id: I2938818bff98dec862ef3137aca4766dc9d1af20
Reviewed-on: https://gerrit.libreoffice.org/60872
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Tested-by: Aron Budea <aron.budea@collabora.com>
2018-09-21 14:27:02 +02:00
Aron Budea
14c6562455 Revert "loleaflet: mobile: fix row/column headers"
This reverts commit c7a62fb304.

Change-Id: Ib565080314564255c39874c38066734911348432
Reviewed-on: https://gerrit.libreoffice.org/60871
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Tested-by: Aron Budea <aron.budea@collabora.com>
2018-09-21 14:25:35 +02:00
Tor Lillqvist
79934ad4b2 Use the user-defined $(LOSRCDIR) variable for the paths to the core source files 2018-09-21 10:34:07 +03:00
Tor Lillqvist
72be8e3ad7 Add some source files from core to the project
For easier setting of breakpooints in them, in advance before stepping
into their code.
2018-09-21 10:29:56 +03:00
Tor Lillqvist
26323fb92b Struggle a bit back and forth with the UTIs etc in Info.plist
This stuff is a bit fragile, and the presence of other apps on the
device that claim to support "our" file types might, or might not,
affect how it works. Also, upgrading to iOS 12 seemed to have an
effect. Anyway, now it is back to working as I need.
2018-09-21 10:29:56 +03:00
Tor Lillqvist
f3786f5cb7 Pass correct argument on iOS as pBuffer to lok::Document::paintTile()
On iOS it shouldn't actually be pointer to a pixel char buffer, but a
craphics context reference. (This is how it has been since the
experimental TiledLibreOffice app, maybe five years ago? Sadly it
wasn't documented in the LibreOfficeKit include file. But it is how
LibreOfficeLight used the API, too.)

In TiledLibreOffice we rendered tiles directly into the CALayer of the
view. In this Online-based app we of course do render tiles into pixel
char buffers, just like in real Online, but we need to create bitmap
graphics contexts for them and pass that to paintTile().

Now I get white tiles, not totally zero-filled ones. But still no
document contents rendered.

I don't yet want to change the pBuffer parameter to actually be a
buffer pointer on iOS, too, like on other platforms. Also, changing it
will mean the LibreOfficeLight app would need changing, too, and I
don't feel like doing that. But ideally, sure, that should be done.
2018-09-21 10:29:56 +03:00
Tor Lillqvist
06051c833b Comment out log.dump() call again
Change-Id: I27ecd6712e72182f3a943e7be86ef5ba7b05f746
2018-09-20 13:38:53 +03:00
Andras Timar
18751d35fa nginx and apache2 config templates
Change-Id: I1e2572617909d7aefb951d3299810f521f56062c
2018-09-20 10:18:57 +02:00
Tor Lillqvist
f4ce5df7e1 Implement the timeout parameter to fakeSocketPoll()
Adapt callers that mistakenly passed 0 assuming it meant "forever".

This also seems to help with the occasional hangs.
2018-09-19 20:03:24 +03:00
Tor Lillqvist
5ee96e0271 Small correction to poll semantics 2018-09-19 20:03:24 +03:00
Tor Lillqvist
8b5246b038 Bin one presumably pointless lock and unlock 2018-09-19 20:03:24 +03:00
Tor Lillqvist
9c57ffd3b3 Avoid potential deadlock 2018-09-19 17:55:14 +03:00
Tor Lillqvist
95eb849217 Still more iOS app and related Online C++ code hacking
Re-think the plumbing between the different parts of the C++ Online
code. Do try to have it work more like in real Online on all but the
lowest socket level. Except that we don't have multiple processes, but
threads inside the same process. And instead of using actual system
sockets for WebSocket traffic between the threads, we use our own
FakeSocket things, with no WebSocket framing of messages.

Reduce the amount of #ifdef MOBILEAPP a bit also by compiling in the
UnitFoo things. Hardcode that so that no unit testing is ever
attempted, though. We don't try to dlopen any library.

Corresponding changes in the app Objective-C code. Plus fixes and
functionality improvements.

Now it gets so far that the JavaScript code thinks it has the document
tiles presented, and doesn't crash. But it hangs occasionally. And all
tiles show up blank.

Anyway, progress.

Change-Id: I769497c9a46ddb74984bc7af36d132b7b43895d4
2018-09-19 11:31:18 +03:00
Tor Lillqvist
384a57092c Make the "Online" source files actually show up in Xcode 2018-09-19 11:19:25 +03:00
Tor Lillqvist
a4f19ac229 Avoid double "0x" prefix for pointer values in log output
No need for explicit "0x" and std::hex when outputting a pointer. A
pointer will be output as a hex number anyway. We used to have things
like this in the log:

TRC  #25 Connected to WS Handler 0x0x3610b60| ./net/WebSocketHandler.hpp:80
2018-09-19 10:33:41 +03:00
Tor Lillqvist
7159fcb54d Add Base64ToArrayBuffer() JavaScript function
Used for use sending tiles from the iOS app code to the JavaScript.
2018-09-19 01:06:41 +03:00
Tor Lillqvist
a149320239 Fix accidental unconditional use of iOS-specific API
Change-Id: Ia82ba76ca7b52173540c7c78522ad36fb68e0995
2018-09-18 22:49:10 +03:00
Tor Lillqvist
7ea91e1c6b More hacking on the FakeWebSocket for the iOS app 2018-09-18 18:07:59 +03:00
Tor Lillqvist
e1978621f3 No need for WOPI stuff in iOS app 2018-09-18 18:07:59 +03:00
Tor Lillqvist
763a27280a Add possiblity to force logging to stderr with environment variable
At least LOOLWSD.cpp has a couple of global variables of types that in
their constructors invoke FakeSocket APIs. If we turn on FakeSocket
logging (fakeSocketSetLoggingCallback()) only in the app's
initialization code, we will miss logging from those global variable
constructors.

Sure, the clean solution would be to turn those global variables into
members in the LOOLWSD class instead, but this will do for now.
2018-09-18 15:31:01 +03:00
Tor Lillqvist
c09dfda052 In the logging always precede FakeSocket "fd" numbers with #
Makes it easier to search log files.

Also, Online uses this convention for socket fds in many places (not
sure if consistently).
2018-09-18 13:04:16 +03:00
Tor Lillqvist
435718e9f3 Improve shutdown semantics 2018-09-18 13:04:11 +03:00
Tor Lillqvist
53416a290d Add fakeSocketShutdown() and drop fakeSocketFeed()
Not sure whether the shutdown() implementation matches real shutdown()
semantics, especially with regards to the behaviour of poll(), read(),
and write() (on both the socket itself and the connectd one)
afterwards. But let's see.

The feed() API turned out to be not needed. (And in any case, it was
suposed to be completely equivalent to writing to the peer socket.)
2018-09-17 20:44:18 +03:00
Tor Lillqvist
64c9115a75 Remove stray #include <ftw.h>
Change-Id: I1838ae1c40a6ddc8357963c32f5ccf2040e7da10
2018-09-17 18:05:43 +03:00
Tor Lillqvist
7fd28d5676 Revert part of my iOS related commit, causes compilation warning with Clang
Won't actually be needed anyway, the way the code is going in my work
tree.

Change-Id: I4480ed59fe96ddcfad8483517f2a23452606f332
Reviewed-on: https://gerrit.libreoffice.org/60576
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-17 12:51:07 +02:00
Tor Lillqvist
3bcde388ed FakeSocket poll fix and minor hacking
fakeSocketPoll() needs to return a correct return value.

Use notify_all() instead of notify_one(). Just to see if it makes any
difference.
2018-09-16 22:39:44 +03:00
Tor Lillqvist
8d42e09559 Introduce LOG_TRC_NOFILE() that doesn't output __FILE__ and __LINE__
For use in callback type situations where the location of the
LOG_TRC() call as such is uninteresting.
2018-09-16 13:43:08 +03:00
Tor Lillqvist
7399a86f6a Use optional logging callback in FakeSocket.cpp instead of hardcoded writes
It's easier to either call the function to set the logging callback,
or not, in one place in client code, than to comment in and out all
the logging lines in FakeSocket.cpp as needed.

Change-Id: Id17f7e461c7df817440b47cb3124fcece13b189b
2018-09-16 13:39:43 +03:00
Tor Lillqvist
30ec64566b Attempt to fix various FakeSocket problems
Also add a bit of internals documentation.
2018-09-16 10:42:01 +03:00
Tor Lillqvist
0a2868b8d4 More FakeSocket hacking
As we use #ifdefs at all call sites anyway (because we don't dare use
the generic overrides of close() etc), we can leave out the parameters
related to actual BSD sockets that we ignore anyway.

"Real" Online always uses non-blocking sockets. We don't need to take
flags for that or check it. We can hardcode such behaviour always.
(Assuing that is what we want; let's see once something works.)

Change-Id: I6863907d71c5599b00ce1f8305a44d41bbaf7bee
2018-09-15 12:35:23 +03:00
Tor Lillqvist
55a2f804a6 Change the FakeSocket to be record-oriented
That is how Online uses the sockets for communication between the
processes anyway: It send and receives complete WebSocket frames.
Sure, in the mobile case there is just one process, but (I think) we
want to keep the same basic structure anyway, even if "wsd" and "kit"
are just threads. (We probably also want to drop the WebSocket framing
of the messages.)

Change-Id: I2397f321029c1cbbbc448a9b2403ad185a51cf14
2018-09-15 12:34:29 +03:00
Tor Lillqvist
6d81ebcfeb Add FakeSocket
Intended as a replacement for the real sockets used for WebSocket IPC
in Online on Linux. The idea is that in a mobile app we don't want to
bother with any actual sockets or WebSocket protocol (because we are
running as a single process after all), but keep much of the code that
thinks it is using such mostly unmodified. Just an idea so far, let's
see how this turns out.

Change-Id: I7878b0db99d9cbf70650227186c1fec9677fa74b
2018-09-15 12:30:50 +03:00
Tor Lillqvist
83a7a6f744 s/StaticNames/StaticNameHelper
It is a container for one name (and used just once even), not several,
so no need for the plural.

Change-Id: I6d8b22f071d5136fb854e6f2c5a6be8b4572b535
2018-09-13 12:06:23 +03:00
Tor Lillqvist
4841ee4f47 Move SocketPoll::pollingThreadEntry() implementation to cpp file
Makes it easier to put a breakpoint in it in Xcode...

Not sure if we have any consistent convention around here anyway about
which member functions should be defined inline in the class
definition in the hpp file, and which ones should be in the cpp file.
2018-09-13 09:33:40 +03:00
Tamás Zolnai
5fdc049a79 Create a method which invalidates and requests all the tiles
Used after reconnection for example.

Change-Id: Ie9a15ec1fdec71ca8aba7d9b7417b05005c6c69a
2018-09-12 22:18:34 +02:00