ahrm / sioyek

Sioyek is a PDF viewer with a focus on textbooks and research papers
https://sioyek.info/
GNU General Public License v3.0
7.02k stars 232 forks source link

Sioyek only renders top half of each page #979

Open ChenKB91 opened 7 months ago

ChenKB91 commented 7 months ago

My system: image

I'm using version 2.0.0. This is what it looks like when I open the default document: image

Selecting the text puts the highlight at wrong positions. image

I've tried both versions (Appimage and build) on AUR, both have the same issue.

ahrm commented 7 months ago

Does the issue happen with the development branch here: https://github.com/ahrm/sioyek/tree/development ? (there are no binaries yet unfortunately, so you'll have to build sioyek from source).

ChenKB91 commented 7 months ago

I'm having some troubles building from the dev branch, it runs into the following error:

pdf_viewer/coordinates.h: In member function ‘float Vec<T, dim>::norm()’:
pdf_viewer/coordinates.h:289:16: error: there are no argumentsto ‘sqrt’ that depend on a template parameter, so a declaration of ‘sqrt’ must be available [-fpermissive]
  289 |         return sqrt(norm_squared);
      |                ^~~~

I'm assuming this is caused by my environment? It seems like the main branch works fine.

ahrm commented 7 months ago

Maybe replace this:

  289 |         return sqrt(norm_squared);

with

return sqrt<float>(norm_squared)
adriafarres commented 7 months ago

Out of curiosity, are you running this on a virtual machine? Could you try running sioyek like this: LIBGL_ALWAYS_SOFTWARE=1 sioyek?

ChenKB91 commented 7 months ago

Out of curiosity, are you running this on a virtual machine? Could you try running sioyek like this: LIBGL_ALWAYS_SOFTWARE=1 sioyek?

I'm running it directly on my laptop. And that flag doesn't seem to effect the appimage version, still only half the page is rendered.

ChenKB91 commented 7 months ago

Maybe replace this:

  289 |         return sqrt(norm_squared);

with

return sqrt<float>(norm_squared)

Sorry for the late reply. I've fixed this one by changing sqrt to this->sqrt. But another error appears:

In file included from pdf_viewer/utf8.h:32:
pdf_viewer/utf8/unchecked.h:179:40: warning: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
  179 |           class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
      |                                        ^~~~~~~~
/usr/include/c++/13.2.1/bits/stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
pdf_viewer/touchui/TouchDrawControls.cpp: In member function ‘void TouchDrawControls::set_scratchpad_mode(bool)’:
pdf_viewer/touchui/TouchDrawControls.cpp:149:30: error: no matching function for call to ‘QMetaObject::invokeMethod(QQuickItem*, const char [26], QVariant)’
  149 |     QMetaObject::invokeMethod(quick_widget->rootObject(), "on_scratchpad_mode_change", QVariant::fromValue(mode));
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I think it is caused by some missing includes, but nothing I add seems to work.

ahrm commented 7 months ago

this->sqrt doesn't make any sense. It is not a suitable fix for this issue.