Comments (9)
I'd prefer to try to fix bugs with WMs directly before using such a drastic approach. Which issues do you experience, and with which WM?
from pqiv.
I'm using openbox & fvwm.
This is kinda hard to explain, especially since English is my second language but I'll try: I want this options because I don't use the center window option of pqiv, but when loading multiple images I want the center of the window to stay the same (however the center of the window doesn't have to be center of the monitor!).
in both openbox and fvwm I've set an option that makes new windows spawn under the cursor. By combining this with a replace-window option the windows jump around way less.
I created a webm that hopefully explains this a bit better: https://sr.ht/fOOp.webm
The first image viewer is pqiv, like you can see the image jumps around a lot, the second one is pho.
from pqiv.
You can use --window-position=off
to switch off positioning. That's not quite what you want - it will (probably) leave the upper left corner in place instead of the window's center. Combined with
gtk_window_set_gravity(main_window, GDK_GRAVITY_CENTER);
somewhere in create_window
, around line 3950, this should what you want?! (This line will have some unexpected side effects though, I'll probably have to work around some bugs. That said, resizing around the window's center does indeed feel much better, I'm tempted to make this the default behaviour.)
from pqiv.
See my latest upload (to the center-gravity branch). Is this an improvement?
from pqiv.
It's better but not perfect yet, Example:
https://sr.ht/pikY.png jumps too https://sr.ht/Agpr.png
The two pictures in question: https://sr.ht/oxgN.jpg https://sr.ht/m6MB.jpg
from pqiv.
Too bad.. in Cinnamon, this works as expected with your images. I thought about reimplementing the whole resizing/positioning on my own for a while now, because there are indeed many incompatibilities and rough edges in general between the different WMs and GDKs code for handling it. I'll look into this soon.
In the meantime, in image_loaded_handler
, near line 1442, directly above the line that calls set_scale_level_for_screen
, insert
if(!main_window_in_fullscreen) {
gtk_widget_unmap(GTK_WIDGET(main_window));
gtk_widget_map(GTK_WIDGET(main_window));
}
This should close & reopen the window whenever a new image is loaded. Combined with --window-position=off
this should work as expected.
from pqiv.
The unmap/map thing didn't really work, I think the window actually needs to be destroyed in order for it to work. Anyways I've been experimenting with a "follow cursor position option", keep in mind I don't know anything about programming :p
if(!main_window_in_fullscreen) {
gint cursor_x = -1;
gint cursor_y = -1;
gint window_w = -1;
gint window_h = -1;
gdk_window_get_pointer(NULL, &cursor_x, &cursor_y, NULL);
gtk_window_get_size(main_window, &window_w, &window_h);
gtk_window_move(main_window, cursor_x - window_w / 2, cursor_y - window_h / 2);
}
This works great when all images are the exact same size, however the pqiv window still jumps when the image size differs.
from pqiv.
Lacking a working better solution, I now added --recreate-window
in the recreate-window
branch. Does this work as expected, and do you still need the feature?
from pqiv.
Works perfectly, thanks!
from pqiv.
Related Issues (20)
- Question: How to define window size HOT 4
- Feature Request: separate borderless from transparent background
- background window not transparent? HOT 1
- Feature Request: save displayed image HOT 2
- Crash with a alignment trap issue when trying to view video files on a raspberry pi 2b HOT 4
- Slideshow interval fine for plain images and pdfs, not so much for animated gif / mp4 movies
- Control content of info box HOT 1
- Fix deprecation warnings HOT 1
- How can I bind a key to move file to a particular folder? HOT 1
- [bug] Sorting by name does not work if input is a directory HOT 2
- Use Command Output as Action Parameter HOT 1
- Release 2.13 HOT 10
- pqiv-2.12, SIGSEGV in bostree_node_count HOT 6
- pqiv doesn't play videos — missing libav.. libraries the reason? HOT 1
- output path of marked images in montage mode HOT 5
- pqiv craches viewing avif images
- --browse breaks file browsers in 2.13
- Scaling for initial image is sometimes incorrect HOT 5
- how to setting no info window at startup etc. HOT 2
- Proper color management with ICC profiles HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pqiv.