#Monitor X and Y are incorrect

71 messages · Page 1 of 1 (latest)

rugged sonnet
#

The positions of the X and Y from the Monitor Object are incorrect OR the WebviewWindow is summoned in the incorrect place!

Here is the code that opens the webviewwindow:

async open(monitor: Monitor, version: string, id: number|string|null =null) {
  if (id == null) id = monitor.name;
  console.log(monitor)
  let webviewwindow = new WebviewWindow(`presentation${id}${version}`, {url: this.url, fullscreen: true, resizable: false, title: 'presention'+version, x: monitor.position.x, y: monitor.position.y});
}

console.log(monitor) output (Aka. Monitor info):

{ "name": "\\\\.\\DISPLAY1", "scaleFactor": 1.5, "position": { "type": "Physical", "x": 0, "y": 0 }, "size": { "type": "Physical", "width": 1920, "height": 1080 } }
{ "name": "\\\\.\\DISPLAY216", "scaleFactor": 1, "position": { "type": "Physical", "x": 1920, "y": 0 }, "size": { "type": "Physical", "width": 1920, "height": 1080 } }
{ "name": "\\\\.\\DISPLAY217", "scaleFactor": 1, "position": { "type": "Physical", "x": 0, "y": 1080 }, "size": { "type": "Physical", "width": 1920, "height": 1080 } }

P.s. this has tag Windows since thats what I tested, I don't have linux or macos at all or with multiple (virtual) screens.

rugged sonnet
#

Adding in the center: true to the WebviewWindows options seems to have fixed it, but I am not yet 100% sure

UPDATE: That doesn't really fix it

rugged sonnet
#

It just doesn't work

rugged sonnet
#

Oke when using this code:

webviewwindow.once('tauri://created', async function () {
  console.log(await webviewwindow.innerPosition())
  // ...
});

The console.log outputs these values in order of the screens:

{ "type": "Physical", "x": 0, "y": 0 }
{ "type": "Physical", "x": 2880, "y": 0 }
{ "type": "Physical", "x": 5760, "y": 0 }
{ "type": "Physical", "x": 8640, "y": 0 }

2880/1920=1.5
5760/1920=3
8640/1920=4.5

So with this info, I think it uses the scale factor (for screen 1 it is 1.5, the rest is 1) that I use because my screen is too small for 100% zoom.

Yeah, I guess it just uses the scale factor, whilst that is not needed. But I am unable to find the script which does it

Oh wait it might be the PhysicalPosition.toLogical()

I just temporarly fixed it by dividing the x and y of the monitor.position by the appWindow.scaleFactor()

stable lichen
#

So tbh i had trouble following, but if you think there is a bug in tauri/wry/tao, feel free to create an issue (at the tauri repo) with an explanation and preferably a reproduction example so that the team can take a look :)

rugged sonnet
#

Btw I am just updating the packages to make sure that it isn't a bug that might have already been fixed, but I just still use old code.

Update:

  • Uncaught (in promise) path not allowed on the configured scope: \\?\C:\YH4F\SongTextProjector\src-tauri\target\debug\_up_\songs
  • And the bug is still here
rugged sonnet
stable lichen
#

thanks

#

what's your scope config?

rugged sonnet
#

"scope": ["$RESOURCE/*"]

stable lichen
#

try ["$RESOURCE/**"]

stable lichen
rugged sonnet
stable lichen
rugged sonnet
stable lichen
#

if it doesn't work with [patch] you can replace the actual dependencies in the [dependencies] block

rugged sonnet
#

ohhhh

#

Btw do I need to do all of the methods? or just the patch

stable lichen
#

depends on what you need

#

tauri and tauri-build is a must have

rugged sonnet
#

So with just the patch it should work?

stable lichen
#

and if you want to do something in js you'll also need the api.js package

stable lichen
#

if it doesn't it will print an error or at least a warning saying that it ignored the patch

rugged sonnet
#
..
warning: Patch `tauri v1.1.1 (https://github.com/ysinsane/tauri?branch=dev#afbf9d53)` was not used in the crate graph.
Patch `tauri-build v1.1.1 (https://github.com/ysinsane/tauri?branch=dev#afbf9d53)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
#

But it does start

stable lichen
#

yeah that's the warning i meant. it means it didn't apply it and you're still using upstream tauri and not the fork

#

which means you'll have to move it to the dependency section instead

rugged sonnet
#

it says run cargo update to use the new version

#

But you just say I have to move it from patch to dependency???

stable lichen
#

well, you can try cargo update first and see if that indeed works, but usually it doesn't

#

or i guess that depends on your current rust dependencies mainly

rugged sonnet
#

ok

#

Hmm it didn't give error...

#

But it also does no longer open my webviewwindow

#

Strange, cause it doesn't give any message about it failing

rugged sonnet
# stable lichen or i guess that depends on your current rust dependencies mainly

Now that I tried adding it in the depencencies:

Updating git repository `https://github.com/tauri-apps/wry`
error: failed to select a version for `webkit2gtk-sys`.
    ... required by package `wry v0.28.3 (https://github.com/tauri-apps/wry?branch=dev#4d37135d)`
    ... which satisfies git dependency `wry` of package `tauri-runtime-wry v0.11.1 (https://github.com/ysinsane/tauri?branch=dev#afbf9d53)`
    ... which satisfies git dependency `tauri-runtime-wry` of package `tauri v1.1.1 (https://github.com/ysinsane/tauri?branch=dev#afbf9d53)`
    ... which satisfies git dependency `tauri` of package `app v0.1.0 (C:\YH4F\STP\src-tauri)`
versions that meet the requirements `^0.19.1` are: 0.19.1

the package `webkit2gtk-sys` links to the native library `web_kit2`, but it conflicts with a previous package which links to `web_kit2` as well:
package `webkit2gtk-sys v0.18.0`
    ... which satisfies dependency `ffi = "^0.18"` (locked to 0.18.0) of package `webkit2gtk v0.18.2`
    ... which satisfies dependency `webkit2gtk = "^0.18.2"` (locked to 0.18.2) of package `tauri v1.1.1 (https://github.com/ysinsane/tauri?branch=dev#afbf9d53)`
    ... which satisfies git dependency `tauri` of package `app v0.1.0 (C:\YH4F\STP\src-tauri)`
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='webkit2gtk-sys' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.

failed to select a version for `webkit2gtk-sys` which could resolve this conflict
stable lichen
#

can you share the dependency list you got in cargo.toml now?

rugged sonnet
# stable lichen can you share the dependency list you got in cargo.toml now?
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["Miniontoby"]
license = ""
repository = ""
default-run = "app"
edition = "2021"
rust-version = "1.57"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
#tauri-build = { version = "1.2.1", features = [] }
tauri-build = { git = "https://github.com/ysinsane/tauri", branch = "dev" }
# 1.1.1

[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
#tauri = { version = "1.2.1", features = ["dialog-all", "fs-copy-file", "fs-exists", "fs-read-dir", "fs-read-file", "fs-remove-file", "fs-write-file", "path-all", "window-all"] }
tauri-plugin-fs-watch = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
include_dir = "0.7.3"
tauri = { git = "https://github.com/ysinsane/tauri", branch = "dev", features = ["dialog-all", "fs-copy-file", "fs-exists", "fs-read-dir", "fs-read-file", "fs-remove-file", "fs-write-file", "path-all", "window-all"] }

[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ]
# this feature is used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]


#[patch.crates-io]
#tauri = { git = "https://github.com/ysinsane/tauri", branch = "dev" }
#tauri-build = { git = "https://github.com/ysinsane/tauri", branch = "dev" }
rugged sonnet
stable lichen
stable lichen
#

typo

#

just uncomment the last three lines

rugged sonnet
#

And what about the lines in the depencies section?

#

Cause I also have the 'patch'ed version in there

stable lichen
#

yeah, but that's what you want so the dep section is fine

rugged sonnet
#

so not the default tauri one there?

stable lichen
#

no

rugged sonnet
#

Oke

#

I will test

#
    Updating crates.io index
    Updating git repository `https://github.com/tauri-apps/wry`
error: failed to select a version for `webkit2gtk-sys`.
    ... required by package `wry v0.28.3 (https://github.com/tauri-apps/wry?branch=dev#c26a1879)`
    ... which satisfies git dependency `wry` of package `tauri-runtime-wry v0.11.1 (https://github.com/ysinsane/tauri?branch=dev#afbf9d53)`
    ... which satisfies git dependency `tauri-runtime-wry` of package `tauri v1.1.1 (https://github.com/ysinsane/tauri?branch=dev#afbf9d53)`
    ... which satisfies git dependency `tauri` of package `app v0.1.0 (C:\YH4F\SongTextProjector\src-tauri)`
versions that meet the requirements `^0.19.1` are: 0.19.1

the package `webkit2gtk-sys` links to the native library `web_kit2`, but it conflicts with a previous package which links to `web_kit2` as well:
package `webkit2gtk-sys v0.18.0`
    ... which satisfies dependency `ffi = "^0.18"` (locked to 0.18.0) of package `webkit2gtk v0.18.2`
    ... which satisfies dependency `webkit2gtk = "^0.18.2"` (locked to 0.18.2) of package `tauri v1.1.1 (https://github.com/ysinsane/tauri?branch=dev#afbf9d53)`
    ... which satisfies git dependency `tauri` of package `app v0.1.0 (C:\YH4F\SongTextProjector\src-tauri)`
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='webkit2gtk-sys' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.

failed to select a version for `webkit2gtk-sys` which could resolve this conflict
stable lichen
rugged sonnet
stable lichen
rugged sonnet
#
error[E0277]: the trait bound `tauri::plugin::TauriPlugin<_>: Plugin<tauri_runtime_wry::Wry<EventLoopMessage>>` is not satisfied
    --> src\main.rs:29:13
     |
29   |     .plugin(tauri_plugin_fs_watch::init())
     |      ------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Plugin<tauri_runtime_wry::Wry<EventLoopMessage>>` is not implemented for `tauri::plugin::TauriPlugin<_>`
     |      |
     |      required by a bound introduced by this call
     |
     = help: the trait `Plugin<R>` is implemented for `TauriPlugin<R, C>`
note: required by a bound in `tauri::Builder::<R>::plugin`
    --> C:\Users\Miniontoby\.cargo\git\checkouts\tauri-845b2c232843dbd4\afbf9d5\core\tauri\src\app.rs:1156:20
     |
1156 |   pub fn plugin<P: Plugin<R> + 'static>(mut self, plugin: P) -> Self {
     |                    ^^^^^^^^^ required by this bound in `tauri::Builder::<R>::plugin`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `app` due to previous error
#

Hmmm, now the plugin doesnt work

stable lichen
#

Can you run cargo update again? It seems to work fine for me

#

just to be sure, that's the toml i tested ```toml
[build-dependencies]
tauri-build = { git = "https://github.com/ysinsane/tauri", branch = "dev", features = [] }

[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri-plugin-fs-watch = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
include_dir = "0.7.3"
tauri = { git = "https://github.com/ysinsane/tauri", branch = "dev", features = [] }

[features]
custom-protocol = [ "tauri/custom-protocol" ]

[patch.crates-io]
tauri = { git = "https://github.com/ysinsane/tauri", branch = "dev" }
tauri-build = { git = "https://github.com/ysinsane/tauri", branch = "dev" }

[patch.'https://github.com/tauri-apps/wry']
wry = "=0.22.0"

rugged sonnet
#

Oke, now with cargo update it does build

#

Hmm I think it works... at least the webviewwindow shows up

stable lichen
#

I hope it keeps working because i'm completely out of ideas

rugged sonnet
#

I will have to make screenshot to see if it works (and to see if I implemented it correctly, since there is no documentation about how to use the new changes)

#

Hmm does seem good...

Will notify you after I did a bigger test with actual screens and such, but that I can only test later today...

rugged sonnet
#

Hmm nope, its not fixed...

But maybe I dont use it correctly

rugged sonnet
#

Hmm, I would really like this to work

#

new / old = factor

1920/1680 = 1.14285714286
1080/1050 = 1.02857142857

Hmm this doesn't make any sense

rugged sonnet
rugged sonnet