Radial: cleaner split labels + warp cursor into the created pane
Replace the ▯▯/⊟ glyphs with 'Split |' (left/right) and 'Split —' (top/bottom), which render cleanly in any font. Extend isPaneFocusAction to view_split_vert/horiz so the cursor warps onto the newly created pane (Kate activates it), and defer the warp ~a frame (16ms) so a freshly laid- out split pane has geometry before QCursor/mapTo reads its centre.
This commit is contained in:
parent
eeee28a94a
commit
7495d82019
|
|
@ -30,8 +30,8 @@
|
|||
"name": "window",
|
||||
"button": "MiddleButton",
|
||||
"slices": [
|
||||
{ "label": "Split ▯▯", "action": "view_split_vert" },
|
||||
{ "label": "Split ⊟", "action": "view_split_horiz" },
|
||||
{ "label": "Split |", "action": "view_split_vert" },
|
||||
{ "label": "Split —", "action": "view_split_horiz" },
|
||||
{ "label": "Close", "action": "view_close_current_space" },
|
||||
{ "label": "Only", "action": "view_close_others" },
|
||||
{ "label": "Rotate", "action": "view_split_toggle" },
|
||||
|
|
|
|||
|
|
@ -46,8 +46,9 @@ namespace katecustom
|
|||
|
||||
namespace
|
||||
{
|
||||
// True for the Kate actions that move keyboard focus to another split pane.
|
||||
// After one of these fires we warp the mouse pointer onto the new pane so the
|
||||
// True for the Kate actions that change which split pane is active: moving
|
||||
// focus between panes, or creating a split (Kate activates the new pane). After
|
||||
// one of these fires we warp the mouse pointer onto the now-active pane so the
|
||||
// cursor follows the focus (mouse-first UX).
|
||||
bool isPaneFocusAction(const QString &id)
|
||||
{
|
||||
|
|
@ -56,7 +57,9 @@ bool isPaneFocusAction(const QString &id)
|
|||
|| id == QLatin1String("go_upward_split_view")
|
||||
|| id == QLatin1String("go_downward_split_view")
|
||||
|| id == QLatin1String("go_next_split_view")
|
||||
|| id == QLatin1String("go_prev_split_view");
|
||||
|| id == QLatin1String("go_prev_split_view")
|
||||
|| id == QLatin1String("view_split_vert")
|
||||
|| id == QLatin1String("view_split_horiz");
|
||||
}
|
||||
|
||||
// Bracket pairs understood by the double-click selection feature.
|
||||
|
|
@ -1152,11 +1155,12 @@ void OllieView::onRadialActivated(const QString &actionId)
|
|||
}
|
||||
if (QAction *a = findActionByName(actionId)) {
|
||||
a->trigger();
|
||||
// If this moved focus to another split pane, warp the pointer onto that
|
||||
// pane so the mouse follows the focus. Deferred to the next event-loop
|
||||
// turn so Kate has finished activating the target view first.
|
||||
// If this changed the active pane (focus move, or a split that creates
|
||||
// and activates a new pane), warp the pointer onto it so the mouse
|
||||
// follows the focus. Deferred by ~a frame so Kate has finished
|
||||
// activating — and, for a freshly created split, laying out — the pane.
|
||||
if (isPaneFocusAction(actionId)) {
|
||||
QTimer::singleShot(0, this, [this]() { warpCursorToActiveView(); });
|
||||
QTimer::singleShot(16, this, [this]() { warpCursorToActiveView(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,8 +193,8 @@ QList<RadialDef> RadialConfig::builtinDefault()
|
|||
};
|
||||
|
||||
window.root.children = {
|
||||
leaf(QStringLiteral("Split ▯▯"), QStringLiteral("view_split_vert")),
|
||||
leaf(QStringLiteral("Split ⊟"), QStringLiteral("view_split_horiz")),
|
||||
leaf(QStringLiteral("Split |"), QStringLiteral("view_split_vert")),
|
||||
leaf(QStringLiteral("Split —"), QStringLiteral("view_split_horiz")),
|
||||
leaf(QStringLiteral("Close"), QStringLiteral("view_close_current_space")),
|
||||
leaf(QStringLiteral("Only"), QStringLiteral("view_close_others")),
|
||||
leaf(QStringLiteral("Rotate"), QStringLiteral("view_split_toggle")),
|
||||
|
|
|
|||
Loading…
Reference in New Issue