void setcursor(Cursor *c) { drawqlock(); _xsetcursor(c); drawqunlock(); }
static void flushproc(void *a) { for(;;) { if(needflush) { drawqlock(); QDBeginCGContext(GetWindowPort(theWindow), &context); CGContextFlush(context); QDEndCGContext(GetWindowPort(theWindow), &context); needflush = false; drawqunlock(); } usleep(33333); } }
static void leave_full_screen(void) { if(amFullScreen) { EndFullScreen(fullScreenRestore, 0); theWindow = oldWindow; ShowWindow(theWindow); amFullScreen = 0; window_resized(); Rectangle rect = { { 0, 0 }, { bounds.size.width, bounds.size.height } }; wmtrack(0, rect.max.x, rect.max.y, 0); drawqlock(); flushmemscreen(rect); drawqunlock(); } }
static void full_screen(void) { if(!amFullScreen) { oldWindow = theWindow; HideWindow(theWindow); GDHandle device; GetWindowGreatestAreaDevice(theWindow, kWindowTitleBarRgn, &device, NULL); BeginFullScreen(&fullScreenRestore, device, 0, 0, &theWindow, 0, 0); amFullScreen = 1; window_resized(); Rectangle rect = { { 0, 0 }, { bounds.size.width, bounds.size.height } }; wmtrack(0, rect.max.x, rect.max.y, 0); drawqlock(); flushmemscreen(rect); drawqunlock(); } else leave_full_screen(); }
static void screenwin(void) { Point p; char *greet; Memimage *grey; drawqlock(); back = memwhite; conscol = memblack; memfillcolor(gscreen, 0x444488FF); h = memdefont->height; window.min = addpt(gscreen->r.min, Pt(20,20)); window.max.x = window.min.x + Dx(gscreen->r)*3/4-40; window.max.y = window.min.y + Dy(gscreen->r)*3/4-100; memimagedraw(gscreen, window, memblack, ZP, memopaque, ZP, S); window = insetrect(window, 4); memimagedraw(gscreen, window, memwhite, ZP, memopaque, ZP, S); /* a lot of work to get a grey color */ grey = allocmemimage(Rect(0,0,1,1), CMAP8); grey->flags |= Frepl; grey->clipr = gscreen->r; memfillcolor(grey, 0xAAAAAAFF); memimagedraw(gscreen, Rect(window.min.x, window.min.y, window.max.x, window.min.y+h+5+6), grey, ZP, nil, ZP, S); freememimage(grey); window = insetrect(window, 5); greet = " Plan 9 Console "; p = addpt(window.min, Pt(10, 0)); memimagestring(gscreen, p, conscol, ZP, memdefont, greet); window.min.y += h+6; curpos = window.min; window.max.y = window.min.y+((window.max.y-window.min.y)/h)*h; flushmemscreen(gscreen->r); drawqunlock(); }