elements icon indicating copy to clipboard operation
elements copied to clipboard

[Feature Request] Resizable child windows

Open Arcnor opened this issue 1 year ago • 14 comments

Currently child windows cannot be resized, only moved and/or closed. My assumption is that a resizeable "trait" (sorry if that's not the right term!) can be added, similar to the moveable one.

Arcnor avatar Jul 12 '24 15:07 Arcnor

My assumption is that a resizeable "trait" (sorry if that's not the right term!) can be added, similar to the moveable one.

Yes, that is correct.

djowel avatar Jul 12 '24 22:07 djowel

I'm working on this.

djowel avatar Jul 12 '24 23:07 djowel

Ah, then minimize/maximize have to be added.

djowel avatar Jul 13 '24 03:07 djowel

Implemented now in master and skia_2024 branches.

djowel avatar Jul 13 '24 09:07 djowel

I've finally tested this, seems to work mostly ok, although (and talking about the "Child Windows" example) depending on how far into the window the mouse cursor is, it either resizes the window or triggers the scrollbar behavior (when talking about the bottom/right areas) / moves the window (when talking about the top area), but the mouse cursor is still the resize one.

There is probably a difference between the area that triggers the cursor change and the area that actually effects the resizing behavior.

Arcnor avatar Jul 13 '24 20:07 Arcnor

I've finally tested this, seems to work mostly ok, although (and talking about the "Child Windows" example) depending on how far into the window the mouse cursor is, it either resizes the window or triggers the scrollbar behavior (when talking about the bottom/right areas) / moves the window (when talking about the top area), but the mouse cursor is still the resize one.

There is probably a difference between the area that triggers the cursor change and the area that actually effects the resizing behavior.

Right! Good observation. The active areas overlap. What I should do is move the resize area outside the scroll bar's active area. I'll see what I can do!

djowel avatar Jul 13 '24 22:07 djowel

Try it now. master and skia_2024

djowel avatar Jul 13 '24 23:07 djowel

Need more cursors. I added two cursors for the corner sizing (north-to-east and south-to-west) for the Mac, example:

Screenshot 2024-07-14 at 1 24 07 PM

I also fixed the correct "sizing" cursors on the Mac.

If you can add the switches for setting these new cursors for GTK and Windows, that would be great. If not, I'll have this open and get back to it later. See:

void set_cursor(cursor_type type)

in base_view.cpp

djowel avatar Jul 14 '24 05:07 djowel

Awesome. I actually noticed that corners were missing as well, but didn't want to bother you anymore 🙂.

I'll check and test Windows corner cursors (it's IDC_SIZENWSE and IDC_SIZENESW there), will also check GTK docs but not sure I'll be able to test the implementation, will let you know.

Arcnor avatar Jul 14 '24 10:07 Arcnor

So I've implemented and tested Windows, the corner cursor seems to need a bit of tinkering. The area in which the cursor appear seems to be very small, and also the cursor can go from "h cursor" -> "diagonal cursor" -> "h cursor" (for example) when slowly panning the cursor from the right side of the window until you get to the corner. Same with the "v cursor".

As for GTK3 I'm having a bit of a hard time finding the diagonal cursor. I see there should be one on this image (although this might be GTK2?):

However, I can't find any diagonal cursors on the docs: https://docs.gtk.org/gdk3/enum.CursorType.html

Arcnor avatar Jul 14 '24 10:07 Arcnor

So I've implemented and tested Windows, the corner cursor seems to need a bit of tinkering. The area in which the cursor appear seems to be very small, and also the cursor can go from "h cursor" -> "diagonal cursor" -> "h cursor" (for example) when slowly panning the cursor from the right side of the window until you get to the corner. Same with the "v cursor".

For sure. Right now the margin is just 5px. You are welcome to make some adjustments.

djowel avatar Jul 14 '24 11:07 djowel

Did some refactoring and renames.

djowel avatar Jul 15 '24 00:07 djowel

I'm going to move this to a feature branch (resizable_window and resizable_window_skia) until it is complete.

djowel avatar Jul 18 '24 10:07 djowel

Done. This is moved to the resizable_window and resizable_window_skia branches now.

djowel avatar Jul 18 '24 11:07 djowel