Skip to content

Commit 76b2482

Browse files
committed
FLTK: fix INPUT display pos when scrolled
1 parent c98a254 commit 76b2482

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2014-06-14
2+
Fix crash evaluating "a \\ b"
3+
Fix INPUT command in FLTK for scrolled display
4+
15
2014-06-11
26
Android changes:
37
- Run by URL/QrCode.

src/platform/fltk/dev_fltk.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,8 @@ char *dev_gets(char *dest, int size) {
617617
wnd->_tabGroup->selected_child(wnd->_outputGroup);
618618
wnd->_outputGroup->begin();
619619

620-
LineInput *in = new LineInput(wnd->_out->getX() + 2,
621-
wnd->_out->getY() + 1,
620+
LineInput *in = new LineInput(wnd->_out->getX(true) + 2,
621+
wnd->_out->getY(true) + 1,
622622
20, wnd->_out->textHeight() + 4);
623623
wnd->_outputGroup->end();
624624
in->callback(enter_cb);

src/platform/fltk/display.cxx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,24 @@ void DisplayWidget::setColor(long color) {
374374
_ansiWidget->setColor(color);
375375
}
376376

377-
int DisplayWidget::getX() {
378-
return _ansiWidget->getX();
377+
int DisplayWidget::getX(bool offset) {
378+
int result = _ansiWidget->getX();
379+
if (offset) {
380+
int x, y;
381+
_ansiWidget->getScroll(x, y);
382+
result -= x;
383+
}
384+
return result;
379385
}
380386

381-
int DisplayWidget::getY() {
382-
return _ansiWidget->getY();
387+
int DisplayWidget::getY(bool offset) {
388+
int result = _ansiWidget->getY();
389+
if (offset) {
390+
int x, y;
391+
_ansiWidget->getScroll(x, y);
392+
result -= y;
393+
}
394+
return result;
383395
}
384396

385397
void DisplayWidget::setPixel(int x, int y, int c) {

src/platform/fltk/display.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ class DisplayWidget : public fltk::Widget, IButtonListener {
5656
void saveImage(const char *fn, int x, int y, int w, int h);
5757
void setTextColor(long fg, long bg);
5858
void setColor(long color);
59-
int getX();
60-
int getY();
59+
int getX(bool offset=false);
60+
int getY(bool offset=false);
6161
void setPixel(int x, int y, int c);
6262
void setXY(int x, int y);
6363
void setStartSize(int w, int h) { _startW=w; _startH=h; }

0 commit comments

Comments
 (0)