GithubHelp home page GithubHelp logo

Feature/physical size - [merged] about zathura HOT 30 CLOSED

pwmt avatar pwmt commented on August 11, 2024
Feature/physical size - [merged]

from zathura.

Comments (30)

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 12, 2018, 11:25


added 4 commits

  • d625c0d - Distinguish zoom and scale, always apply DPI correction on scale
  • b4eca29 - Replace monitor "dpi" with "ppi"
  • 5505575 - Assume PPI=100 (typical value) if info unavailable
  • f6dd368 - Fix compilation for GTK+ < 3.22

Compare with previous version

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

Is this just for the sake of renaming of does the meaning of the value change as well? If it's only the former, please don't. If it's the latter, it requires migration code in both database backends.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

We can easily rename it everywhere in the code, but changes to the database on-disk format always need to have the code that handles upgrades from previous versions.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 12, 2018, 14:46

Commented on zathura/database-plain.c line 27


There is a change in meaning:

Currently, zoom is the same as scale: it's the number of pixels per document
point. In particular, zoom 100% means 1 pixel per point.

This MR redefines zoom 100% as "same size on screen as on paper". The scale is
still the number of pixels per point, and this value is now different from the
zoom (it's a function of the zoom and the monitor DPI/PPI).

These meanings for zoom and scale actually match the old code in many places: zoom
was used for the user concept in girara settings, and scale was used wherever a
"pixel per point" factor was needed.

Unfortunately, "scale" was also used as the name to store the zoom in the
database and in data structures (such as mark and link target) where it really
meant the user setting and not the "pixel per point". This is what I propose to
change here.

Regarding the database upgrade: do you think it's worth migrating 'scale' to
'zoom' it if the meaning has changed anyway? Should I just add code to delete
'scale' if present?

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 12, 2018, 14:50


added 1 commit

Compare with previous version

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 12, 2018, 15:18


added 1 commit

  • 4f3837c - Remove Cairo 1.14 version checks

Compare with previous version

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

Okay, in that case it should be enough to upgrade the sqlite based database by dropping the old scale column and adding a new zoom column.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 13, 2018, 19:50

Commented on zathura/database-plain.c line 27


OK but I wonder if it wouldn't be best to leave the scale column in place, since dropping a column is a bit complex in sqlite, and the scale column wouldn't interfere in any way?

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

Yes, that would suffice. Sample code to add the new column on demand is readily available in the sqlite backend.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 13, 2018, 20:01


added 1 commit

  • 09d8a37 - Add zoom column to sqlite database if missing

Compare with previous version

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 13, 2018, 20:01

Commented on zathura/database-plain.c line 27


Perfect, commit pushed.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

This change requires updates to all plugins:

utils.c: In function ‘poppler_link_to_zathura_link’:
utils.c:37:19: error: ‘zathura_link_target_t {aka struct zathura_link_target_s}’ has no member named ‘scale’
             target.scale          = poppler_destination->zoom;
                   ^
Makefile:49: recipe for target 'utils.o' failed

(from zathura-pdf-poppler).

Could you changes this to an anonymous union { double scale; double zoom; } and mark scale` as deprecated? Once we merged these changes in zathura, we can then update all the plugins and drop the workaround before the release.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

hmm, does this function really take a gpointer instead of a GCallback as second-to-last argument? That smells like a bug in glib.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 15, 2018, 18:08

Commented on zathura/types.h line 182


changed this line in version 6 of the diff

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 15, 2018, 18:08


added 1 commit

  • 8b93be9 - Add scale/zoom union in link target

Compare with previous version

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 15, 2018, 18:09

Commented on zathura/types.h line 182


Sorry, I miss that indeed. I've made the changes.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 15, 2018, 18:12

Commented on zathura/callbacks.c line 247


Yes it also causes a compilation warning (for good reasons)... I'm not sure what should be done about this.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

Elsewhere we store the signal handler id in the zathura object and use g_signal_handlers_disconnect. Couldn't this work here too?

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 16, 2018, 16:43

Commented on zathura/callbacks.c line 247


changed this line in version 7 of the diff

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 16, 2018, 16:43


added 1 commit

  • af90d40 - Store monitors-changed handler for disconnection

Compare with previous version

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 16, 2018, 16:47

Commented on zathura/callbacks.c line 247


Yes, I've pushed changes accordingly.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

resolved all discussions

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

@knuesel Anything else you want to change before merging this MR? I've played with it a little on a single monitor HiDPI setup and it looked go to me.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 19, 2018, 20:07


@sebastinas I just tried it on a double-monitor setup today and there are a few issues I'd like to fix:

  • a change in monitor resolution is detected, but no action is taken except to store the new pixel-per-inch value. This should be trivial to fix (render_all, refresh_view)
  • window moved to another monitor is not detected. A possible fix would be to connect to the top widget's configure-event. The callback would be called repeatedly when a window is being or resized, but the computation should be negligible, e.g. causing refresh only if the PPI value changed). Would you be OK with that?

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

Okay. Yes, that should be fine.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 23, 2018, 15:30


added 3 commits

  • 1e170f0 - Indentation fix
  • 8e3f056 - If new PPI is significantly different, yes render and refresh
  • 5d362c2 - Listen on configure event for PPI changes

Compare with previous version

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 23, 2018, 15:36


added 1 commit

  • 063b234 - Listen on configure event for PPI changes

Compare with previous version

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 23, 2018, 15:49


added 17 commits

  • 063b234...dfc31a3 - 16 commits from branch pwmt:develop
  • f1ebe9e - Merge remote-tracking branch 'upstream/develop' into feature/physical-size

Compare with previous version

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

On GitLab by @knuesel on Feb 23, 2018, 16:30


I've made the discussed changes and merged develop for the meson changes. Playing a bit on dual monitor setups I didn't find any issue so feel free to merge.

from zathura.

sebastinas avatar sebastinas commented on August 11, 2024

merged

from zathura.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.