• Hello MLAers! We've re-enabled auto-approval for accounts. If you are still waiting on account approval, please check this thread for more information.

Window Snapping for Classic Macintosh?

Having seen and used Exposé for Classic Mac, and having remade Stapler for modern macOS, I wondered if it would be possible to take something new back to Classic Mac...

Could we do Window Snapping as a control panel?

Pseudo-code
  1. whilst the window is being dragged
  2. check its bounds
  3. if it is within, say, 10px of a screen corner
    1. store old window dimensions before snapping
    2. resize to quarter of screen
    3. move to that corner
  4. restore old window dimensions if window is moved
  • If that all works we can add a config panel
    • proximity amount
    • toggle active snapping areas
    • check more snapping areas (edges for left/right/bottom halves, full screen)
    • keyboard shortcut alternatives
It's been a while since I developed for Classic Mac, would need a refresher to create .rsrc etc, but am keen to use Think Pascal to do this

(I'm less keen to use Think C, but if it's the only option I will)

Thoughts appreciated!

matt
 
I agree.

The hardest part for me will be getting a Think Pascal and the Macintosh Toolbox set up in a way that will make development predictable.

For example, I just typed some code out to test my setup, but I'm not sure I'm using the correct toolbox interfaces.

The actual code I feel will be quite straightforward.
 
What interfaces are you using? There's a copy of the Universal Interfaces around somewhere for THINK Pascal - that will make things easier to deal with, because that will let you use the newer call names that most of the examples use.

Also, you probably want to install THINK Reference and/or the Apple Toolbox Assistant, both of which are hyperlinked references to the OS and the Toolbox. Both are on the Garden.

I haven't used THINK Pascal for quite a long time, so my advice here will necessarily be a bit handwavy, I'm afraid :/
 
I have THINK Ref already, Interfaces I was using were from Think Pascal 2, but I have them with 4.0 and 4.5.

I think I'll start with a hello world and go from there.
 
What is "window snapping?"
If you drag a window to the side of the screen, it'll "snap" to the edge. Depending on which OS or windowing environment, it can do other things, too. Like automatically set the windows to 50% size of the screen. If you move another window to the right, it'll make that one take up 50%. Or if you have a single window and drag it to the top, it'll enlarge to full screen.
 
What is "window snapping?"
Windows calls it window snapping, so I think that's the most common term at the moment.
In Linux land they refer to it as a tiling window manager.
macOS calls it tiling (hold option and hover over the green traffic light button)
Sequoia brings far more tiling options to macOS (link)

Since several macOS (Mac OS X) versions ago I use a combination of Tiles app to do it using drag, and a script I wrote in Hammerspoon to do more specific tiling using only the keyboard.

Basically, manage windows in a more regimented and organised way using halves, thirds, quarters, etc.

In my classic Mac days, there were things like Window Stacker that would "arrange windows offset by a title bar. But there were never any tiling window managers or window snapping functionality.
 
Best of luck in your endeavor! I regrettably won't use it: one of the things I loathe about modern macOS is the "full screen" deal where an application takes up the entire screen sans menu bar, or even multiple things taking the entire screen. Not being able to see my desktop somewhere makes me think of Windows 3.1/95. I get "computer claustrophobia."
 
OK, but just so you are aware none of this thread is talking about the "full screen" feature. You are the first to mention it.
No, but when you say "tiling", it appeared to me that the strategy was for various tiles of applications and/or windows to take up pretty much the whole screen together. Is that not correct?
 
No, not necessarily.

It depends entirely how you use it, you are the user and you are in control.

For example, I hardly ever fill the whole screen and if I do fill the screen it's with one app - browser or code editor.
Though I'm sure some people do fill the screen with multiple tiles, it's up to the person and the moment.

My use, which may aid understanding: for "transient" apps (eg Twitter, Mastodon, Threads) I position them in the upper right corner.
Some apps like developer forums, documentation, I position in the lower or upper half of the screen.
These choices are purely for consistency and predictability, as I prefer it when apps/windows appear in the same position every time.
The key thing is that I can move windows between these predefined sizes and positions instantly with a single drag or key press. No fine tuning needed.
If I want to open another window or app I know I will be able to position it quickly and accurately, again with a single drag or key press.
Tiling (I prefer "window snapping" myself), for me, allows a quicker, easier, more organised, tidier way of working with windows.

To get to the desktop regardless of how many windows are open or how much of it I can see, I always use Exposé hot corner or key press.

Anyway, this thread is not to convince or convert people to use window snapping or tiling.
It's to make a new app for those of us that are already using this technique.
 
Last edited:
Certainly not trying to convince anyone of anything. I’ll be interested to see screen shots of what you guys do with this.
 
So, I have a working Think Pascal 4.5 setup. Demo apps build OK.
And found Universal Headers 2.1! They were right there all along.

More importantly my first naive attempt at the code ...builds and runs!

But as an App, rather than a Control Panel, so it's not very useful right now.

If I make some more useful progress I'll create a GitHub repo for the project.

Next to figure out how to turn this into a cdev.
 
Last edited:
I've been looking for a sample of how to setup a CDEV using either C or Pascal.

I have a draft of the Pascal code written, I am just trying to fill in gaps in my old knowledge of how to actually put together the control panel. Like, how do I compile resources using Rez?
 
Back
Top