예제 #1
0
파일: sqRPCMain.c 프로젝트: lsehub/Handle
int InitRiscOS(void) {
/* Initialise RiscOS for desktop wimp program use */
os_error * e;
extern  wimp_icon_create sqIconBarIcon;
extern void		GetDisplayParameters(void);
extern void		SetupWindowTitle(void);
extern void SetDefaultPointer(void);
extern void InitRootWindow(void);
int width;

	SetDefaultPointer();
	importantWimpMessages.messages[0] = message_MODE_CHANGE;
	importantWimpMessages.messages[1] = message_CLAIM_ENTITY;
	importantWimpMessages.messages[2] = message_DATA_REQUEST;
	importantWimpMessages.messages[3] = message_DATA_SAVE;
	importantWimpMessages.messages[4] = message_DATA_LOAD;
	importantWimpMessages.messages[5] = message_DATA_SAVE_ACK;
	importantWimpMessages.messages[6] = message_WINDOW_INFO;

/* set the taskname */
	if ( taskNameArg != NULL){
		strncpy(sqTaskName, taskNameArg, sqTaskNameLength );
	}

	if ((e = xwimp_initialise (wimp_VERSION_RO35,
					sqTaskName,
					(wimp_message_list*)&importantWimpMessages,
					&actualOSLevel,
					&Task_Handle)) != NULL) {
		platReportFatalError( e);
		return false;
	}
	SqueakDisplayDA =SqueakObjectSpaceDA = (os_dynamic_area_no)NULL;

/* strictly speaking we need to find the width of the chosen icon and give
 * wimp_creat_icon the larger of that and width (below). Oh and respond
 * to the message Message_FontChanged by recalculating it and using
 * wimp_resize_icon(wimp_ICON_BAR, icon id, x/y, x/y). */
	width = wimptextop_string_width(sqTaskName, 0);
	sqIconBarIcon.w = wimp_ICON_BAR_RIGHT;
	sqIconBarIcon.icon.extent.x0 = 0;
	sqIconBarIcon.icon.extent.y0 = -16;
	sqIconBarIcon.icon.extent.x1 = width;
	sqIconBarIcon.icon.extent.y1 = 84;
	sqIconBarIcon.icon.flags =
			wimp_ICON_INDIRECTED
			| wimp_ICON_TEXT
			| wimp_ICON_SPRITE
			| wimp_ICON_HCENTRED
			| 0x17000000   /* colour flags */
			| (wimp_BUTTON_CLICK
				<<wimp_ICON_BUTTON_TYPE_SHIFT ) ;
	sqIconBarIcon.icon.data.indirected_text_and_sprite.text = sqTaskName;
	sqIconBarIcon.icon.data.indirected_text_and_sprite.validation =
		validationString;  /* NB validation string has to be a global, not local to initRiscOS ! */
	sqIconBarIcon.icon.data.indirected_text_and_sprite.size =
		strlen(validationString);

	wimp_create_icon(&sqIconBarIcon);

	SetupPaletteTable();
	GetDisplayParameters();
	InitRootWindow();
	SetupWindowTitle();

	setFPStatus(0);

	setTimer();

	return true;
}
예제 #2
0
bool
RiscosGui::init(int argc, char **argv[])
{
    GNASH_REPORT_FUNCTION;

    /*    wimp_MESSAGE_LIST(4) messages = { { message_MODE_CHANGE,
                                            message_DATA_LOAD,
                                            message_DATA_OPEN,
                                            message_QUIT } };*/
    os_error *error;

    glue.init(argc, argv);

    error = xwimp_initialise(wimp_VERSION_RO38, "Gnash",
                             (wimp_message_list *)0/*&messages*/,
                             0, &_task);
    if (error) {
        log_debug("%s\n", error->errmess);
        return false;
    }

    if (!create_window())
        return false;

#ifdef RENDERER_AGG
    os_VDU_VAR_LIST(2) vduvars = { {
            os_VDUVAR_SCREEN_START,
            os_VDUVAR_END_LIST
        }
    };
    int vduvals[2];
    error = xos_read_vdu_variables((const os_vdu_var_list *)&vduvars,
                                   vduvals);
    if (error) {
        log_debug("%s\n", error->errmess);
        return false;
    }

    os_mode mode;
    os_mode_selector *mode_block;

    /* read current screenmode details */
    error = xosscreenmode_current(&mode);
    if (error) {
        log_debug("%s", error->errmess);
        return false;
    }

    if ((unsigned int)mode >= 256) {
        mode_block = (os_mode_selector *)mode;
        _screen_width = mode_block->xres;
        _screen_height = mode_block->yres;
    }

    /** \todo Mode specifiers */

    log_debug("Framebuffer address: %p\n", (void *)vduvals[0]);
    log_debug("Screen Res: %d x %d\n", _screen_width, _screen_height);

    glue.prepFramebuffer((void *)vduvals[0], _screen_width, _screen_height);
#endif

    _renderer = glue.createRenderHandler();
    set_render_handler(_renderer);
    // hack?
    _renderer->set_scale(1.0f, 1.0f);

    return true;
}