Esempio n. 1
0
inline void RedScreen::begin_update(QRegion& direct_rgn, QRegion& composit_rgn,
                                    QRegion& frame_rgn)
{
    region_init(&composit_rgn);
    RecurciveLock lock(_update_lock);
    region_clone(&direct_rgn, &_dirty_region);
    region_clear(&_dirty_region);
    _update_mark++;
    lock.unlock();

    QRegion rect_rgn;
    SpiceRect r;
    r.top = r.left = 0;
    r.right = _size.x;
    r.bottom = _size.y;
    region_init(&rect_rgn);
    region_add(&rect_rgn, &r);

    if (_frame_area) {
        region_clone(&frame_rgn, &direct_rgn);
        region_exclude(&frame_rgn, &rect_rgn);
    }
    region_and(&direct_rgn, &rect_rgn);
    region_destroy(&rect_rgn);

    for (int i = _layes.size() - 1; i >= 0; i--) {
        ScreenLayer* layer;

        if (!(layer = _layes[i])) {
            continue;
        }
        layer->begin_update(direct_rgn, composit_rgn);
    }
}
Esempio n. 2
0
File: cogland.c Progetto: 3v1n0/cogl
static void
cogland_compositor_create_surface (struct wl_client *wayland_client,
                                   struct wl_resource *wayland_compositor_resource,
                                   uint32_t id)
{
  CoglandCompositor *compositor =
    wl_resource_get_user_data (wayland_compositor_resource);
  CoglandSurface *surface = g_slice_new0 (CoglandSurface);

  surface->compositor = compositor;

  wl_signal_init (&surface->destroy_signal);

  surface->resource = wl_client_add_object (wayland_client,
                                            &wl_surface_interface,
                                            &cogland_surface_interface,
                                            id,
                                            surface);
  wl_resource_set_destructor (surface->resource,
                              cogland_surface_resource_destroy_cb);

  surface->pending.buffer_destroy_listener.notify =
    surface_handle_pending_buffer_destroy;
  wl_list_init (&surface->pending.frame_callback_list);
  region_init (&surface->pending.damage);

  compositor->surfaces = g_list_prepend (compositor->surfaces,
                                         surface);
}
Esempio n. 3
0
void
vm_init(void)
{

	region_init(&kern_map.head);
	kern_task.map = &kern_map;
}
Esempio n. 4
0
int main(int argc, char *argv[])
{
	DCL_THREADGBL_ACCESS;

	GTM_THREADGBL_INIT;
	set_blocksig();
	gtm_imagetype_init(DSE_IMAGE);
	gtm_wcswidth_fnptr = gtm_wcswidth;
	gtm_env_init();	/* read in all environment variables */
	licensed = TRUE;
	TREF(transform) = TRUE;
	op_open_ptr = op_open;
	patch_curr_blk = get_dir_root();
	err_init(util_base_ch);
	GTM_ICU_INIT_IF_NEEDED;	/* Note: should be invoked after err_init (since it may error out) and before CLI parsing */
	sig_init(generic_signal_handler, dse_ctrlc_handler, suspsigs_handler);
	atexit(util_exit_handler);
	SET_LATCH_GLOBAL(&defer_latch, LOCK_AVAILABLE);
	get_page_size();
	stp_init(STP_INITSIZE);
	rts_stringpool = stringpool;
	getjobname();
	INVOKE_INIT_SECSHR_ADDRS;
	getzdir();
	prealloc_gt_timers();
	initialize_pattern_table();
	gvinit();
	region_init(FALSE);
	INIT_GBL_ROOT(); /* Needed for GVT initialization */
	getjobnum();
	util_out_print("!/File  !_!AD", TRUE, DB_LEN_STR(gv_cur_region));
	util_out_print("Region!_!AD!/", TRUE, REG_LEN_STR(gv_cur_region));
	cli_lex_setup(argc, argv);
	CREATE_DUMMY_GBLDIR(gd_header, original_header, gv_cur_region, gd_map, gd_map_top);
	gtm_chk_dist(argv[0]);
#	ifdef DEBUG
	if ((gtm_white_box_test_case_enabled && (WBTEST_SEMTOOLONG_STACK_TRACE == gtm_white_box_test_case_number) ))
	{
		sgmnt_addrs     * csa;
		node_local_ptr_t cnl;
		csa = &FILE_INFO(gv_cur_region)->s_addrs;
		cnl = csa->nl;
		cnl->wbox_test_seq_num  = 1; /*Signal the first step and wait here*/
		while (2 != cnl->wbox_test_seq_num) /*Wait for another process to get hold of the semaphore and signal next step*/
			LONG_SLEEP(10);
	}
#	endif
	if (argc < 2)
                display_prompt();
	io_init(TRUE);
	while (1)
	{
		if (!dse_process(argc))
			break;
		display_prompt();
	}
	dse_exit();
	REVERT;
}
Esempio n. 5
0
int main(int argc, char *argv[])
{
  region r[11];
  int i = 0;
  node n = NULL;
  region node_region;
  
  region_init();
  list_init();
  hash_table_init();
  banshee_region_persistence_init();
  seed_fn_ptr_table(newregion());

  node_region = newregion();

  r[10] = NULL;
  r[9] = strbucket_region;
  r[8] = banshee_ptr_region;
  r[7] = list_strnode_region;
  r[6] = list_node_region;
  r[5] = list_header_region;
  r[4] = banshee_nonptr_region;
  r[3] = bucket_region;
  r[2] = table_region;
  r[1] = bucketptr_region;
  r[0] = node_region;

  thetable = make_persistent_string_hash_table(8, 1);
  thelist = new_persistent_node_list();

  for(i = 0; i < NUM_NODES; i++) {
    char str[512];
    node prev = n;
    n = ralloc(node_region, struct node_);
    n->data = i;
    n->next = prev;

    snprintf(str, 512,"node(%d)", i);

    hash_table_insert(thetable, (hash_key)rstrdup(banshee_nonptr_region, str),
		      (hash_data)n);
    node_list_append_tail(n, thelist);
  }

  serialize(r, "data", "offsets");

  update();
  if (!verify()) {
    printf("Failed region persist test\n");
    exit(1);
  }
  else {
    printf("Passed region persist test\n");
    exit(0);
  }

}
Esempio n. 6
0
void display_region_list_add(struct display_t * disp, struct region_t * r)
{
	struct region_t region;
	if(disp)
	{
		region_init(&region, 0, 0, disp->fb->width, disp->fb->height);
		if(region_intersect(&region, &region, r))
			region_list_add(disp->rl, &region);
	}
}
Esempio n. 7
0
void clear_proc(struct vmproc *vmp)
{
	region_init(&vmp->vm_regions_avl);
	vmp->vm_flags = 0;		/* Clear INUSE, so slot is free. */
#if VMSTATS
	vmp->vm_bytecopies = 0;
#endif
	vmp->vm_region_top = 0;
	reset_vm_rusage(vmp);
}
Esempio n. 8
0
void free_proc(struct vmproc *vmp)
{
	map_free_proc(vmp);
	pt_free(&vmp->vm_pt);
	region_init(&vmp->vm_regions_avl);
#if VMSTATS
	vmp->vm_bytecopies = 0;
#endif
	vmp->vm_region_top = 0;
	reset_vm_rusage(vmp);
}
Esempio n. 9
0
bool tiling_init(WTiling *ws, WWindow *parent, const WFitParams *fp, 
                WRegionSimpleCreateFn *create_frame_fn, bool ci)
{
    ws->split_tree=NULL;
    ws->create_frame_fn=(create_frame_fn 
                         ? create_frame_fn
                         : create_frame_tiling);
    ws->stdispnode=NULL;
    ws->managed_list=NULL;
    ws->batchop=FALSE;
    
    ws->dummywin=XCreateWindow(ioncore_g.dpy, parent->win,
                                fp->g.x, fp->g.y, 1, 1, 0,
                                CopyFromParent, InputOnly,
                                CopyFromParent, 0, NULL);
    if(ws->dummywin==None)
        return FALSE;

    region_init(&(ws->reg), parent, fp);

    ws->reg.flags|=(REGION_GRAB_ON_PARENT|
                    REGION_PLEASE_WARP);
    
    if(ci){
        WRegionAttachData data;
        WRegion *res;
        
        data.type=REGION_ATTACH_NEW;
        data.u.n.fn=(WRegionCreateFn*)ws->create_frame_fn;
        data.u.n.param=NULL;
    
        res=region_attach_helper((WRegion*)ws, parent, fp,
                                 (WRegionDoAttachFn*)tiling_do_attach_initial, 
                                 NULL, &data);

        if(res==NULL){
            XDestroyWindow(ioncore_g.dpy, ws->dummywin);
            return FALSE;
        }
    }
    
    XSelectInput(ioncore_g.dpy, ws->dummywin,
                 FocusChangeMask|KeyPressMask|KeyReleaseMask|
                 ButtonPressMask|ButtonReleaseMask);
    XSaveContext(ioncore_g.dpy, ws->dummywin, ioncore_g.win_context,
                 (XPointer)ws);
    
    region_register(&(ws->reg));
    region_add_bindmap((WRegion*)ws, mod_tiling_tiling_bindmap);
    
    return TRUE;
}
Esempio n. 10
0
/*
 * @brief MPU default configuration
 *
 * This function provides the default configuration mechanism for the Memory
 * Protection Unit (MPU).
 */
static int arm_mpu_init(struct device *arg)
{
	u32_t r_index;

	if (mpu_config.num_regions > get_num_regions()) {
		/* Attempt to configure more MPU regions than
		 * what is supported by hardware. As this operation
		 * is executed during system (pre-kernel) initialization,
		 * we want to ensure we can detect an attempt to
		 * perform invalid configuration.
		 */
		__ASSERT(0,
			"Request to configure: %u regions (supported: %u)\n",
			mpu_config.num_regions,
			get_num_regions()
		);
		return -1;
	}

	LOG_DBG("total region count: %d", get_num_regions());

	arm_core_mpu_disable();

	/* Architecture-specific configuration */
	mpu_init();

	/* Program fixed regions configured at SOC definition. */
	for (r_index = 0U; r_index < mpu_config.num_regions; r_index++) {
		region_init(r_index, &mpu_config.mpu_regions[r_index]);
	}

	/* Update the number of programmed MPU regions. */
	static_regions_num = mpu_config.num_regions;


	arm_core_mpu_enable();

	/* Sanity check for number of regions in Cortex-M0+, M3, and M4. */
#if defined(CONFIG_CPU_CORTEX_M0PLUS) || \
	defined(CONFIG_CPU_CORTEX_M3) || \
	defined(CONFIG_CPU_CORTEX_M4)
	__ASSERT(
		(MPU->TYPE & MPU_TYPE_DREGION_Msk) >> MPU_TYPE_DREGION_Pos == 8,
		"Invalid number of MPU regions\n");
#elif defined(DT_NUM_MPU_REGIONS)
	__ASSERT(
		(MPU->TYPE & MPU_TYPE_DREGION_Msk) >> MPU_TYPE_DREGION_Pos ==
		DT_NUM_MPU_REGIONS,
		"Invalid number of MPU regions\n");
#endif /* CORTEX_M0PLUS || CPU_CORTEX_M3 || CPU_CORTEX_M4 */
	return 0;
}
Esempio n. 11
0
/*
 * Create new virtual memory space.
 * No memory is inherited.
 * Must be called with scheduler locked.
 */
vm_map_t
vm_create(void)
{
	struct vm_map *map;

	/* Allocate new map structure */
	if ((map = kmem_alloc(sizeof(*map))) == NULL)
		return NULL;

	map->refcnt = 1;
	region_init(&map->head);
	return map;
}
Esempio n. 12
0
File: rlist.c Progetto: aahud/harvey
void main(int argc, char * argv[])
{
	Rectangle r1 = Rect(0, 0, 300, 200);
	Rectangle r2 = Rect(100, 100, 400, 300);
	Rectangle r3 = Rect(200, 100, 500, 300);
	Region reg;

	initdraw(0, 0, "vncviewer");
	region_init(&reg);
	region_union(&reg, r1, r1);
	region_union(&reg, r2, r2);
	region_union(&reg, r3, r3);
}
Esempio n. 13
0
TLIBAPI struct Region *region_new(struct RectPool *pool, TINT *s)
{
	struct TExecBase *TExecBase = pool->p_ExecBase;
	struct Region *region = TAlloc(TNULL, sizeof(struct Region));
	if (region)
	{
		if (!region_init(pool, region, s))
		{
			TFree(region);
			region = TNULL;
		}
	}
	return region;
}
Esempio n. 14
0
void lke_setgdr(void)
{
	gd_region 	*r_top;
	mval		reset;
	bool		def;
	short		len;
	char		buf[256];
	int4		rundown_status = EXIT_NRM;			/* if gds_rundown went smoothly */
	static readonly char init_gdr[] = "gtmgbldir";

	gvcmy_rundown();
	gv_cur_region = gd_header->regions;
	r_top = gv_cur_region + gd_header->n_regions;
	for (gv_cur_region = gd_header->regions,
	  r_top = gv_cur_region + gd_header->n_regions;
	  gv_cur_region < r_top;
	  gv_cur_region++)
	{
		tp_change_reg();
		UNIX_ONLY(rundown_status |=) gds_rundown();
	}

	if (EXIT_NRM != rundown_status)
		rts_error(VARLSTCNT(1) ERR_NOTALLDBRNDWN);

	if (cli_present("gld"))
	{
		cli_get_value("gld", buf) ;
		def = FALSE;
		reset.mvtype = MV_STR;
		reset.str.len = STRLEN(buf);
		reset.str.addr = buf;
	}
	else
	{
		reset.mvtype = MV_STR;
		reset.str.len = SIZEOF(init_gdr) - 1;
		reset.str.addr = init_gdr;
	}

	zgbldir(&reset);
	cs_addrs = 0;
	cs_data = 0;
	region_init(FALSE) ;
#ifndef MUTEX_MSEM_WAKE
	mutex_sock_cleanup();
#endif
	gtmsecshr_sock_cleanup(CLIENT);
}
Esempio n. 15
0
File: vm.c Progetto: AndrewD/prex
void
vm_init(void)
{
	pgd_t pgd;

	/*
	 * Setup vm mapping for kernel task.
	 */
	pgd = mmu_newmap();
	ASSERT(pgd != NULL);
	kern_map.pgd = pgd;
	mmu_switch(pgd);
	region_init(&kern_map.head);
	kern_task.map = &kern_map;
}
Esempio n. 16
0
RedScreen::RedScreen(Application& owner, int id, const std::string& name, int width, int height)
    : _owner (owner)
    , _id (id)
    , _refs (1)
    , _window (*this)
    , _active (false)
    , _full_screen (false)
    , _out_of_sync (false)
    , _frame_area (false)
    , _periodic_update (false)
    , _key_interception (false)
    , _update_by_timer (true)
    , _size_locked (false)
    , _forec_update_timer (0)
    , _update_timer (new UpdateTimer(this))
    , _composit_area (NULL)
    , _update_mark (1)
    , _monitor (NULL)
    , _default_cursor (NULL)
    , _inactive_cursor (NULL)
    , _pixel_format_index (0)
    , _update_interrupt_trigger (NULL)
    , _pointer_layer (NULL)
    , _mouse_captured (false)
    , _active_layer_change_event (false)
    , _pointer_on_screen (false)
{
    region_init(&_dirty_region);
    set_name(name);
    _size.x = width;
    _size.y = height;
    _origin.x = _origin.y = 0;
    create_composit_area();
    _window.resize(_size.x, _size.y);
    save_position();
    if ((_default_cursor = Platform::create_default_cursor()) == NULL) {
        THROW("create default cursor failed");
    }
    if ((_inactive_cursor = Platform::create_inactive_cursor()) == NULL) {
        THROW("create inactive cursor failed");
    }
    _window.set_cursor(_default_cursor);
    update_menu();
    AutoRef<Icon> icon(Platform::load_icon(RED_ICON_RES_ID));
    _window.set_icon(*icon);
    _window.start_key_interception();
}
Esempio n. 17
0
File: cogland.c Progetto: 3v1n0/cogl
static void
cogland_compositor_create_region (struct wl_client *wayland_client,
                                  struct wl_resource *compositor_resource,
                                  uint32_t id)
{
  CoglandSharedRegion *region = g_slice_new0 (CoglandSharedRegion);

  region->resource = wl_client_add_object (wayland_client,
                                           &wl_region_interface,
                                           &cogland_region_interface,
                                           id,
                                           region);
  wl_resource_set_destructor (region->resource,
                              cogland_region_resource_destroy_cb);

  region_init (&region->region);
}
Esempio n. 18
0
static int region_allocate_and_init(const u8_t index,
	const struct arm_mpu_region *region_conf)
{
	/* Attempt to allocate new region index. */
	if (index > (get_num_regions() - 1)) {

		/* No available MPU region index. */
		LOG_ERR("Failed to allocate new MPU region %u\n", index);
		return -EINVAL;
	}

	LOG_DBG("Program MPU region at index 0x%x", index);

	/* Program region */
	region_init(index, region_conf);

	return index;
}
Esempio n. 19
0
void lke(void)
{
	char		buff[MAX_LINE];
	$DESCRIPTOR	(command, buff);
	uint4		status;
	short		len;
	bool		dcl;
	DCL_THREADGBL_ACCESS;

	GTM_THREADGBL_INIT;
	gtm_imagetype_init(LKE_IMAGE);
	gtm_env_init();	/* read in all environment variables */
	util_out_open(0);
	SET_EXIT_HANDLER(exi_blk, generic_exit_handler, exi_condition);	/* Establish exit handler */
	ESTABLISH(util_base_ch);
	status =lp_id(&lkid);
	if (SS$_NORMAL != status)
		rts_error(VARLSTCNT(1) status);
	get_page_size();
	stp_init(STP_INITSIZE);
	rts_stringpool = stringpool;
	getjobname();
	INVOKE_INIT_SECSHR_ADDRS;
	ast_init();
	initialize_pattern_table();
	gvinit();
	region_init(TRUE);
	getjobnum();
	status = lib$get_foreign(&command, 0, &len, 0);
	if ((status & 1) && len > 0)
	{
		command.dsc$w_length = len;
		status = CLI$DCL_PARSE(&command, &lke_cmd, &lib$get_input, 0, 0);
		if (CLI$_NORMAL == status)
		{
			util_out_open(&output_qualifier);
			CLI$DISPATCH();
			util_out_close();
		}
		lke_exit();
	}
	for (;;)
		lke_process();
}
Esempio n. 20
0
File: vm.c Progetto: AndrewD/prex
/*
 * Create new virtual memory space.
 * No memory is inherited.
 *
 * Must be called with scheduler locked.
 */
vm_map_t
vm_create(void)
{
	struct vm_map *map;

	/* Allocate new map structure */
	if ((map = kmem_alloc(sizeof(*map))) == NULL)
		return NULL;

	map->refcnt = 1;

	/* Allocate new page directory */
	if ((map->pgd = mmu_newmap()) == NULL) {
		kmem_free(map);
		return NULL;
	}
	region_init(&map->head);
	return map;
}
Esempio n. 21
0
int ui_switch_init( Console* cons )
{
	int status = 0;

	/* Initialize switchio body */
	/* Notice an Iobuf is only needed to point to the console.  No
	   io should be done in this frame */
	switchFrameio = &switchFrameiobody;
	status = iobuf_init( switchFrameio, cons );
	ASSERT( status == ERR_NONE );
	
	switchFrame = &switchFramebody;
	buffers[ 0 ] = buffersbody;
	buffers[ 1 ] = buffersbody + UI_SWITCH_WIDTH;
	
	status = region_setup( switchFrame, 0,
			       UI_SWITCH_COLUMN, UI_SWITCH_ROW,
			       UI_SWITCH_WIDTH, UI_SWITCH_HEIGHT,
			       UI_SWITCH_HORIZONTAL_MARGIN, UI_SWITCH_VERTICAL_MARGIN,
			       UI_SWITCH_BOUNDRY, switchFrameio, buffers );
	ASSERT( status == ERR_NONE );

	status = region_init( switchFrame );
	ASSERT( status == ERR_NONE );

	status = region_write( switchFrame, UI_SWITCH_TITLE );
	ASSERT( status == ERR_NONE );

	while( ! region_flushed( switchFrame ) ){
		status = region_flush( switchFrame );
		ASSERT( status == ERR_NONE );
	}

	/* Print switch names */
	status = ui_switch_names( cons );
	ASSERT( status == ERR_NONE );

	/* Init switch individual states */
	status = ui_switch_state_init( cons );
	ASSERT( status == ERR_NONE );

	return ERR_NONE;
}
Esempio n. 22
0
void engine_init(void)
{
  region_init();

  engine_region = newregion();

  hash_table_init();
  seed_fn_ptr_table(permanent);

  banshee_region_persistence_init();
  bounds_init();
  stamp_init();
  list_init();
  uf_init();
  term_hash_init();

  rb_stack = new_persistent_banshee_rollback_stack();
  handle_error = default_error_handler;

}
Esempio n. 23
0
int ui_timer_init( Console* outputCons )
{
	int status = 0;
	
	iobuf = &iobody;	
	status = iobuf_init( iobuf, outputCons );
	ASSERT( status == ERR_NONE );

	buffers[ 0 ] = buffersbody;
	buffers[ 1 ] = buffersbody + UI_TIME_WIDTH;

	cons = &consbody;
	status = region_setup( cons, 0, UI_TIME_COLUMN, UI_TIME_ROW, UI_TIME_WIDTH, UI_TIME_HEIGHT, UI_TIME_HORIZONTAL_MARGIN, UI_TIME_VERTICAL_MARGIN, UI_TIME_BOUNDRY, iobuf, buffers );
	ASSERT( status == ERR_NONE );

	status = region_init( cons );
	ASSERT( status == ERR_NONE );

	DEBUG_PRINT( DBG_TIMER, "%s: Done\n", __func__ );

	return ERR_NONE;
}
Esempio n. 24
0
File: lke.c Progetto: indera/fis-gtm
int main (int argc, char *argv[])
{
    DCL_THREADGBL_ACCESS;

    GTM_THREADGBL_INIT;
    set_blocksig();
    gtm_imagetype_init(LKE_IMAGE);
    gtm_wcswidth_fnptr = gtm_wcswidth;
    gtm_env_init();	/* read in all environment variables */
    licensed = TRUE;
    err_init(util_base_ch);
    GTM_ICU_INIT_IF_NEEDED;	/* Note: should be invoked after err_init (since it may error out) and before CLI parsing */
    sig_init(generic_signal_handler, lke_ctrlc_handler, suspsigs_handler);
    atexit(util_exit_handler);
    SET_LATCH_GLOBAL(&defer_latch, LOCK_AVAILABLE);
    get_page_size();
    stp_init(STP_INITSIZE);
    rts_stringpool = stringpool;
    getjobname();
    INVOKE_INIT_SECSHR_ADDRS;
    getzdir();
    prealloc_gt_timers();
    initialize_pattern_table();
    gvinit();
    region_init(TRUE);
    getjobnum();

    cli_lex_setup(argc, argv);
    /*      this should be after cli_lex_setup() due to S390 A/E conversion    */
    gtm_chk_dist(argv[0]);

    while (1)
    {
        if (!lke_process(argc) || 2 <= argc)
            break;
    }
    lke_exit();
}
Esempio n. 25
0
static inline int ui_switch_state_init( Console* cons )
{
	uint i = 0;
	int status = 0;
	uchar* buffers[ 2 ] = { 0 };

	for( i = 0; i < SWITCHES_COUNT; i += 1 ){
		status = iobuf_init( switchesIoBuf + i, cons );
		ASSERT( status == ERR_NONE );

		buffers[ 0 ] = switchesOutBuf + i * 2;
		buffers[ 1 ] = switchesOutBuf + i * 2 + 1;

		region_setup( switches + i, switchFrame,
			      ( i % UI_SWITCH_NAME_PER_LINE ) * UI_SWITCH_NAME_SIZE + UI_SWITCH_STATE_OFFSET,
			      ( i / UI_SWITCH_NAME_PER_LINE ) + 2,
			      1, 1, 0, 0, 0, switchesIoBuf + i, buffers );

		region_init( switches + i );
	}
	
	return ERR_NONE;
}
Esempio n. 26
0
LOCAL TBOOL rfb_getlayermask(struct rfb_Display *mod, struct Region *A,
	TINT *crect, struct rfb_Window *v, TINT dx, TINT dy)
{
	if (crect[0] < 0)
		return TFALSE;
	struct RectPool *pool = &mod->rfb_RectPool;

	if (!region_init(pool, A, crect))
		return TFALSE;
	if (v->rfbw_Flags & RFBWFL_BACKBUFFER)
		return TTRUE;
	TBOOL success = TFALSE;
	struct Region L;

	if (rfb_getlayers(mod, &L, v, dx, dy))
	{
		success = region_subregion(pool, A, &L);
		region_free(pool, &L);
	}
	if (!success)
		region_free(pool, A);
	return success;
}
Esempio n. 27
0
bool window_do_init(WWindow *wwin, WWindow *par, 
                    const WFitParams *fp, Window win, const char *name)
{
    if(win==None){
        assert(par!=NULL);
        win=create_xwindow(region_rootwin_of((WRegion*)par),
                           par->win, &(fp->g), name);
        if(win==None)
            return FALSE;
    }

    wwin->win=win;
    wwin->xic=NULL;
    wwin->event_mask=0;
    wwin->stacking=NULL;
    
    region_init(&(wwin->region), par, fp);
    
    XSaveContext(ioncore_g.dpy, win, ioncore_g.win_context, 
                 (XPointer)wwin);
    
    return TRUE;
}
Esempio n. 28
0
LOCAL TBOOL rfb_getlayers(struct rfb_Display *mod, struct Region *A,
	struct rfb_Window *v, TINT dx, TINT dy)
{
	struct RectPool *pool = &mod->rfb_RectPool;

	region_init(pool, A, TNULL);
	struct TNode *next, *node = mod->rfb_VisualList.tlh_Head.tln_Succ;

	for (; (next = node->tln_Succ); node = next)
	{
		struct rfb_Window *bv = (struct rfb_Window *) node;

		if (bv == v)
			break;
		if (!region_orrect(pool, A, bv->rfbw_ScreenRect.r, TFALSE))
		{
			region_free(pool, A);
			return TFALSE;
		}
	}
	if (dx || dy)
		region_shift(A, dx, dy);
	return TTRUE;
}
Esempio n. 29
0
/*===========================================================================*
 *				do_fork					     *
 *===========================================================================*/
int do_fork(message *msg)
{
  int r, proc, childproc;
  struct vmproc *vmp, *vmc;
  pt_t origpt;
  vir_bytes msgaddr;

  SANITYCHECK(SCL_FUNCTIONS);

  if(vm_isokendpt(msg->VMF_ENDPOINT, &proc) != OK) {
	printf("VM: bogus endpoint VM_FORK %d\n", msg->VMF_ENDPOINT);
  SANITYCHECK(SCL_FUNCTIONS);
	return EINVAL;
  }

  childproc = msg->VMF_SLOTNO;
  if(childproc < 0 || childproc >= NR_PROCS) {
	printf("VM: bogus slotno VM_FORK %d\n", msg->VMF_SLOTNO);
  SANITYCHECK(SCL_FUNCTIONS);
	return EINVAL;
  }

  vmp = &vmproc[proc];		/* parent */
  vmc = &vmproc[childproc];	/* child */
  assert(vmc->vm_slot == childproc);

  /* The child is basically a copy of the parent. */
  origpt = vmc->vm_pt;
  *vmc = *vmp;
  vmc->vm_slot = childproc;
  region_init(&vmc->vm_regions_avl);
  vmc->vm_endpoint = NONE;	/* In case someone tries to use it. */
  vmc->vm_pt = origpt;

#if VMSTATS
  vmc->vm_bytecopies = 0;
#endif

  if(pt_new(&vmc->vm_pt) != OK) {
	printf("VM: fork: pt_new failed\n");
	return ENOMEM;
  }

  SANITYCHECK(SCL_DETAIL);

  if(map_proc_copy(vmc, vmp) != OK) {
	printf("VM: fork: map_proc_copy failed\n");
	pt_free(&vmc->vm_pt);
	return(ENOMEM);
  }

  /* Only inherit these flags. */
  vmc->vm_flags &= VMF_INUSE;

  /* inherit the priv call bitmaps */
  memcpy(&vmc->vm_call_mask, &vmp->vm_call_mask, sizeof(vmc->vm_call_mask));

  /* Tell kernel about the (now successful) FORK. */
  if((r=sys_fork(vmp->vm_endpoint, childproc,
	&vmc->vm_endpoint, PFF_VMINHIBIT, &msgaddr)) != OK) {
        panic("do_fork can't sys_fork: %d", r);
  }

  if((r=pt_bind(&vmc->vm_pt, vmc)) != OK)
	panic("fork can't pt_bind: %d", r);

  {
	vir_bytes vir;
	/* making these messages writable is an optimisation
	 * and its return value needn't be checked.
	 */
	vir = msgaddr;
	if (handle_memory(vmc, vir, sizeof(message), 1) != OK)
	    panic("do_fork: handle_memory for child failed\n");
	vir = msgaddr;
	if (handle_memory(vmp, vir, sizeof(message), 1) != OK)
	    panic("do_fork: handle_memory for parent failed\n");
  }

  /* Inform caller of new child endpoint. */
  msg->VMF_CHILD_ENDPOINT = vmc->vm_endpoint;

  SANITYCHECK(SCL_FUNCTIONS);
  return OK;
}
Esempio n. 30
0
File: cogland.c Progetto: 3v1n0/cogl
static void
cogland_surface_commit (struct wl_client *client,
                        struct wl_resource *resource)
{
  CoglandSurface *surface = wl_resource_get_user_data (resource);
  CoglandCompositor *compositor = surface->compositor;

  /* wl_surface.attach */
  if (surface->pending.newly_attached &&
      surface->buffer_ref.buffer != surface->pending.buffer)
    {
      CoglError *error = NULL;

      if (surface->texture)
        {
          cogl_object_unref (surface->texture);
          surface->texture = NULL;
        }

      cogland_buffer_reference (&surface->buffer_ref, surface->pending.buffer);

      if (surface->pending.buffer)
        {
          struct wl_resource *buffer_resource =
            surface->pending.buffer->resource;

          surface->texture =
            cogl_wayland_texture_2d_new_from_buffer (compositor->cogl_context,
                                                     buffer_resource,
                                                     &error);

          if (!surface->texture)
            {
              g_error ("Failed to create texture_2d from wayland buffer: %s",
                       error->message);
              cogl_error_free (error);
            }
        }
    }
  if (surface->pending.buffer)
    {
      wl_list_remove (&surface->pending.buffer_destroy_listener.link);
      surface->pending.buffer = NULL;
    }
  surface->pending.sx = 0;
  surface->pending.sy = 0;
  surface->pending.newly_attached = FALSE;

  /* wl_surface.damage */
  if (surface->buffer_ref.buffer &&
      surface->texture &&
      !region_is_empty (&surface->pending.damage))
    {
      CoglandRegion *region = &surface->pending.damage;
      CoglTexture *texture = surface->texture;

      if (region->x2 > cogl_texture_get_width (texture))
        region->x2 = cogl_texture_get_width (texture);
      if (region->y2 > cogl_texture_get_height (texture))
        region->y2 = cogl_texture_get_height (texture);
      if (region->x1 < 0)
        region->x1 = 0;
      if (region->y1 < 0)
        region->y1 = 0;

      surface_damaged (surface,
                       region->x1,
                       region->y1,
                       region->x2 - region->x1,
                       region->y2 - region->y1);
    }
  region_init (&surface->pending.damage);

  /* wl_surface.frame */
  wl_list_insert_list (&compositor->frame_callbacks,
                       &surface->pending.frame_callback_list);
  wl_list_init (&surface->pending.frame_callback_list);
}