#ifndef lint static char sccsid[] = "@(#)SunOSI.c 9.2 87/11/20 Copyright 1985 Sun Micro"; #endif /* * Copyright (c) 1985 by Sun Microsystems, Inc. */ /*- Sun OS specific code for the graphics library SunOSI.c, Mon Sep 15 10:36:10 1986 James Gosling, Sun Microsystems */ #include #include extern char *snoopcalloc(); /* * Values from LATEST osi_create_screen_device call. No way to * associate this data with some context. */ char *sun_fb_name; char *sun_input_type; /* Style of input. Valid values are: * "sunwin" - SunWindows based, * "sundev" or NULL - /dev/kbd|console|mouse. */ int sun_left, sun_top, sun_width, sun_height; struct pixrect * osi_create_screen_device(name_str) char *name_str; { register struct pixrect *pr; int scan_count; extern char *calloc(); /* * Allocate global strings (if called twice the earlier string is left * allocated but unreferenced). */ sun_fb_name = snoopcalloc("osi_create_screen_device", 1, strlen(name_str)); sun_input_type = snoopcalloc("osi_create_screen_device", 1, strlen(name_str)); /* Decompose name_str into components */ (void) sscanf(name_str, "%s %hD %hD %hD %hD %s", sun_fb_name, &sun_left, &sun_top, &sun_width, &sun_height, sun_input_type); /* Always open a screen pixrect */ if ((pr = pr_open(sun_fb_name)) == 0) return (struct pixrect *)0; /* Conditionally create a region on a portion of the screen */ if (sun_left != 0 || sun_top != 0 || (sun_width > 0 && sun_width != pr->pr_width) || (sun_height > 0 && sun_height != pr->pr_height)) if ((pr = pr_region(pr, sun_left, sun_top, sun_width, sun_height)) == 0) return (struct pixrect *)0; /* The original pixrect is now left allocated but unreferenced */ return pr; }