mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-23 09:40:59 +00:00
Fixed LayoutBase::FocusPrev, and wired up shift+tab support in Main.cpp.
This commit is contained in:
parent
c3217bf65c
commit
c7a0377632
@ -122,13 +122,7 @@ static void changeLayout(WindowState& current, ILayoutPtr newLayout) {
|
||||
}
|
||||
}
|
||||
|
||||
static void focusNextInLayout(WindowState& current) {
|
||||
if (!current.layout) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateFocusedWindow(current, current.layout->FocusNext());
|
||||
|
||||
static void checkDrawCursor(WindowState& current) {
|
||||
if (current.input != NULL) {
|
||||
curs_set(1);
|
||||
|
||||
@ -141,6 +135,24 @@ static void focusNextInLayout(WindowState& current) {
|
||||
}
|
||||
}
|
||||
|
||||
static void focusNextInLayout(WindowState& current) {
|
||||
if (!current.layout) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateFocusedWindow(current, current.layout->FocusNext());
|
||||
checkDrawCursor(current);
|
||||
}
|
||||
|
||||
static void focusPrevInLayout(WindowState& current) {
|
||||
if (!current.layout) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateFocusedWindow(current, current.layout->FocusPrev());
|
||||
checkDrawCursor(current);
|
||||
}
|
||||
|
||||
static inline std::string readKeyPress(int64 ch) {
|
||||
std::string kn = keyname((int)ch);
|
||||
|
||||
@ -285,6 +297,9 @@ int main(int argc, char* argv[])
|
||||
if (ch == '\t') { /* tab */
|
||||
focusNextInLayout(state);
|
||||
}
|
||||
else if (kn == "KEY_BTAB") { /* shift-tab */
|
||||
focusPrevInLayout(state);
|
||||
}
|
||||
else if (kn == "^D") { /* ctrl+d quits */
|
||||
quit = true;
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ IWindowPtr LayoutBase::FocusNext() {
|
||||
|
||||
IWindowPtr LayoutBase::FocusPrev() {
|
||||
IWindowPtr oldFocus = GetFocus();
|
||||
if (--this->focused <= 0) {
|
||||
if (--this->focused < 0) {
|
||||
this->focused = (int) this->focusable.size() - 1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user