static void eresized(void) { resize(vnc, 0); requestupdate(vnc, 0); }
void readmouse(Vnc *v) { int cursorfd, len, n; char buf[10*EventSize], *start, *end; uchar curs[2*4+2*2*16]; Cursor *cs; Mouse m; cs = &dotcursor; snprint(buf, sizeof buf, "%s/cursor", display->devdir); if((cursorfd = open(buf, OWRITE)) < 0) sysfatal("open %s: %r", buf); BPLONG(curs+0*4, cs->offset.x); BPLONG(curs+1*4, cs->offset.y); memmove(curs+2*4, cs->clr, 2*2*16); write(cursorfd, curs, sizeof curs); resize(v, 1); requestupdate(vnc, 0); start = end = buf; len = 0; for(;;) { if((n = read(mousefd, end, sizeof(buf) - (end - buf))) < 0) sysfatal("read mouse failed"); len += n; end += n; while(len >= EventSize) { if(*start == 'm') { m.xy.x = atoi(start+1); m.xy.y = atoi(start+1+12); m.buttons = atoi(start+1+2*12) & 0x1F; m.xy = subpt(m.xy, screen->r.min); if(ptinrect(m.xy, Rpt(ZP, v->dim))) { mouseevent(v, m); /* send wheel button *release* */ if ((m.buttons & 0x7) != m.buttons) { m.buttons &= 0x7; mouseevent(v, m); } } } else eresized(); start += EventSize; len -= EventSize; } if(start - buf > sizeof(buf) - EventSize) { memmove(buf, start, len); start = buf; end = start+len; } } }
engine_display::engine_display(QWidget *parent) : QDialog(parent), ui(new Ui::engine_display) { ui->setupUi(this); this->setWindowFlags(Qt::Window); this->showFullScreen(); QObject::connect(handler,SIGNAL(requestupdate()),this,SLOT(update_engine_values())); update_engine_values(); }