diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-01-27 23:28:37 -0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-01-30 12:51:27 -0200 |
commit | 673f098734a03a5643465563b5df3e7a69ed9d7a (patch) | |
tree | e4b5a09eff3f9996c130e563f6f393d9632b2706 /ScreenManager.c | |
parent | ad99187680585bf66f9de4f617e897dada8767f7 (diff) |
Move responsibility for cursor placement to Panels
Diffstat (limited to 'ScreenManager.c')
-rw-r--r-- | ScreenManager.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ScreenManager.c b/ScreenManager.c index 05e1c024..1a93ae00 100644 --- a/ScreenManager.c +++ b/ScreenManager.c @@ -157,7 +157,8 @@ static void ScreenManager_drawPanels(ScreenManager* this, int focus) { } } -static Panel* setCurrentPanel(Panel* panel) { +static Panel* setCurrentPanel(ScreenManager* this, int focus) { + Panel* panel = (Panel*) Vector_get(this->panels, focus); FunctionBar_draw(panel->currentBar, NULL); return panel; } @@ -166,7 +167,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { bool quit = false; int focus = 0; - Panel* panelFocus = setCurrentPanel((Panel*) Vector_get(this->panels, focus)); + Panel* panelFocus = setCurrentPanel(this, focus); double oldTime = 0.0; @@ -189,8 +190,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { } int prevCh = ch; - set_escdelay(25); - ch = getch(); + ch = Panel_getCh(panelFocus); HandlerResult result = IGNORED; if (ch == KEY_MOUSE) { @@ -212,7 +212,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { ch = KEY_MOUSE; if (panel == panelFocus || this->allowFocusChange) { focus = i; - panelFocus = setCurrentPanel(panel); + panelFocus = setCurrentPanel(this, i); Object* oldSelection = Panel_getSelected(panel); Panel_setSelected(panel, mevent.y - panel->y + panel->scrollV - 1); if (Panel_getSelected(panel) == oldSelection) { @@ -288,7 +288,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { tryLeft: if (focus > 0) focus--; - panelFocus = setCurrentPanel((Panel*) Vector_get(this->panels, focus)); + panelFocus = setCurrentPanel(this, focus); if (Panel_size(panelFocus) == 0 && focus > 0) goto tryLeft; break; @@ -303,7 +303,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { tryRight: if (focus < this->panelCount - 1) focus++; - panelFocus = setCurrentPanel((Panel*) Vector_get(this->panels, focus)); + panelFocus = setCurrentPanel(this, focus); if (Panel_size(panelFocus) == 0 && focus < this->panelCount - 1) goto tryRight; break; |