GithubHelp home page GithubHelp logo

selection is 1px too small about slop HOT 9 CLOSED

naelstrof avatar naelstrof commented on May 28, 2024
selection is 1px too small

from slop.

Comments (9)

naelstrof avatar naelstrof commented on May 28, 2024

Are you sure? Selecting a full-screen for me captures from 0x0 to 1919x1079, counting the 0x0, is 1920 by 1080 pixels.

Looking at the picture I took with maim: it does include every pixel. Including when selecting windows.
Can you show me some examples of it not working properly? Because I can't reproduce it. (In fact, I did try to increase the selection by 1x1. It actually made it too wide and too tall when I selected windows. Causing it to select some of my desktop with the window.)

from slop.

unek avatar unek commented on May 28, 2024

Tried selecting the whole screen with mouse:

$ slop
X=0
Y=0
W=1919
H=1079

As you can see, the width and height are 1px too low. I also tried maim -s and selecting the whole screen manually, which resulted in 1919x1079 (from 0x0 to 1918x1078) screenshot, while just maim to capture full screen gave me the right size (which is 1920x1080, from 0x0 to 1919x1079). Slop seems not to catch the last row and column of pixels. This problem isn't specific just for me, as my friend (using Openbox) also isn't able to select manually the whole screen.

The second issue however, seems to be a problem with my window manager (herbstluftwm). I just noticed that slop doesn't catch my right and bottom border, because selection starts 1px too "early". This is probably a result of herbstluftwm's unusual separation between frames (which can contain multiple windows) and windows. Here you can see a screenshot of a single window (the borders are cut off), and here is an example of 2 windows in a frame (borders show up properly). Therefore the problem is not slop-related, however I hope you can help me find the solution, to properly capture windows.

from slop.

naelstrof avatar naelstrof commented on May 28, 2024

Oh yup you were right. I had the border color set to black, and I couldn't see that it was indeed off.

I made normal selections have +1 to the width and height. Which should be visible directly from the selection rectangle.
However I haven't changed window selections-- It grabs the window width and height directly from X11 when you click on windows (So I'm assuming it's working as well as possible). Could you see if your problem has been fixed?

from slop.

unek avatar unek commented on May 28, 2024

Apparently herbstluftwm window's x and y (as given by xwininfo) are the upper left corner of border. I did a dirty hack, by removing all operations of subtraction and addition of the t.m_border variable to x, y, w and h (so the slop's selection shows up in the right place), and added t.m_border * 2 to both width and height. That dirty, dirty hack worked for me (no matter what's the window's border size), and probably will only work on herbstluftwm. herbstluftwm is probably a special case, but I think I'll experiment with more window managers soon.

Thanks for help.

from slop.

naelstrof avatar naelstrof commented on May 28, 2024

Oh you're right! Would you kindly submit a pull request? Because this isn't just a herbstluftwm bug. I really did do my m_border math wrong. I wasn't even sure I needed it because my window manager doesn't even report window border size. So I didn't really notice it was wrong in the first place.

Thanks for figuring that all out!

from slop.

naelstrof avatar naelstrof commented on May 28, 2024

Nevermind-- I found a few more problems myself and fixed them, and just fixed the error you spotted on the way.

Thanks again!

from slop.

unek avatar unek commented on May 28, 2024

Hah, just as I was commiting :). Glad I could help.

from slop.

unek avatar unek commented on May 28, 2024

Sadly, your commit didn't fix my problem. Not sure if it's actually a herbstluftwm-specific issue or not...

from slop.

naelstrof avatar naelstrof commented on May 28, 2024

Woops, now it's fixed.

from slop.

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.