mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2025-04-21 12:27:27 +03:00
Cleanup of touch screen code.
Initialize in constructor and clean up in destructor instead of having separate init() and deinit() methods. Don't close file descriptor if open failed (ts_fd == -1). Renamed initialized() to available(), since it tests whether the touch screen was found, not whether an initialization was attempted. Improved code layout and minor other cleanups.
This commit is contained in:
@@ -61,7 +61,7 @@ bool SettingsDialog::exec() {
|
||||
uint numRows = (gmenu2x->resY-gmenu2x->skinConfInt["topBarHeight"]-20)/rowHeight;
|
||||
|
||||
while (!close) {
|
||||
if (ts.initialized()) ts.poll();
|
||||
if (ts.available()) ts.poll();
|
||||
|
||||
bg.blit(gmenu2x->s,0,0);
|
||||
|
||||
@@ -88,11 +88,11 @@ bool SettingsDialog::exec() {
|
||||
|
||||
gmenu2x->s->setClipRect(clipRect);
|
||||
if (ts_pressed && !ts.pressed()) ts_pressed = false;
|
||||
if (ts.initialized() && ts.pressed() && !ts.inRect(touchRect)) ts_pressed = false;
|
||||
if (ts.available() && ts.pressed() && !ts.inRect(touchRect)) ts_pressed = false;
|
||||
for (i=firstElement; i<voices.size() && i<firstElement+numRows; i++) {
|
||||
iY = i-firstElement;
|
||||
voices[i]->draw(iY*rowHeight+gmenu2x->skinConfInt["topBarHeight"]+2);
|
||||
if (ts.initialized() && ts.pressed() && ts.inRect(touchRect.x, touchRect.y+(iY*rowHeight), touchRect.w, rowHeight)) {
|
||||
if (ts.available() && ts.pressed() && ts.inRect(touchRect.x, touchRect.y+(iY*rowHeight), touchRect.w, rowHeight)) {
|
||||
ts_pressed = true;
|
||||
sel = i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user