Problem: GTK4 will drop numeric cursor support.
Solution: Adopt GTK3 CSS cursor convention.
I've been working on GTK4 support. GTK3 began the transition to CSS styling for mouse cursors. GTK4 drops almost all X11-specific constructs, including the numeric X cursors. GTK3 began this transition by supporting CSS names for mouse cursors. This PR adopts that convention as a precursor to GTK4 support.
https://github.com/vim/vim/pull/14610
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@dvogel commented on this pull request.
> + "ns-resize", // GDK_SB_V_DOUBLE_ARROW + "nwse-resize", // GDK_SIZING + "ew-resize", // GDK_SB_H_DOUBLE_ARROW + "ew-resize", // GDK_SIZING + "progress", // GDK_WATCH + "not-allowed", // GDK_X_CURSOR + "crosshair", // GDK_CROSSHAIR + "pointer", // GDK_HAND1 + "pointer", // GDK_HAND2 + "pointer", // GDK_PENCIL (no good option for this one) + "help", // GDK_QUESTION_ARROW + "default", // GDK_RIGHT_PTR (no css analogue) + "default", // GDK_CENTER_PTR (no css analogue) + "default" // GDK_LEFT_PTR +}; +# endif
These choices are best considered relative to the mshape_ids array above.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks for working on that. I think that makes sense. Do I understand correctly, that this should not break anything on GUI (GTK3) Vim?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Thanks for working on that. I think that makes sense. Do I understand correctly, that this should not break anything on GUI (GTK3) Vim?
No errors or crashes will occur. However it is not backward compatible. Users who currently use numeric cursor shape IDs or any of the following vim shape names will see different icons. The underlying issue is that gdk_cursor_new_from_name supports fewer cursor shapes than gdk_cursor_new/GdkCursorType does. The latter is based on X11 conventions that are being deprecated by GTK.
hand1hand2pencilrightup-arrowup-arrow—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Okay, so it looks like we will have those 'mouseshapes':
(System is w for Windows and x for X11, perhaps we should add a G for GTK).
| System | Vim Name | GDK/CSS Name | Desc |
|---|---|---|---|
| w x | arrow | default | Normal mouse pointer |
| w x | blank | blank | no pointer at all (use with care!) |
| x | hand1 | pointer | black hand |
| x | hand2 | pointer | white hand |
| x | pencil | pointer | what you write with |
| x | question | help | big ? |
| x | crosshair | crosshair | like a big thin + |
| w x | updown | ns-resize | up-down sizing arrows |
| w x | leftright | ew-resize | left-right sizing arrows |
| w x | no | not-allowed | The system's usual 'no input' pointer |
| x | udsizing | ns-resize | indicates up-down resizing |
| x | lrsizing | ew-resize | indicates left-right resizing |
Missing:
| System | Vim Name | GDK Name | Desc |
|---|---|---|---|
| w x | busy | The system's usual busy pointer | |
| w x | beam | I-beam | |
| x | rightup-arrow | arrow pointing right-up | |
| w x | up-arrow | arrow pointing up | |
| x | any X11 pointer number (see X11/cursorfont.h) |
I am a bit surprised we don't have beam and busy. But when this is no longer supported by the underlying library :/
Currently the help states also this:
Any modes not specified or shapes not available use the normal mouse pointer.
So it seems more or less okay? Can we keep the current cursor shapes when we still use GTK2/3 UI?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@dvogel pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
We will have support for the vim names beam and busy. They translate to the CSS names text and progress. Here's a couple of screenshots showing how those look on my screen with vim -g --clean -U /dev/null. Please ignore the cursor size. It appears comically large here because the (a) it is configured to be extra large by preference and (b) the default font size is very small.
vim_mouseshape.a.beam.png (view on web)
vim_mouseshape.a.busy.png (view on web)
I like the idea of adding a g for GTK to that table. I'll incorporate that into my next update.
Regarding when to adopt this, I don't have a firm preference. I wanted to start on this because it is coming eventually and would take some discussion. If it is best to delay this until GTK4 that is fine with me. I think one argument for adopting this in GTK3 sooner rather than later relates to GTK2 support. I don't yet have a firm grasp on how hard it will be to maintain support for all of GTK2/3/4. Whatever the absolute effort required, on a relative basis it would be considerably easier to support any two versions of GTK at once. This seems to have been the approach so far. If we decide that we will support only GTK3/4 in vim10 then I think there's two ways to approach that:
The first option would argue for merging this now. The second option would argue for folding this into the much larger effort to support GTK4.
We currently have a kludge that shunts vim users into X11 even with GTK3 unless they explicitly opt into Wayland. I think that was good when it was added but eventually this will have to be removed.
#if GTK_CHECK_VERSION(3,10,0)
// Vim currently assumes that Gtk means X11, so it cannot use native Gtk
// support for other backends such as Wayland.
//
// Use an environment variable to enable unfinished Wayland support.
if (getenv("GVIM_ENABLE_WAYLAND") == NULL)
gdk_set_allowed_backends("x11");
#endif
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@dvogel pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra commented on this pull request.
Thanks. this looks like we can clean up the GTK code a bit. Didn't you also want to update the help table at :h 'mouseshape'?
> @@ -7287,12 +7276,26 @@ mch_set_mouse_shape(int shape)
else
id &= ~1; // they are always even (why?)
}
+# if GTK_CHECK_VERSION(3,0,0)
+ else if (shape < (int)ARRAY_LENGTH(mshape_css_names))
+ {
+ css_name = mshape_css_names[shape];
+ }
style, you can get rid of the braces for single line statements.
> else if (shape < (int)ARRAY_LENGTH(mshape_ids))
+ {
also here.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks. this looks like we can clean up the GTK code a bit. Didn't you also want to update the help table at
:h 'mouseshape'?
Yeah, thanks for the reminder. I'll try to update that later today.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
thanks
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()