Math Behind Expose?

Posted:
in macOS edited January 2014
I'm curious as to how Expose knows where and how to resize the windows when you hit "show all windows." I assume it's some sort of mathematical algorithm. Anyone know what it is?



Thanks =) I'm just being curious.



Stedwick

Comments

  • Reply 1 of 6
    kickahakickaha Posts: 8,760member
    Not entire sure, but there are packing and partitioning algorithms from classic programming techniques that could be adapted to handle the X/Y space.
  • Reply 2 of 6
    gongon Posts: 2,437member
    In 10.3, the algorithm failed when all windows were exactly same size. It put them in one horizontal row and did not use most of the space on the screen.

    I just noticed it's fixed in 10.4.
  • Reply 3 of 6
    Quote:

    Originally posted by Gon

    In 10.3, the algorithm failed when all windows were exactly same size. It put them in one horizontal row and did not use most of the space on the screen.

    I just noticed it's fixed in 10.4.




    I still get that behavior in 10.4...



    My screen res is 1024x768.
  • Reply 4 of 6
    kickahakickaha Posts: 8,760member
    Curious. I haven't seen this... but a 1024xA screen might be part of the problem. Most algorithms that do packing do binary partitioning, and 1024 is a power of 2. Might be causing a boundary case to be triggered, where it gets locked into divvying up just one row, and it never flips over to realizing that the rest of the screen is unused. Hmm.



    I just love forensic software analysis.
  • Reply 5 of 6
    OK, I know absolutely zero about programming and maths and stuff... so this might sound really stupid :



    But if 1024 creates problems because it is a power of 2, couldn't you just miss out a line and make expose 'believe' that the resolution was 1023x768?
  • Reply 6 of 6
    kickahakickaha Posts: 8,760member
    Well, you *COULD*, but then you're looking for that magic power of 2 already, so instead of hacking up a workaround, it's better to inspect the algorithm and find the bug.



    The hard part is figuring what the trigger is... the power-of-2 is just a wild guess on my part, but it's an issue that pops up more often than it should.
Sign In or Register to comment.